Initial setup for FC-113 controller of TextLCD(1602A)
This example is a simple use case for the user of Text LCD with the FC-113 controller, based on Mbed OS 5.
Note that PCF8574T has Mbed base addresses 0x40 ~ 0x4E, while PCF8574AT has base addresses 0x70 ~ 0x7E.
I used 0x4E for Text LCD with the FC-113 controller.

If you need to fine-tune the Text LCD or using another type the TextLCD, please see here.
main.cpp
- Committer:
- Daniel_Lee
- Date:
- 2019-12-24
- Revision:
- 7:9fcc3c0acd50
- Parent:
- 2:b60cb847489c
File content as of revision 7:9fcc3c0acd50:
#include "mbed.h"
#include "TextLCD.h"
// I2C Communication
I2C i2c_lcd(A4,A5); // SDA, SCL - I2C3
// SPI Communication
//SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK
//TextLCD lcd(p15, p16, p17, p18, p19, p20); // RS, E, D4-D7, LCDType=LCD16x2, BL=NC, E2=NC, LCDTCtrl=HD44780
//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, 74595 expander, CS pin, LCD Type
//TextLCD_I2C lcd(&i2c_lcd, 0x40, TextLCD::LCD16x2); // I2C bus, PCF8574 Slaveaddress, LCD Type
TextLCD_I2C lcd(&i2c_lcd, 0x4E); // I2C bus, PCF8574(FC-113) Slaveaddress, LCD Type(1602A)
//TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type
//TextLCD_SPI_N lcd(&spi_lcd, p8, p9); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032_3V3
//TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C bus, Slaveaddress, LCD Type, BL=NC, LCDTCtrl=ST7032_3V3
int main()
{
#if 0
pc.printf("LCD Test. Columns=%d, Rows=%d\n\r", lcd.columns(), lcd.rows());
for (int row=0; row<lcd.rows(); row++) {
int col=0;
pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));
// lcd.putc('-');
lcd.putc('0' + row);
for (col=1; col<lcd.columns()-1; col++) {
lcd.putc('*');
}
pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));
lcd.putc('+');
}
// Show cursor as blinking character
lcd.setCursor(TextLCD::CurOff_BlkOn);
// Set and show user defined characters. A maximum of 8 UDCs are supported by the HD44780.
// They are defined by a 5x7 bitpattern.
lcd.setUDC(0, (char *) udc_0); // Show |>
lcd.putc(0);
lcd.setUDC(1, (char *) udc_1); // Show <|
lcd.putc(1);
#else
lcd.cls ();
lcd.setBacklight (TextLCD :: LightOn);
lcd.printf ("LCD check - online compile");
lcd.setAddress (0, 1);
lcd.printf ("Hello MBED\n");
#endif
}
Daniel Lee