Lcd display – Echelon Mini FX User Manual
Page 92

Mini FX User's Guide
79
LCD Display
The LCD display included with the FT 5000 EVB may be used to display status or other
application data in an easy-to-read fashion. In addition, it can be used to debug and
diagnose applications.
The display is connected to the Smart Transceiver through an I2C interface to the I/O 0
and I/O 1 pins. The functions shown in the following example use the i2c input/output
model. For applications built in debug mode, the LcdDisplayString() function
automatically forwards the data to the serial output. The Debug mode is supported in
the NodeBuilder tool, but it is not available with Mini kit.
The Mini Gizmo I/O board does not include an LCD display. When used with the Mini
Gizmo I/O board, the LcdDisplayString() function always uses a remote display and
forwards the data to the serial output.
#ifndef USE_MINIGIZMO
IO_0 i2c __slow ioIIC;
# define LCD_COMMAND_PREFIX 0xFEu
# define LCD_COMMAND_ON 0x41u
# define LCD_COMMAND_SETCURSOR 0x45u
# define LCD_COMMAND_CLEARSCREEN 0x51u
# define LCD_COMMAND_BRIGHTNESS 0x53u
// The datasheet advertizes the address as 0x50, but in reality,
// the 7-bit right-justified address is 0x28 (0x50 >> 1):
# define I2C_ADDRESS_LCD (0x50u >> 1)
//
// The SendLcdCommand() function is used within this driver kit.
// The function sends a one- or two-byte command to the display.
//
void SendLcdCommand(unsigned command, unsigned parameter, unsigned size)
{
unsigned data[3];
data[0] = LCD_COMMAND_PREFIX;
data[1] = command;
data[2] = parameter;
(void)io_out(ioIIC, data, I2C_ADDRESS_LCD, 1+size);
}
#endif // !mini gizmo
//
// The InitializeLCD function enables and clears the display. Call this
// function from InitializeIO() (which in turn is called from when(reset).
//
static void InitializeLCD(void)
{
#ifndef USE_MINIGIZMO
SendLcdCommand(LCD_COMMAND_ON, 0, 1);
SendLcdCommand(LCD_COMMAND_BRIGHTNESS, 1, 2);
SendLcdCommand(LCD_COMMAND_CLEARSCREEN, 0, 1);
#else
// use mini gizmo:
SerialOutput("\r\n---Reset");
#endif // mini gizmo
}
void LcdDisplayString(unsigned row, unsigned column, const char* data)
{
#ifndef USE_MINIGIZMO