Daniel Lee
/
TextLCD_FC113
Initial setup for FC-113 controller of TextLCD(1602A)
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 00004 // I2C Communication 00005 I2C i2c_lcd(A4,A5); // SDA, SCL - I2C3 00006 00007 // SPI Communication 00008 //SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK 00009 00010 //TextLCD lcd(p15, p16, p17, p18, p19, p20); // RS, E, D4-D7, LCDType=LCD16x2, BL=NC, E2=NC, LCDTCtrl=HD44780 00011 //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, 74595 expander, CS pin, LCD Type 00012 //TextLCD_I2C lcd(&i2c_lcd, 0x40, TextLCD::LCD16x2); // I2C bus, PCF8574 Slaveaddress, LCD Type 00013 TextLCD_I2C lcd(&i2c_lcd, 0x4E); // I2C bus, PCF8574(FC-113) Slaveaddress, LCD Type(1602A) 00014 00015 //TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type 00016 //TextLCD_SPI_N lcd(&spi_lcd, p8, p9); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032_3V3 00017 //TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C bus, Slaveaddress, LCD Type, BL=NC, LCDTCtrl=ST7032_3V3 00018 00019 int main() 00020 { 00021 #if 0 00022 pc.printf("LCD Test. Columns=%d, Rows=%d\n\r", lcd.columns(), lcd.rows()); 00023 00024 for (int row=0; row<lcd.rows(); row++) { 00025 int col=0; 00026 00027 pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row)); 00028 // lcd.putc('-'); 00029 lcd.putc('0' + row); 00030 00031 for (col=1; col<lcd.columns()-1; col++) { 00032 lcd.putc('*'); 00033 } 00034 00035 pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row)); 00036 lcd.putc('+'); 00037 00038 } 00039 00040 // Show cursor as blinking character 00041 lcd.setCursor(TextLCD::CurOff_BlkOn); 00042 00043 // Set and show user defined characters. A maximum of 8 UDCs are supported by the HD44780. 00044 // They are defined by a 5x7 bitpattern. 00045 lcd.setUDC(0, (char *) udc_0); // Show |> 00046 lcd.putc(0); 00047 lcd.setUDC(1, (char *) udc_1); // Show <| 00048 lcd.putc(1); 00049 #else 00050 lcd.cls (); 00051 lcd.setBacklight (TextLCD :: LightOn); 00052 lcd.printf ("LCD check - online compile"); 00053 lcd.setAddress (0, 1); 00054 lcd.printf ("Hello MBED\n"); 00055 #endif 00056 }
Generated on Sun Jul 17 2022 07:01:40 by 1.7.2