Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of 2018_I2C_LCD_03 by
Revision 0:0c1de053c3b1, committed 2018-05-02
- Comitter:
- silviosz
- Date:
- Wed May 02 21:54:53 2018 +0000
- Commit message:
- LCD I2C NUCLEO
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed May 02 21:54:53 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Sz_Insper/code/TextLCD/#14d6edd19f7e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed May 02 21:54:53 2018 +0000
@@ -0,0 +1,89 @@
+// projeto: 2018_I2C_LCD_03
+// testado com PCF8574 em 2018-04-27 << Funcionando Ok
+// Hello World! for the TextLCD
+
+#include "mbed.h"
+#include "TextLCD.h"
+
+// Host PC Communication channels
+Serial pc(USBTX, USBRX); // tx, rx
+
+// I2C Communication
+I2C i2c_lcd(D14, D15); // SDA, SCL >>> NUCLEO: D14,D15
+
+// SPI Communication
+//SPI spi_lcd(D14, NC, D15); // MOSI, MISO, SCLK
+
+//4-bit bus
+//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD40x2); // RS, E, D4-D7
+//TextLCD lcd(p15, p16, p17, p18, p19, p20); // RS, E, D4-D7, LCDType=LCD16x2, BL=NC, E2=NC, LCDTCtrl=HD44780
+
+//I2C Portexpander PCF8574
+TextLCD_I2C lcd(&i2c_lcd, 0x7F, TextLCD::LCD16x2); // I2C bus, PCF8574 Slaveaddress, LCD Type Original = 0x42, Usando I2C scanner = 0x3F
+//TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 addr, LCD Type, Ctrl Type
+
+//I2C Portexpander MCP23008
+//TextLCD_I2C lcd(&i2c_lcd, MCP23008_SA0, TextLCD::LCD16x3G, TextLCD::ST7036_3V3); // I2C bus, MCP23008 Slaveaddress, LCD Type, LCDTCtrl=ST7036
+
+//SPI Portexpander SN74595
+//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD24x4D; TextLCD::KS0078); // SPI bus, CS pin, LCD Type
+//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x2); // SPI bus, CS pin, LCD Type
+//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, CS pin, LCD Type
+
+//Native I2C
+//TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C bus, Slaveaddress, LCD Type, BL=NC, LCDTCtrl=ST7032_3V3
+//TextLCD_I2C_N lcd(&i2c_lcd, PCF2116_SA0, TextLCD::LCD12x4D, NC, TextLCD::PCF2116_3V3); // I2C bus, Slaveaddress, LCD Type, BL=NC, LCDTCtrl=PCF2116_3V3
+//TextLCD_I2C_N lcd(&i2c_lcd, PCF2116_SA0, TextLCD::LCD24x2, NC, TextLCD::PCF2116_3V3); // I2C bus, Slaveaddress, LCD Type, BL=NC, LCDTCtrl=PCF2116_3V3
+//TextLCD_I2C_N lcd(&i2c_lcd, SSD1803_SA1, TextLCD::LCD20x4D, NC, TextLCD::SSD1803_3V3); // I2C bus, slaveaddress, LCDType=LCD16x2, BL=NC, LCDTCtrl=SSD1803A
+
+//Native SPI 4 wire, 8 bits
+//TextLCD_SPI_N lcd(&spi_lcd, p8, p9); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032_3V3
+
+//Native SPI 3 wire, 10bits
+//TextLCD_SPI_N_3_10 lcd(&spi_lcd, p8, TextLCD::LCD16x2, NC, TextLCD::WS0010); // SPI bus, CS, LCDType=LCD16x2, BL=NC, LCDTCtrl=WS0010
+//TextLCD_SPI_N lcd(&spi_lcd, p8, p9, TextLCD::LCD16x3G, NC, TextLCD::ST7036_3V3); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7036
+
+//Native SPI 3 wire, 24 bits, SSD1803A
+//TextLCD_SPI_N_3_24 lcd(&spi_lcd, p8, TextLCD::LCD20x4D, NC, TextLCD::SSD1803_3V3); // SPI bus, CS pin, LCDType=LCD20x4, BL=NC, LCDTCtrl=SSD1803A
+
+int main() {
+ 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);
+ lcd.setUDC(2, (char *) udc_2);
+ lcd.putc(2);
+ lcd.setUDC(3, (char *) udc_3);
+ lcd.putc(3);
+ lcd.setUDC(4, (char *) udc_4);
+ lcd.putc(4);
+ lcd.setUDC(5, (char *) udc_5);
+ lcd.putc(5);
+ lcd.setUDC(6, (char *) udc_6);
+ lcd.putc(6);
+ lcd.setUDC(7, (char *) udc_7);
+ lcd.putc(7);
+ //lcd.setBacklight(TextLCD::LightOn);
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed May 02 21:54:53 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file
