piclist 2000\05\22\142156a >
Thread: AN556 and long look-up tables
www.piclist.com/techref/mems.htm?key=table
picon face BY : rleggittTakeThisOuT@KILLspamconcentric.net



Hi David, something like this should work for arbitrary table of any
length located anywhere in the program space. -- Rich

               ...
               movlw high string       ; point to a string
               movwf look_hi           ; in reality, a macro...
               movlw low string
               movwf look_lo
               call process            ; go process it
               ...

; subroutine to process string at look_hi/look_lo
process         call lookup             ; get a byte (this is the magic)

               ; here, do something with byte in W
               ; also, return if end of string
               ; otherwise...

               goto process            ; do it again

; Jump to address in look_hi/look_lo, which presumably is an RETLW.
; Note pointer post increment.
; Equivalent to: W=*look_ptr++
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


On Sun, 21 May 2000, David Thompson wrote:

> Hi guys,
>
> Firstly, don't scream.. I HAVE read the datasheets!. My table reading
> subroutine is based on the final example in AN556 "Implementing a Table
> Read" and can be used across page boundaries and be located anywhere in
> memory... BUT!... will not work if the table itself is longer than 256
> bytes. This is because the table element offset is passed in w (8 bits) and
> then used in the calculation for the program counter. Trying to access
> elements that start beyond an offset of 256 bytes won't work.


seeking: microchip ios temperature
<Pine.LNX.4.21.0005221005110.10089-100000@lecolo.com>

In reply to: <000001bfc267$85bf73c0$b4aefea9@ranma>
See also: www.piclist.com/techref/mems.htm?key=table
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) AN556 and long look-up tables

month overview.

new search...