Uploaded by User109873

process 5

advertisement
Process instrument
LCD display
Petrochemical Engineering
Duhok Polytechnic University
Name: Safwan Kamal Askender
Stage: 3
Date: 16/4/2021
1
Objective:
to know how to using LCD display
Introduction:
In this Arduino LCD Experiment, we will learn how to connect an
LCD (Liquid Crystal Display) to the Arduino board. LCDs like these
are very popular and broadly used in electronics projects as they
are good for displaying information like sensors data from your
project, and also, they are very cheap.
You can select the location of printing by this instruction
lcd.setCursor(0,0); this will print on line (0,0).
If you want to print on the second row, you should write this
instruction lcd.setCursor(0,1);
You can easily interface a liquid crystal display (LCD) with
an Arduino to provide a user interface. ... Liquid crystal
displays (LCDs) are a commonly used to display data in devices
such as calculators, microwave ovens, and many other electronic
devices.
Procedure:
2
12-
3-
Connect the LCD display to the Arduino as shown above.
This LCD has 4 pins only. Connect VCC and GND to the 5V
and GND of the Arduino. Also connect the SCL and SDA pins
to the A4 and A5 analog pins, respectively.
LCD Display Program This program will show you how to
print on the LCD display #include // library for LCD #include
// library for LCD LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6,
7, 3, POSITIVE); \\ pins declaration of the LCD .
Discussion:
Write an Arduino program to show the temperature and
humidity on the LCD using DHT 11 sensor show the temperature
on the first row of the LCD and the Humidity on the second row
of the LCD
#include
#include "DHT.h"
#define DHTPIN 11
LiquidCrystal lcd(13, 12, 6, 5, 3, 2);
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
lcd.begin(16, 2);
dht.begin(9600);
lcd.print("Temp: Humidity:");
}
void loop() {
delay(500);
lcd.setCursor(0, 1);
float h = dht.readHumidity();
3
float t = dht.readTemperature(true);
}
lcd.print(t);
lcd.setCursor(7,1);
lcd.print(h);
How do I use Arduino LCD screen?
To wire your LCD screen to your board, connect the following pins:
1.
2.
3.
4.
5.
6.
7.
8.
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.
LCD R/W pin to GND.
LCD VSS pin to GND.
The Standard Pin Out When Programming Character LCD
displays
1.
2.
3.
4.
5.
GND.
VDD.
V0.
RS.
Register Select has two positions: 1 (on or high) or 0 (off or low). When RS is low (0), the
data is to be treated as an instruction such as 'move the position of the cursor' or 'clear
the screen'. ...
6. RW.
7. EN.
8. DATA BITS.
4
Download