Peter Clark
Member
All the documentation that I have found details how to place the cursor at the start of the first and second lines. Can anyone tell me the second byte of the move cursor command to access lines 3 and 4?
Peter, when you say "the second byte" I assume that you are using one of the Rev-Ed LCD serail displays, like the AXE133?an anyone tell me the second byte of the move cursor command to access lines 3 and 4?
SYMBOL LCD_rows = 4
SYMBOL LCD_columns = 20
SYMBOL LCD_SETDDRAMADDR = 0x80
SYMBOL cmd_byte = B2
SYMBOL row = B3
SYMBOL column = B4
; For out-of-range row wrap it around to the range 0 to _LCD_rows-1
row = row // LCD_rows
; Calculate the column 0 position in this row
IF row = 0 THEN
cmd_byte = 0x00
ELSEIF row = 1 THEN
cmd_byte = 0x40
ELSEIF row = 2 THEN
cmd_byte = 0x00 + LCD_columns
ELSEIF row = 3 THEN
cmd_byte = 0x40 + LCD_columns
ENDIF
cmd_byte = cmd_byte + column | LCD_SETDDRAMADDR
Thanks for the reply. Yes, line 3 follows on from line 1 and line 4 from line2 as you suspected. Working well now.Frequently, the third line on a 4-line OLED is in an extended position relative to the first line, so try writing to position 21, 22, etc. on the first line until you start seeing characters. Similarly, the 4th line may be offset from the 2nd by the same amount.
Thanks for your quick reply. On to my next problem now.It it's AXE133 or similar, then
254,128 is line 1 start
254,192 is line 2 start
254,148 is line 3 start
254,212 is line 4 start
Yes, I am using the AXE133 addon to a standard 20 x 4 Winstar display.Peter, when you say "the second byte" I assume that you are using one of the Rev-Ed LCD serail displays, like the AXE133?
Pls let us know if I'm wrong.
I have some code converted from the Arduino liquidcrystal LCD library that works for me on 2x16 and 4x20 LCDs but it's not in a form that I can post and you can use as-is so I've modified it to something you can try in your program.
- The constants LCD_rows and LCD_columns are the size of the LCD display you are using.
- The variables row and column are the parameters that you set to the row and column you want to move the cursor to. The rows and columns are both numbered from 0 in this code. i.e. the first row has the value 0 , the second row the value 1, the first column the value 0 the second column the value 1, etc
- The variable cmd_byte is the second byte to use with the AXE133 control command 254. e.g. serout B.7,N2400,(254, cmd_byte)
Code:SYMBOL LCD_rows = 4 SYMBOL LCD_columns = 20 SYMBOL LCD_SETDDRAMADDR = 0x80 SYMBOL cmd_byte = B2 SYMBOL row = B3 SYMBOL column = B4 ; For out-of-range row wrap it around to the range 0 to _LCD_rows-1 row = row // LCD_rows ; Calculate the column 0 position in this row IF row = 0 THEN cmd_byte = 0x00 ELSEIF row = 1 THEN cmd_byte = 0x40 ELSEIF row = 2 THEN cmd_byte = 0x00 + LCD_columns ELSEIF row = 3 THEN cmd_byte = 0x40 + LCD_columns ENDIF cmd_byte = cmd_byte + column | LCD_SETDDRAMADDR