Serial LCD by Scott Edwards and Arduino: Rozdiel medzi revíziami
Z SensorWiki
(2 medziľahlé úpravy od rovnakého používateľa nie sú zobrazené.) | |||
Riadok 1: | Riadok 1: | ||
+ | How to connect Scott Edwards's LCD Serial Backpack equipped LCD display to an Arduino compatible boards. | ||
+ | |||
+ | |||
+ | |||
* [http://www.seetron.com/bpk000_1.htm LCD Serial Backpack] - product page | * [http://www.seetron.com/bpk000_1.htm LCD Serial Backpack] - product page | ||
* [http://www.seetron.com/pdf/bpk_mnl.pdf LCD Serial Backpack manual] | * [http://www.seetron.com/pdf/bpk_mnl.pdf LCD Serial Backpack manual] | ||
Riadok 6: | Riadok 10: | ||
This serial LCD is not a direct connectible to the Arduino boards as it uses inverted signals (which is OK if You use e.g. RS-232 or Basic Stamp). | This serial LCD is not a direct connectible to the Arduino boards as it uses inverted signals (which is OK if You use e.g. RS-232 or Basic Stamp). | ||
− | Solutions: | + | '''Solutions:''' |
a) use an hardware inverter. You can either use one section of an inverter IC, like a 7404, or a simple [http://www.seetron.com/images/invert.gif one-transistor inverter]. | a) use an hardware inverter. You can either use one section of an inverter IC, like a 7404, or a simple [http://www.seetron.com/images/invert.gif one-transistor inverter]. | ||
− | b) use an improved [http://arduiniana.org/libraries/newsoftserial/ NewSoftSerial library]. It enables to invert signals. Following program works like a charm. | + | b) use an improved [http://arduiniana.org/libraries/newsoftserial/ NewSoftSerial library]. It enables to invert signals. Following diagram and program works like a charm. |
+ | |||
+ | [[Obrázok:ArduinoAndSESerialLCD.png|center]] | ||
<source lang="c"> | <source lang="c"> | ||
#include <NewSoftSerial.h> | #include <NewSoftSerial.h> | ||
− | #define rxPin 2 | + | #define rxPin 2 // unused, but necessary to create 'lcd' object |
#define txPin 3 | #define txPin 3 | ||
Riadok 28: | Riadok 34: | ||
lcd.begin(9600); | lcd.begin(9600); | ||
− | delay(100); | + | delay(100); // necessary to wait after powering up |
lcd.print(254,BYTE); // 254 is a command prefix | lcd.print(254,BYTE); // 254 is a command prefix |
Aktuálna revízia z 07:37, 20. október 2010
How to connect Scott Edwards's LCD Serial Backpack equipped LCD display to an Arduino compatible boards.
- LCD Serial Backpack - product page
- LCD Serial Backpack manual
- LCD Serial Backpack FAQ
- LCD Serial Backpack App Notes and Tips
This serial LCD is not a direct connectible to the Arduino boards as it uses inverted signals (which is OK if You use e.g. RS-232 or Basic Stamp).
Solutions:
a) use an hardware inverter. You can either use one section of an inverter IC, like a 7404, or a simple one-transistor inverter.
b) use an improved NewSoftSerial library. It enables to invert signals. Following diagram and program works like a charm.
#include <NewSoftSerial.h>
#define rxPin 2 // unused, but necessary to create 'lcd' object
#define txPin 3
#define INVERTED true // this is impossible with standard Software Serial library
NewSoftSerial lcd(rxPin, txPin,INVERTED); // set up a new inverted serial port on pins 2 and 3
void setup() {
pinMode(rxPin, INPUT); // define pin modes for tx, rx:
pinMode(txPin, OUTPUT);
lcd.begin(9600);
delay(100); // necessary to wait after powering up
lcd.print(254,BYTE); // 254 is a command prefix
lcd.print(1,BYTE); // 1 is a Display Clear command
delay(10); // this command takes long time
lcd.print(254,BYTE); // for unknown reasons this is
lcd.print(1,BYTE); // necessary to repeat 2x
delay(10);
lcd.print(254,BYTE); // 254 is a command prefix
lcd.print(2 ,BYTE); // 2 is a Home command
delay(10);
lcd.print("Hello, World!");
}
void loop() {
lcd.print(254,BYTE);
lcd.print(192,BYTE); // set the cursor to column 0, line 1
lcd.print(millis()/1000); // print the number of seconds since reset:
}