Using large table to store/display graphics LCD data
David Cary email (remove spam text)
Dear Tim Thompson,
Tim Thompson <IRULE.NET> on 2001-04-25 03:31:07 AM begged for help: irule
> 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.
> Table movlw High(TStart)
> movlw Low(TStart)
> addwf OffsetL,W
> btfsc STATUS,C
> incf PCLATH,F
> movf OffsetL,W
> DoTable addwf PCL, F
> <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.
; OK to put more code here
; 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
; [FIXME: might be improved by
; tells how to read and write all 14 bits of a program memory location.
movf look_hi,w ; set PCLATH
movf look_lo,w ; and get PCL
incf look_lo,f ; but post inc
movwf PCL ; ok, now jump
; 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
pop ; leave 8 bit ``count'' alone, increment the 16 bit value under
peekw ; set PCLATH with MSB
peekw ; get PCL
incf TOS,f ; post increment
push ; return to MSB without affecting Z
push ; leave stack the way we found it.
movwf PCL ; OK, now jump
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email mitvma.mit.edu with SET PICList DIGEST in the body listserv
See also: www.piclist.com/techref/io/lcd/pic.htm?key=lcd
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the