RP6 ROBOT SYSTEM - 4. RP6 CONTROL M256 WIFI Library
4.1.4. LC-Display
The LCD is ideal to display simple sensor values and status messages while the robot
is not connected to the PC. The output on the LCD works in a similar way as with a
serial interface – however there are a few peculiarities. Just look at the example pro-
grams and you will understand quite quickly how the LCD can be used.
void initLCD(void)
This function must always be called at the beginning of the program to initialize the
LCD. If you connect other peripherals to the I/O ports, you should remove these and
other LCD functions from the relevant programs.
void setLCDD(uint8_t lcdd)
Normally you don't need this function. We only mention it here to show how the dis-
play is controlled.
The LCD can be operated in 8-bit mode. 8 data lines and 3 control lines are used (En-
able (EN) and Register Select (RS), Read/Write (R/W), which means that all signals
are used, unlike on the RP6-M32 and RP6-M128! This is not so important for text dis-
plays but might well be for larger dot matrix displays for performance reasons). This
function sets also the Enable signal so that the LCD accepts the data.
void writeLCDCommand(uint8_t cmd)
This function calls setLCDD, but sets the RS line to low to send a command to the
LCD.
void clearLCD(void)
Sends a command to the LCD to erase the display
void clearPosLCD(uint8_t line, uint8_t pos, uint8_t length)
Erases a specific part of the display. The parameters are: Line, start position in the
line and length of the part to be erased.
Example:
clearPosLCD(0,10,5); // erases the last five characters
// in the first line of the display!
void setCursorPosLCD(uint8_t line, uint8_t pos)
Places the text cursor on a specific position on the display. The parameter line can be
0 for the top or 1 for the bottom line. The pos parameter must be between 0 and 15
for 2x16 LCDs.
void writeCharLCD(uint8_t ch)
Sends a single character to the LCD – this is identical to the writeChar function for the
serial interface. However please make sure beforehand that the cursor is at the right
position because otherwise you will not see the text!
Example:
setCursorPosLCD(1,5); // position cursor in the second line, character 5
writeCharLCD('R'); // “RP6” is displayed, starting at
writeCharLCD('P'); // the cursor position!
writeCharLCD('6');
- 30 -