Inhaltsverzeichnis
1. Einleitung
Das LCD-Bildschirm-Adapterplatinenmodul LCD1602/2004 nutzt den MCP2308-Chip und erweitert 8 allgemeine bidirektionale E/A-Ports über die IIC-Schnittstelle. Es kann IO-Ports für Mikrocontroller mit weniger IO-Ports erweitern und auch vereinfachte Verkabelungslösungen für LCD1602- und LCD2004-LCD-Bildschirme bereitstellen. Durch die Verwendung der IIC-Kommunikation können mehrere LCD1602- und LCD2004-LCD-Bildschirme am IIC-Bus montiert oder allgemeinere IO-Pins erweitert werden, wodurch die IO-Ports des Hauptsteuerungsmikrocontrollers erheblich reduziert und die Erweiterung erleichtert werden.
2. Internes Logikdiagramm
3. Pin-Beschreibung
PH2.0 4P-Buchsenschnittstelle
V | Pluspol der Stromversorgung |
---|---|
G | Minuspol der Stromversorgung |
C | IIC-Schnittstellen-Taktsignalleitung SCL |
D | IIC-Schnittstelle Datensignalleitung SDA |
4. Schematische Darstellung
5. Geräteadresse
6. Anwendung
Versuchsvorbereitung
LCD1602/2004 LCD-Bildschirm-Adapterplatinenmodul | 1 |
---|---|
Originales Original Arduino uno r3 Entwicklungsboard | 1 |
1602 LCD-Bildschirm 5,0 V gelb-grüner Bildschirm | 1 |
USB2.0-Druckerdatenkabel, Hochgeschwindigkeits-Adapterkabel mit quadratischem Anschluss, A-Stecker auf B-Stecker | 1 Artikel |
Dupont-Linie | Leicht |
Verdrahtung
Arduino | LCD1602/2004 LCD-Bildschirm-Adapterplatinenmodul |
---|---|
5V | V |
GND | G |
SCL | C |
SDA | D |
Programm-Download
/*
Demonstration sketch for Adafruit i2c/SPI LCD backpack
using MCP23008 I2C expander
( http://www.ladyada.net/products/i2cspilcdbackpack/index.html )
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit for Duemilanove
* 5V to Arduino 5V pin
* GND to Arduino GND pin
* CLK to Analog #5
* DAT to Analog #4
For other boards, use the following chart (CLK=SCL,DAT=SDA)
Board I2C / TWI pins
--------- --------------------------
Uno, Yun A4 (SDA), A5 (SCL)
Mega2560 20 (SDA), 21 (SCL)
Leonardo 2 (SDA), 3 (SCL)
Due 20 (SDA), 21 (SCL)
*/
// include the library code:
#include <Wire.h>
#include "LiquidTWI2.h"
// Connect via i2c, address 0x20 (A0-A2 not jumpered)
LiquidTWI2 lcd(0x20);
void setup() {
// set the LCD type
lcd.setMCPType(LTI_TYPE_MCP23008);
// lcd.setMCPType(LTI_TYPE_MCP23017);
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
lcd.setBacklight(HIGH);
delay(500);
lcd.setBacklight(LOW);
delay(500);
}
Experimentelle Phänomene