1-4 Bit LCD Interfacing With Arm7 Primer
1-4 Bit LCD Interfacing With Arm7 Primer
RS P0.16
CONTROL
RW P0.17
LED+
R/W
LED-
GND
VCC
VEE
D4
D6
D5
D7
RS
E P0.18
D0-D3 NC
DATA LINES
D4 P0.19
D5 P0.20
D6 P0.21
D7 P0.22
+5V
SW28
OFF 1 8 ON
Make switch SW28 to ‘LCD’ 2 7
7SEG
LCD
3 6 SM/RL
label marking position 4 5 GLCD
PWR ON/OFF
2
63
51
43
23 JP12
7
U16
1
VDD1
VDD2
VDD3
VDDA
VREF
2 1
6 3 2 17
18 VSS1 46 RS 4 3 17
25 VSS2 P0.16 47 RW 5 4
42 VSS3 P0.17 53 EN 6 5 18
50 VSS4 P0.18 7 6 18
59 VSS5 8 7
VSSA 9 8 19
LPC2148 10 9 19
54 D4 11 10
P0.19 55 D5 12 1120
P0.20 1 D6 13 12 20
P0.21 2 D7 14 13
P0.22 15 14
16 15
16
XTAL2
XTAL1
2X16 LCD
61
62
12MHz
22pf 22pf
Source Code
#include <lpc214x.h>
#include <stdio.h>
#define RS 0x10000
#define RW 0x20000
#define EN 0x40000
void main()
{
PINSEL1 = 0;
IODIR0 = 0xFF << 16;
lcd_initialize();
lcd_display();
while(1);
}
for(i=0;i<n;i++)
for(j=0;j<12000;j++);
}
void lcd_initialize(void)
{
int i;
for(i=0;i<4;i++)
{
IOCLR0 = 0xF << 19; //IOCLR 0/1
lcd_cmd(cmd[i]);
delay(15);
}
}
while(msg1[i]!='\0')
{
delay(5);
lcd_data(msg1[i]);
i++;
}
delay(15);
}
if(c & 0x80) IOSET0 = 1 << 22; else IOCLR0 = 1 << 22;
if(c & 0x40) IOSET0 = 1 << 21; else IOCLR0 = 1 << 21;
if(c & 0x20) IOSET0 = 1 << 20; else IOCLR0 = 1 << 20;
if(c & 0x10) IOSET0 = 1 << 19; else IOCLR0 = 1 << 19;
IOSET0 = EN;
delay(8);
IOCLR0 = EN;
if(c & 0x08) IOSET0 = 1 << 22; else IOCLR0 = 1 << 22;
if(c & 0x04) IOSET0 = 1 << 21; else IOCLR0 = 1 << 21;
if(c & 0x02) IOSET0 = 1 << 20; else IOCLR0 = 1 << 20;
if(c & 0x01) IOSET0 = 1 << 19; else IOCLR0 = 1 << 19;
IOSET0 = EN;
delay(8);
IOCLR0 = EN;
}
General Information