LAB. 3: Liquid Crystal Display (LCD) and Timer
LAB. 3: Liquid Crystal Display (LCD) and Timer
Objectives
Learn how to interface an LCD to a microcontroller
Learn how to read/calibrate data input from an analogue sensor
Gain skills in using delay loops to measure time in embedded applications.
a) Write a software program in a language of your choice (MikroC, Assembly, CCS etc…)
that controls and displays a text message on an LCD screen at the press of a switch. The
text should be the of each member of your goup; Name on line 1 and Matriculation
number on line 2. Display this information for all group members at regular intervals of
1 second.
b) Modify your program in a) to display on the LCD a number read from the analogue input
pin (ADC) of your microcontroller. The number read should be the voltage of a 9V battery
source as shown in figure 5.
-
Choose appropriate values for the resistors R4 and R5 to conveniently measure the
voltage of the 9V battery without any possibility of destroying the microcontroller
- Your program should do a real time voltage measurement of the battery source BAT1.
The potentiometer RV2 is used to vary the battery voltage that is fed into the
microcontroller for measurement
c) Simulate the result on Proteus ISIS
d) Build the circuit on a project board and verify your results
LCD1
LM044L
RV1(2)
RV1
50%
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1k
1
2
3
4
5
6
7
8
9
10
11
12
13
14
C1
22p U1
X1
CRYSTAL 13 33
C2 OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1
35
RB2
2 36
RA0/AN0 RB3/PGM
22p 3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
RV2 RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
D4 RC0/T1OSO/T1CKI
15
R4 1N4733A 8
RE0/AN5/RD RC1/T1OSI/CCP2
16
BAT1 9 17
51%
RE1/AN6/WR RC2/CCP1
9V 10 18
RE2/AN7/CS RC3/SCK/SCL
R1(1) 23
R1 1
RC4/SDI/SDA
24
+88.8 MCLR/Vpp/THV RC5/SDO
5K Volts R5 100k RC6/TX/CK
25
26
RC7/RX/DT
19
RD0/PSP0
20
RD1/PSP1
21
RD2/PSP2
22
RD3/PSP3
27
RD4/PSP4
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7
PIC16F877A