Look-up-table in the Microchip PIC 16F84
Look-up-table in the Microchip PIC 16F84
(OP)
I would like to program some sort of a look up table for the 16F84 PIC microcontroller.
Does anybody has an example of how it’s done and if it can be done period.
It should work like this: …..
when count is 125 -> var…->var 2 is…etc.
when count is 126-> var1…->var2…..etc.
and this for 0 till 150.
Does anybody has an example of how it’s done and if it can be done period.
It should work like this: …..
when count is 125 -> var…->var 2 is…etc.
when count is 126-> var1…->var2…..etc.
and this for 0 till 150.





RE: Look-up-table in the Microchip PIC 16F84
Good Luck and keep us posted!
RE: Look-up-table in the Microchip PIC 16F84
. ; W reg will now have table value
.
.
.
TABLE ADDWF PC ;W = offset
RETLW k1 ; first table value
RETLW k2 ; second table value
.
.
RETLW kn ; last table value
RE: Look-up-table in the Microchip PIC 16F84
RE: Look-up-table in the Microchip PIC 16F84
There is a problem with call up tables on all pics and that is if the table is in a different bank to the program call, the program will crash
I have used the following code with several very large tables in the same program without problems and I now use it as a standard.
clrf pclath
movf number,w ; program will jump to number
addwf pcl,f
retlw 000 ; number = 0
retlw 100 ; number = 1
retlw 200 ; number = 2
etc etc
Good luck,
Regards,
G