EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: Lesterwyatt on January 01, 2015, 09:07:07 pm
-
Hello.
I have interfaced a pic18f and RTC to a nokia to a 5110 graphical lcd.
However i am having a few problems, i am using a lookup table to display the time using RETLW. (see below)
My problem is when the table is called from the BCD value, its only calling and displaying 1 byte rather than 6 byts i.e.
BCD value (00000001) 1.
calls table and dissplays 0X00
rather than 0x00 0x00 0x42 0x7f 0x40 0x00
anybody know what im missing?
Part of my code I am using for the Nokia 5110 lcd.
6 byte value to display the number '1' on nokia lcd
addwf PCL,f
retlw 0x00 //6 byte character map
retlw 0x00
retlw 0x42
retlw 0x7F
retlw 0x40
retlw 0x00
Thanks Lester
-
A lookup table like you implemented will return a single value based on the passed in value of W. For your table, if you call the lookup table with W set to 2, it will return 0x42 (in W). If W is set to 3, then it will return 0x7F. You won't get 6 values unless you call the table 6 times.
Does that help?
-
Yes I understand, hmm wonder if I could put a value of 6 in a tmp register and have a decfsz and on every pass add 1 to bcd value? this way it would decrement down the retlw table based on the first received byte?
i.e. received byte is 00000001. and adding 1 would be 00000010....
lester