Escolar Documentos
Profissional Documentos
Cultura Documentos
Expt. No: 01
Date: 04/06/2013
18
29
30
31
D1
LED-BIRG
1
2
3
4
5
6
7
8
XTAL1
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
AT89C51
Dept. Of ECE
IIET
Program
#include<reg51.h>
#define INPUT P1
sbit out=P1^0;
unsigned char x;
void main()
{
INPUT=0x3e;
while(1)
{
x=INPUT;
x=x&0x3e;
if(x==0x3e)
out=1;
else
out=0;
}
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
IIET
Expt. No: 02
Date: 11/06/2013
U1
19
18
29
30
31
D1
LED-BIRG
1
2
3
4
5
6
7
8
XTAL1
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
AT89C51
Dept. Of ECE
IIET
Program
#include<reg51.h>
#define INPUT P1
sbit out=P1^0;
unsigned char x;
void main()
{
INPUT=0x3e;
while(1)
{
x=INPUT;
x=x&0x3e;
if(x==0x00)
out=1;
else
out=0;
}
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
IIET
Expt. No: 03
Date: 18/06/2013
MULTIPLEXER
Aim
Write program for a 4:1 multiplexer in C.
Softwares Used
1. Keil Vision 3
2. Proteus 8 Professional
Components Used
1. ATMEL 89C51 Microcontroller
2. LED
3. Switch
Circuit Diagram
U1
19
18
29
30
31
XTAL1
XTAL2
RST
PSEN
ALE
EA
D1
LED-GREEN
1
2
3
4
5
6
7
8
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
AT89C51
Dept. Of ECE
IIET
Program
#include<reg51.h>
#define select P2
sbit o=P1^0;
sbit a=P1^1;
sbit b=P1^2;
sbit c=P1^3;
sbit d=P1^4;
unsigned char x,i;
void main()
{
select=0xff;
while(1)
{
x=select;
x=x&0x03;
switch(x)
{
case 0x00:o=a;
break;
case 0x01:o=b;
break;
case 0x02:o=c;
break;
case 0x03:o=d;
break;
}
}
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
IIET
Expt. No: 04
Date: 25/06/2013
DECODER
Aim
Write program for a 3:8 decoder in C.
Softwares Used
1. Keil Vision 3
2. Proteus 8 Professional
Components Used
1. ATMEL 89C51 Microcontroller
2. LED
3. Switch
Circuit Diagram
U1
19
18
29
30
31
1
2
3
4
5
6
7
8
XTAL1
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
D1
21
22
23
24
25
26
27
28
D2
D3
10
11
12
13
14
15
16
17
D4
D6
AT89C51
D5
D7
D8
Dept. Of ECE
IIET
Program
#include<reg51.h>
#define input P1
#define output P2
unsigned char x;
void main()
{
input=0x0ff;
while(1)
{
x=input;
x=x&0x0e;
switch(x)
{
case 0x00:output=0x01;
break;
case 0x02:output=0x02;
break;
case 0x04:output=0x04;
break;
case 0x06:output=0x08;
break;
case 0x08:output=0x10;
break;
case 0x0a:output=0x20;
break;
case 0x0c:output=0x40;
break;
case 0x0e:output=0x80;
break;
}
}
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
IIET
Expt. No: 05
Date: 02/07/2013
U1
19
18
U2
7
1
2
6
4
5
3
A
B
C
D
BI/RBO
RBI
LT
74247
QA
QB
QC
QD
QE
QF
QG
13
12
11
10
9
15
14
29
30
31
1
2
3
4
5
6
7
8
XTAL1
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
AT89C51
Dept. Of ECE
IIET
Program
#include<reg51.h>
#define output P1
void delay(unsigned char);
unsigned char x,i;
void main()
{
x=0x00;
for(i=0;i<10;i++)
{
output=x;
delay(100);
x++;
}
}
void delay(unsigned char z)
{
unsigned int a,b;
for(a=0;a<z;a++)
for(b=0;b<2000;b++);
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
10
IIET
Expt. No: 06
Date: 09/07/2013
DAC INTERFACING
Aim
Write a program in C for DAC interfacing.
Softwares Used
1. Keil Vision 3
2. Proteus 8 Professional
Components Used
1.
2.
3.
4.
5.
Circuit Diagram
U1
29
30
31
1
2
3
4
5
6
7
8
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
+5V
R2
R5
5k
5k
5
6
7
8
9
10
11
12
A1
A2
A3
A4
A5
A6
A7
A8
U3
U2
18
XTAL1
VREF+
VREFIOUT
COMP
VEE
14
3
15
6
2
16
3
R3
1k
C5
4
1
5
19
741
0.1uF
DAC0808
AT89C51
C4
1uF
R4
5k
-12V
Dept. Of ECE
11
IIET
Program
#include<reg51.h>
#define output P2
void delay(unsigned char);
void main()
{
unsigned char SEQ[13]={128,192,238,255,238,192,128,64,17,0,17,64,128};
unsigned char x;
while(1)
{
for(x=0;x<13;x++)
{
output=SEQ[x];
delay(20);
}
}
}
void delay(unsigned char z)
{
unsigned int a;
for(a=0;a<z;a++);
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
12
IIET
Expt. No: 07
Date: 16/07/2013
LCD INTERFACING
Aim
Write a program in C for LCD interfacing.
Softwares Used
1. Keil Vision 3
2. Proteus 8 Professional
Components Used
1. ATMEL 89C51 Microcontroller
2. LCD
3. Resistor
Circuit Diagram
LCD1
18
29
30
31
1
2
3
4
5
6
7
8
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39 RV1
38
37
1k
36
35
34
33
32
RS
RW
E
D0
D1
D2
D3
D4
D5
D6
D7
7
8
9
10
11
12
13
14
XTAL1
4
5
6
U1
19
1
2
3
VSS
VDD
VEE
LM016L
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
AT89C51
Dept. Of ECE
13
IIET
Program
#include<reg51.h>
#define dataline P2
sbit rs=P3^0;
sbit rw=P3^1;
sbit en=P3^2;
unsigned char info[]="TINTU SEBASTIAN";
unsigned char i,j;
void delay(unsigned char);
void command(unsigned char);
void data1(unsigned char);
void main()
{
command(0x38);
delay(10);
command(0x0e);
delay(10);
command(0x01);
delay(10);
command(0x06);
delay(10);
command(0x80);
delay(10);
for(i=0;i<16;i++)
{
j=info[i];
data1(j);
delay(10);
}
command(0xc0);
delay(10);
while(1);
}
void command(unsigned char x)
{
dataline=x;
rs=0;
rw=0;
en=1;
delay(10);
en=0;
}
Dept. Of ECE
14
IIET
Dept. Of ECE
15
IIET
Expt. No: 08
Date: 23/07/2013
KEYPAD INTERFACING
Aim
Write a program in C to interface keypad and display the keys using a 7 segment.
Softwares Used
1. Keil Vision 3
2. Proteus 8 Professional
Components Used
1. ATMEL 89C51 Microcontroller
2. 7 segment display
3. Keypad
Circuit Diagram
U1
29
30
31
1
2
3
4
5
6
7
8
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
XTAL2
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
18
XTAL1
19
AT89C51
D
Dept. Of ECE
16
IIET
Program
#include <REGX51.h
#define keyport P2
#define col1 P2_0
#define col2 P2_1
#define col3 P2_2
#define TRUE 1
#define FALSE 0
void key_init()
{
keyport &=0x0F;
}
unsigned char get_key()
{
unsigned char i,k,key=0;
k=1;
for(i=0;i<4;i++)
{
keyport &=~(0x10<<i);
if(!col1)
{
key = k+0;
while(!col1);
return key;
}
if(!col2)
{
key = k+1;
while(!col2);
return key;
}
if(!col3)
{
key = k+2;
while(!col3);
return key;
}
k+=3;
keyport |= 0x10<<i;
}
return FALSE;
}
Dept. Of ECE
17
IIET
main()
{
unsigned char key;
char num[ ] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,
0x6f,0x77,0x3f,0x39,0x5e,0x79,0x71};
key_init();
P1 = 0;
while (1)
{
key=get_key();
if (key != 0)
{
P1 = num[key];
}
}
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
18
IIET
Expt. No: 09
Date: 30/07/2013
DC MOTOR INTERFACING
Aim
Write a program in C to interface a DC motor.
Softwares Used
1. Keil Vision 3
2. Proteus 8 Professional
Components Used
1.
2.
3.
4.
5.
6.
7.
8.
Circuit Diagram
U1
19
18
29
30
31
1
2
3
4
5
6
7
8
XTAL1
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
D1
C4
DIODE
1uf
+88.8
U2
1
B
C
6
5
4
K
4N25
Q1
R2
NPN
10k
R3
10k
AT89C51
Dept. Of ECE
19
IIET
Program
#include<reg51.h>
sbit sw=P1^0;
sbit out=P2^0;
void delay(unsigned char);
unsigned char x;
void main()
{
sw=1;
while(1)
{
if(sw==1)
{
out=1;
delay(98);
out=0;
delay(2);
}
else
{
out=1;
delay(10);
out=0;
delay(90);
}
}
}
void delay(unsigned char t)
{
unsigned int i,j;
for(i=0;i<t;i++)
for(j=0;j<2000;j++);
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
20
IIET
Expt. No: 10
Date: 06/08/2013
Circuit Diagram
U1
19
18
29
30
31
1
2
3
4
5
6
7
8
XTAL1
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
U2
1
2
3
4
5
6
7
1B
2B
3B
4B
5B
6B
7B
COM
1C
2C
3C
4C
5C
6C
7C
9
16
15
14
13
12
11
10
+88.8
ULN2003A
10
11
12
13
14
15
16
17
AT89C51
Dept. Of ECE
21
IIET
Program
#include<reg51.h>
sbit direction=P1^0;
unsigned char clockwise[4]={1,2,4,8};
unsigned char counter_clockwise[4]={8,4,2,1};
unsigned char i;
void delay();
void main()
{
while(1)
{
for(i=0;i<4;i++)
{
if (direction==0)
break;
P2=clockwise[i];
delay();
}
for(i=0;i<4;i++)
{
if(direction==1)
break;
P2=counter_clockwise[i];
delay();
}
}
}
void delay()
{
unsigned int j,k;
for(j=0;j<200;j++)
for(k=0;k<2000;k++);
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
22
IIET
Expt. No: 11
Date: 13/08/2013
Circuit Diagram
U2
2
OPTOCOUPLER-NAND
U3
2
U1
19
18
29
30
31
XTAL1
XTAL2
RST
PSEN
ALE
EA
DSW1
16
15
14
13
12
11
10
9
OFF
ON
1
2
3
4
5
6
7
8
DIPSW_8
Dept. Of ECE
1
2
3
4
5
6
7
8
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39
38
37
36
35
34
33
32
D3
DIODE
DIODE
OPTOCOUPLER-NAND
U4
2
3
21
22
23
24
25
26
27
28
D4
16
U5
OPTOCOUPLER-NAND
2
7
1
9
10
15
IN1
IN2
EN1
EN2
IN3
IN4
VSS
GND
VS OUT1
OUT2
OUT3
GND OUT4
3
6
11
14
+88.8
D1
D2
DIODE
DIODE
L293D
10
11
12
13
14
15
16
17
AT89C51
23
IIET
Program
#include<reg51.h>
sbit EN=P2^2;
sbit IN1=P2^0;
sbit IN2=P2^1;
sbit SW=P2^7;
sfr PWM=0x90;
void delay(unsigned int value)
{
unsigned int i,j;
for(i=0;i<value;i++)
for(j=0;j<20;j++);
}
void main()
{
SW=1;
EN=0;
IN1=0;
IN2=0;
PWM=0xFF;
while(1)
{
if(SW==1)
{
IN1=1;
IN2=0;
}
else
{
IN1=0;
IN2=1;
}
EN=1;
delay(PWM);
EN=0;
delay(0xFF-PWM);
}
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
24
IIET
Expt. No: 12
Date: 20/08/2013
Circuit Diagram
LCD1
LM016L
RST
C1
29
30
31
150pF
R1
10k
U3
37.0
VOUT
PSEN
ALE
EA
U2
1
2
3
4
5
8
10
9
19
6
7
CS
RD
WR
CLK IN
INTR
A GND
D GND
VREF/2
CLK R
VIN+
VIN-
VCC
DB0(LSB)
DB1
DB2
DB3
DB4
DB5
DB6
DB7(MSB)
20
18
17
16
15
14
13
12
11
1
2
3
4
5
6
7
8
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
D0
D1
D2
D3
D4
D5
D6
D7
7
8
9
10
11
12
13
14
RS
RW
E
39
38
37
36
35
34
33
32
4
5
6
XTAL2
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
1
2
3
18
XTAL1
VSS
VDD
VEE
U1
19
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
AT89C51
ADC0804
3
LM35
Dept. Of ECE
25
IIET
Program
#include<reg51.h>
sbit rd=P3^5;
sbit wr=P3^6;
sbit intr=P3^7;
sfr mydata=0x90;
sfr dat=0xA0;
sbit rs=P3^0;
sbit rw=P3^1;
sbit en=P3^2;
void delay(unsigned int value)
{
unsigned int i,j;
for(i=0;i<value;i++)
for(j=0;j<1275;j++);
}
void lcdcmd(unsigned char com)
{
dat=com;
rs=0;
rw=0;
en=1;
delay(5);
en=0;
delay(5);
}
void lcddata(unsigned char da)
{
dat=da;
rs=1;
rw=0;
en=1;
delay(5);
en=0;
delay(5);
}
Dept. Of ECE
26
IIET
void lcdinit(void)
{
lcdcmd(0X38);
delay(50);
lcdcmd(0X0C);
delay(50);
lcdcmd(0X01);
delay(50);
}
void lcdputs(const char *s)
{
while(*s)
lcddata(*s++);
}
27
IIET
rd=0;
value=mydata;
lcdcmd(0x8C);
convert(value);
rd=1;
}
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
28
IIET
Expt. No: 13
Date: 27/08/2013
OBJECT COUNTER
Aim
Write program for counting the number of objects detected in C.
Softwares Used
1. Keil Vision 3
2. Proteus 8 Professional
Components Used
1.
2.
3.
4.
Circuit Diagram
LCD1
18
29
30
31
1
2
3
4
5
6
7
8
XTAL2
RST
PSEN
ALE
EA
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD
39 RV1
38
37 1k
36
35
34
33
32
RS
RW
E
D0
D1
D2
D3
D4
D5
D6
D7
7
8
9
10
11
12
13
14
XTAL1
4
5
6
U1
19
1
2
3
VSS
VDD
VEE
LM016L
21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
AT89C51
Dept. Of ECE
29
IIET
Program
#include<reg51.h>
sbit count_in=P3^5;
sfr dat=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
void delay(unsigned int value)
{
unsigned int i,j;
for(i=0;i<value;i++)
for(j=0;j<1275;j++);
}
void lcdcmd(unsigned char com)
{
dat=com;
rs=0;
rw=0;
en=1;
delay(5);
en=0;
delay(5);
}
void lcddata(unsigned char da)
{
dat=da;
rs=1;
rw=0;
en=1;
delay(5);
en=0;
delay(5);
}
void lcdinit(void)
{
lcdcmd(0X38);
delay(50);
lcdcmd(0X0E);
delay(50);
Dept. Of ECE
30
IIET
lcdcmd(0X01);
delay(50);
}
void convert(unsigned char t) //Converts to ASCII
{
unsigned a,b,c;
a=t%10;
t=t/10;
b=t%10;
c=t/10;
lcddata(c+0x30);
lcddata(b+0x30);
lcddata(a+0x30);
delay(50);
}
void main()
{
unsigned char data_lcd;
lcdinit();
count_in=1;
TMOD=0X60;
TH1=0;
while(1)
{
do
{
TR1=1;
P1=TL1;
data_lcd=TL1;
convert(data_lcd);
lcdcmd(0X80);
}
while(TF1==0);
TR1=0;
TF1=0;
}
}
Result
Program was successfully executed and verified the results.
Dept. Of ECE
31