CAI_Support
Senior Member
SET RAM20 0x80 # address first line, first byte
CALLSUB LCD_CMD
SET RAM20 0x30 # data byte ascii code for 0
CALLSUB LCD_DATA
This first line is to set the address where to write. 0x80 is a command to tell LCD that this is address. The address for the first row is 0, for second row is 0x40, then position in each row is from 0 to F. Say you want to write to the 2nd row of last byte, you can use address 0x80 OR 0x40 OR 0xF = 0xCF
If you position the cursor to a location already, you can write few bytes, the cursor will automatically advance to next byte location till the end of line. To clear the line, just write over 16 spaces ASCII code.
If you want to clear all display everywhere, send a command 0x01 using LCD_CMD will clear everything on LCD.
If you are using a 4x20 LCD display, then address maybe different(check with LCD vendor). Other commands are the same.
CALLSUB LCD_CMD
SET RAM20 0x30 # data byte ascii code for 0
CALLSUB LCD_DATA
This first line is to set the address where to write. 0x80 is a command to tell LCD that this is address. The address for the first row is 0, for second row is 0x40, then position in each row is from 0 to F. Say you want to write to the 2nd row of last byte, you can use address 0x80 OR 0x40 OR 0xF = 0xCF
If you position the cursor to a location already, you can write few bytes, the cursor will automatically advance to next byte location till the end of line. To clear the line, just write over 16 spaces ASCII code.
If you want to clear all display everywhere, send a command 0x01 using LCD_CMD will clear everything on LCD.
If you are using a 4x20 LCD display, then address maybe different(check with LCD vendor). Other commands are the same.