piclist 2001\04\25\192318a >
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)



You're right, Myke. The ``Table'' code I posted still wasn't quite right. Thanks
for fixing it.

---
myke predko <spam_OUTmykespamspamPASSPORT.CA> on 2001-04-25 04:00:20 PM wrote:
I *think* the most efficient way of implementing this function would be:

Table:
;  PCLATH = HIGH(TStart + Offset)
    movlw High(TStart)
    addwf OffsetH,W
    movwf PCLATH
;  w = LOW(TStart + Offset)
    movlw Low(TStart)
    addwf OffsetL,W
;  if ((LOW(TStart) + LOW(Offset)) > 255) then PCLATH = PCLATH + 1
    btfsc STATUS,C
    incf PCLATH,F
;  PCL = w: PC = PCLATH/PCL
    movwf PCL

This is the code that I use for implementing large tables.

myke
---

Good job optimizing. I don't see any way to make this function ``Table'', in
isolation, faster or smaller. Mind if this gets stuck on http://piclist.com as
public domain ?

However, I don't plan on using it. All my code uses something similar to
``lookup'':

; Jump to address in look_hi/look_lo, which presumably is an RETLW.
; Note pointer post increment.
; Equivalent to: W=*look_ptr++
; Handles tables of any size located anywhere in program FLASH.
; (256 byte tables don't work if you merely do ``addwf PCL,f'').
; [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.
; ]
; 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

which has the benefit of only requiring 1 subroutine for all the various tables
I use (rather than a separate copy for each table, like `Table' does). The code
that *calls* ``lookup'' needs to set up the loop with a couple more instructions
than if I had used ``table'', but overall it's a win ROM-space-wise and, I
think, time-wise.

I've got another version working that, rather than look_hi:look_lo, uses
whatever register pair FSR points toward. It's a little slower than ``lookup''
or ``table'', but I think it might turn out to be a win (overall) space-wise.

--
David Cary

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


<86256A39.00804E48.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...