Syntax:
Locate Line, ColumnCommand Availability:
Available on all microcontrollers.
Explanation:
The Locate command is used to move the cursor on the LCD to the given location.
Line is line number on the LCD display. A byte value from 0 to 255.
Column is column number on the LCD display. A byte value from 0 to 255.
Example :
'A Hello World program for GCBASIC.
'Uses Locate to show "World" on the second line
'General hardware configuration
#chip 16F877A, 20
'LCD connection settings
#define LCD_IO 8
#define LCD_WIDTH 20 ;specified lcd width for clarity only. 20 is the default width
#define LCD_DATA_PORT PORTC
#define LCD_RS PORTD.0
#define LCD_RW PORTD.1
#define LCD_ENABLE PORTD.2
'Main routine
Print "Hello"
Locate 1, 5 ' <<< the Locate instruction
Print "World"Key line: Locate 1, 5 — moves the cursor to line 1, column 5 before the next Print, so "World" appears on the second line rather than overwriting "Hello".
See Also:
- LCD Overview — LCD wiring and configuration background
- Print — displaying text at the located position, as used above
- CLS — clearing the whole display instead of moving the cursor
Supported in <LCD.H>

