Searching \ for 'Lookup tables' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/mems.htm?key=table
Search entire site for: 'Lookup tables'.

Truncated match.
PICList Thread
'Lookup tables'
2000\01\24@165024 by Kev Howard

picon face
Hello all!

Can anyone point me in the right direction for info on lookup tables,
Including how to implement and use.

For example I want to use 30 or 40 different time delays, I assume using a
lookup table would save me writing 30 or 40 routines?

As you can guess, still new to the world of PICS   but learning !

Thanks in advance

Kev

2000\01\25@024541 by Robert Rolf

picon face
So this is too easy for anyone to bother answering?

Kev Howard wrote:
> Can anyone point me in the right direction for info on lookup tables,
> Including how to implement and use.
>
> For example I want to use 30 or 40 different time delays, I assume using a
> lookup table would save me writing 30 or 40 routines?
>
> As you can guess, still new to the world of PICS   but learning !

You basically call a subroutine which uses the 'retlw' instruction
to put your values into W.

table:  addwf   PCL
       retlw value1    ;index 0
       retlw value2    ;index 1
       ...


Gotchas: Make sure that W can't have a value outside table bounds.
(use 'andlw BITMASK' if your table is a binary length (32), or a compare
& carry test if not).
Table must be entirely contained within a page (xx00-xxFF) unless
you go through some code gyrations to split it.

Go to microchips web site
http://www.microchip.com
and READ THE APP NOTES.
There are hundreds of good code examples to be found there.

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...