腳位編號 | 名稱 | 說明 |
1 | Vss | 接地(0V) |
2 | Vdd | 電源(+5V) |
3 | Vo 或稱Vee | 對比(0-5V), 可接一顆1k 電阻,或利可變電阻調(diào)整適當(dāng)?shù)膶Ρ?/div> |
4 | RS | Register Select: 1: D0 – D7當(dāng)作資料解釋 0: D0 – D7當(dāng)作指令解釋 |
5 | R/W | Read/Write mode: 1:從LCD讀取資料 0:寫資料到LCD 因?yàn)楹苌購腖CD這端讀取資料,可將此腳位接地以節(jié)省I/O腳位。 |
6 | E | Enable |
7 | D0 | Bit 0 LSB |
8 | D1 | Bit 1 |
9 | D2 | Bit 2 |
10 | D3 | Bit 3 |
11 | D4 | Bit 4 |
12 | D5 | Bit 5 |
13 | D6 | Bit 6 |
14 | D7 | Bit 7 MSB |
15 | A+ | 背光(串接330R 電阻到電源) |
16 | K- | 背光(GND) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* Lab9 - 在2x16 LCD 上顯示"Hello World" 訊息 The circuit: * LCD RS pin to digital pin 12 * LCD Enable pin to digital pin 11 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * 10K Potentiometer: * ends to +5V and ground * wiper to LCD VO pin (pin 3) This example code is in the public domain. http://www.arduino.cc/en/Tutorial/LiquidCrystal */ // 引用LiquidCrystal Library #include <LiquidCrystal.h> // 建立LiquidCrystal 的變數(shù)lcd // LCD 接腳: rs, enable, d4, d5, d6, d7 // 對應(yīng)到Arduino 接腳: 12, 11, 5, 4, 3, 2 LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // 設(shè)定LCD 的行列數(shù)目(2 x 16) lcd.begin(16, 2); // 列印"Hello World" 訊息到LCD 上 lcd.print("hello, world!"); } void loop() { // 將游標(biāo)設(shè)到column 0, line 1 // (注意: line 1 是第二行(row),因?yàn)槭菑? 開始數(shù)起): lcd.setCursor(0, 1); // 列印Arduino 重開之后經(jīng)過的秒數(shù) lcd.print(millis()/1000); } |
歡迎光臨 (http://www.torrancerestoration.com/bbs/) | Powered by Discuz! X3.1 |