Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Glow led using virtual terminal in 8051

Status
Not open for further replies.

shubham156

Newbie level 4
Newbie level 4
Joined
Oct 20, 2014
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
39
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:

what kind of error you are getting with this code.
 

Hi,
Try this one. I haven't compiled the code.
 

Attachments

  • 8051-lcd.txt
    1 KB · Views: 84

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top