Sir i want to glow led using virtual terminal in 8051
my code is:
Code C - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
| #include<reg51.h>
sfr ldata=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
void delay();
void lcdcmd(char value);
void lcddata(char value);
void main()
{
unsigned char p[40]="BULBON";
unsigned char q[40];
unsigned int i=0;
unsigned int flag=0;
unsigned char mybyte;
P1=0;
lcdcmd(0x81);
delay();
lcdcmd(0x0E);
delay();
lcdcmd(0x01);
delay();
lcdcmd(0x06);
delay();
TMOD=0x20;
TH1=0xFd;
SCON=0x51;
TR1=1;
while(1)
{
while(RI==0);
mybyte=SBUF;
while(mybyte!=0x20)
{
q[i]=mybyte;
if(p[i]==q[i])
i++;
lcddata(mybyte);
}
flag=1;
if (flag==1)
P0=1;
if((mybyte==0x08)||(mybyte==0x7f))
lcdcmd(0x01);
RI=0;
delay();
}
}
void lcdcmd(char value)
{
ldata=value;
rs=0;
rw=0;
en=1;
delay();
en=0;
}
void lcddata(char value)
{
ldata=value;
rs=1;
rw=0;
en=1;
delay();
en=0;
}
void delay()
{
int i,j;
for(i=0;i<256;i++);
for(j=0;j<256;j++);
} |
I am getting an error for this
Last edited by a moderator: