I'm going to be using a Hantronix LCD in a project and this requires sending each column of pixels one at a time. I was planning on using a lookup table to send each letter or word. However this is my first time using lookup tables so I'm hoping someone can provide a suggestion. This code is simplified and was designed to help me learn lookups. Basically this code should read the hex code for the letter 'H'. After loading each byte the code jumps to a section which will actually send it to the LCD and then continue the loop. Once it has read all the data it should loop back to 'Start' (at least in this test version)
My problem is figuring out when it has read all the data. I was think of using 0x99 but realized I can't because if I wanted to enable all the pixels in a single column that would be 0xFF which is the highest, and if I wanted a column with no pixels on I would need to send 0x00, so any number in between these two values is possible.
What is a good way so determine when I have read all the data in the 'H_CHAR' table (in this example)? The 0x99 is not part of the actual data being sent to the LCD screen. After reading the last 0xFE and jumping to 'Send', when it returns to the 'lpl' loop the code should somehow be able to figure out/know that all the data was read.
This table is only 5 bytes, but some may be more and some may be less so it would help to have a single way of detecting this. Any help would be greatly appreciated. The application note for the LCD I'll be using can be found here and on the last few pages it give a sample code, albeit the code is in 8051 assembly which I'm not familiar with.
Rich (BB code):
Start movwf tt,0
movlw low(H_CHAR)
addwf tt,0,0
movwf TBLPTRL,0
movlw high(H_CHAR)
movwf TBLPTRU,0
lpl tblrd *+
movlw .153
CPFSLT TABLAT
GOTO Start
GOTO Send
Send movf TABLAT,0,0
movwf PORTA
GOTO lpl
H_CHAR db 0x00,0xfe
db 0x10,0x10
db 0xfe,0x99
What is a good way so determine when I have read all the data in the 'H_CHAR' table (in this example)? The 0x99 is not part of the actual data being sent to the LCD screen. After reading the last 0xFE and jumping to 'Send', when it returns to the 'lpl' loop the code should somehow be able to figure out/know that all the data was read.
This table is only 5 bytes, but some may be more and some may be less so it would help to have a single way of detecting this. Any help would be greatly appreciated. The application note for the LCD I'll be using can be found here and on the last few pages it give a sample code, albeit the code is in 8051 assembly which I'm not familiar with.