piclist 2001\04\25\133639a >
Thread: Using large table to store/display graphics LCD data
www.piclist.com/techref/io/lcd/pic.htm?key=lcd
flavicon
face BY : David Cary email (remove spam text)



Dear Tim Thompson,

Tim Thompson <.....irule.....spam.....IRULE.NET> on 2001-04-25 03:31:07 AM begged for help:
...
> this is probably a simple fix.

Yep. One instruction.

...
> uses a PIC16F877 to interface
> a t6963c based 240x64 graphics LCD display

Does it really display 6 pixels per byte ?

...
> The table code is a modifyed version of the
> 'Big Table lookups' code in the piclist code repository.
> The problem is
> the display shows a few 'random' pixels here and there, nothing
> what the picture is supposed to be of, and the the PIC stops responding.
...
> http://www.irule.net/projects/carlcd/logo.asm
...
> Table   movlw High(TStart)
...
>         movlw Low(TStart)
>         addwf OffsetL,W
>         btfsc STATUS,C
>         incf PCLATH,F
>         movf OffsetL,W
>
> DoTable addwf PCL, F
> TStart
>         <dt lines go here>

Yep, simple fix. You're adding the Lo byte of the address of the table twice.
That last "add" needs to be a "mov".

    ; warning: untested code.
Table:
       movlw High(TStart)
       movwf PCLATH
       movf OffsetH,W
       addwf PCLATH,F
       movlw Low(TStart)
       addwf OffsetL,W
       btfsc STATUS,C
       incf PCLATH,F
       movf OffsetL,W
       movwf PCL

    ; OK to put more code here
    nop
    ...
    nop
    nop

TStart
    dt 0x00
     ; more dt lines go here
    ...

That should fix it, but let me ramble on a bit.

So, do you have any code to handle proportional fonts yet ?

I've simplified my table lookup code even further so it just directly jumps to
the address in OffsetH,OffsetL (rather than adding that offset to TStart). That
means that my loop code has to initialize OffsetH:OffsetL to Tstart, and loops
until I reach (TStart + 240*64/6) == OffsetH:OffsetL.

This has the advantage of letting me use *same* ``lookup'' subroutine for
several different tables --
a big startup screen, a font table, and another font table with large numbers. I
don't need 3 different copies of this subroutines, where the only difference
would be "TStart" replaced with "FontStart" or "BigNumberFontStart".

; Jump to address in look_hi/look_lo, which presumably is an RETLW.
; Note pointer post increment.
; Equivalent to: W=*look_ptr++
; from www.piclist.com/techref/microchip/tables.htm
; Handles tables of any size located anywhere in program FLASH.
; (256 byte tables don't work if you merely do ``addwf PCL,f'').
; And I want to handle
; at least 96 characters/table * 12 bytes/character = 1 152 bytes/table = 0x480
bytes/table.
; [FIXME: might be improved by
; www.piclist.com/techref/microchip/tables.htm
; tells how to read and write all 14 bits of a program memory location.
; ]
; http://piclist.com/techref/microchip/bigtable.htm

lookup:
               movf look_hi,w          ; set PCLATH
               movwf PCLATH
               movf look_lo,w          ; and get PCL
               incf look_lo,f          ; but post inc
               skpnz
               incf look_hi,f
               movwf PCL               ; ok, now jump
               ; return

; lookupTOS:
; 2001-04-18:DAV: wrote lookupTOS() based on lookup()
; same as lookup, but uses a 16 bit value on the stack.
; Leaves the incremented value on stack, with result in w.
lookupTOS: ; ( lsB1 MSB1 count -- lsB3 MSB3 count ) where MSB3:lsB3 = (MSB1:lsB1
+ 1).
         pop  ; leave 8 bit ``count'' alone, increment the 16 bit value under
it.
         peekw          ; set PCLATH with MSB
         movwf PCLATH
         pop
         peekw     ; get PCL
         incf TOS,f     ; post increment
         push ; return to MSB without affecting Z
         skpnz
         incf TOS,f
         push ; leave stack the way we found it.
         movwf PCL ; OK, now jump
         ; return

--
David Cary

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspam_OUTspammitvma.mit.edu with SET PICList DIGEST in the body


<86256A39.00608833.00@Brunswickoutdoor.com>

See also: www.piclist.com/techref/io/lcd/pic.htm?key=lcd
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Using large table to store/display graphics LCD data

month overview.

new search...