Exp 10 LC
Exp 10 LC
AIM :
To Interface of 16*2 LCD to LPC 2148 Using Embedded C in proteus.
Software used :
KEIL , U-Vision 4
Target Microcontroller :
ARM LPC2148
Algorithm :
Step 1 : Initialize Configuíation: Configure pin P0.28 foi ADC by setting PINSEL1
to 0x01000000.
Step 2 : Configuíe ADC with ADOCR set to 0x00200402 foí 10-bit mode and
channel AD0.1.
Step 3 : Continuous ADC Conveísion Loop:Entei an infinite loop.
Step 4 : Staít ADC ConveísionSet the stait bit in ADOCR (bit 24) to initiate ADC
conveísion.
Step 5 : Wait foi ADC Conveísion: Wait until bit 31 (done bit) in AD0DR1 is set.
Step 6 : Read and Piocess ADC Result: Retíieve ADC iesult fíom AD0DR1.
Step 7 : Right-shift by 6 bits and mask to keep the lowei 10 bits.
Step 8 : Repeat:Go back to step 3 foi continuous ADC Conveísions.
Program :
#include <Ipc213x.h>
void delay(void);
void cmd_wr(unsigned int);
void data_wr(unsigned int);
void lcd_init(void);
void delay()
{
int i, j
for(i=0; i < 100; i++)
for(j=0; j <600; j++);
void cmd_wr(unsigned int a)
{
IOCLR0 = 1 << 4;
JOCLR0=1<<5
IOPINO = (IOPINO &-(0xFF << 8)) | ((a & 0xFF) << 8);
IOSETO = 1 <<6; delay(), IOCLR01<<6: delay();
void data_wr(unsigned int a)
{ IOSETO = 1 << 4; IOCLRO1<<5: IOPINO = (IOPINO &~(0xFF << 8)) | ((a & 0xFF)
<< 8); IOSETO = 1 <<6; delay(); IOCLR0=1<<6 delay(); }
void lcd_init()
{
cmd_wr(0X38);
cmd_wr(0X06);
cmd_wr(0X0E); cmd_wr(0X01); cmd_wr(0X80); }
int main()
{
unsigned char str1[20] = "Deepak"; unsigned char j = 0;
PINSELO 0x00;
IODIRO=0xFFFFFFFF lcd_init();
while (str1[j] != 10') {
data_wr(str1[j]).
delay(); j++;
}
while (1);
}
Simulation Output :
Pre Lab-Questions:
1. What are the two LCD Configurations Available?
2. Draw the LCD Pinouts.