Hi
When you power-up the LCD, its cursor position is on line 1 position 1.
The LCD does that automatically. Also when you clear the LCD the
cursor will go back to line 1 position 1.
So if just after LCD power-up or after a LCD clear you write the PicBasic code ....
Lcdout "test"
... the word "test" will be displayed one line 1 and will use the first 4 locations on line 1.
* * *
To input instructions to the LCD module, such as clear screen, go to line 2, etc., you
must prefix the instruction with 254 (0xFE). The byte following prefix is seen and
treated as a instruction code. After the instruction code, the LCD automatically returns
to text mode. Every instruction code must be sent with its own 254 prefix (0xFE).
Cursor position on a four lines LCD:
To move the cursor to the beginning of the first line and display a text you will need
to send the prefix $FE, the instruction code $80 and the text to be displayed.
Example:
LCDOUT $FE,$80, "Hello on line 1"
To move the cursor to the beginning of the second line and display a text you will need
to send the prefix $FE, the instruction code $C0 and the text to be displayed.
Example:
LCDOUT $FE,$C0, "Hello on line 2"
To move the cursor to the beginning of the third line and display a text you will need
to send the prefix $FE, the instruction code $94 and the text to be displayed.
Example:
LCDOUT $FE,$94, "Hello on line 3"
To move the cursor to the beginning of the fourth line and display a text you will need
to send the prefix $FE, the instruction code $D4 and the text to be displayed.
Example:
LCDOUT $FE,$D4, "Hello on line 4"
* * *
In your program, just after LCD power-up or just after a display clear you send:
lcdout $FE, $00 + 0, "LINE 1"
With the above code you just send a NOP instruction ($0) to the LCD controller.
(NOP = Short for No OPeration). The LCD controller ignores your NOP instruction and
will stay on line 1 position 1 and the output text "LINE 1" will go
on line 1 position 1 because you don't have changed the LCD cursor position.
Try to write a text on line 2 and then, without clearing line 2, go to line 1 and write a text on line 1.
If you tray that you will understand the purpose of the PicBasic code
LCDOUT $FE,$80, "Hello on line 1".
Best regards,
Luciano
Bookmarks