Akshit Sharma
Newbie level 3
- Joined
- Jan 21, 2014
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 28
Hi,
I am interfacing a 16x2 LCD with AT89c51 microcontroller. Attached is the design file and c code for the same. I am getting a logic contention warning on proteus. I have checked my code many times but couldn't find anything. Please Help.
Thanks
code
I am interfacing a 16x2 LCD with AT89c51 microcontroller. Attached is the design file and c code for the same. I am getting a logic contention warning on proteus. I have checked my code many times but couldn't find anything. Please Help.
Thanks
code
Code:
#include <reg51.h>
sbit rs=P2^5;
sbit rw=P2^6;
sbit en=P2^7;
sbit busy=P3^7;
void lcdcmd(unsigned char);
void lcddata(unsigned char);
void lcdready();
void delay();
void main()
{
lcdcmd(0x38);
lcdcmd(0x0C);
lcdcmd(0x01);
lcdcmd(0xC0);
lcddata('H');
lcddata('I');
while(1);
}
void lcdcmd(unsigned char value)
{
lcdready();
P3=value;
rs=0;
rw=0;
en=1;
delay();
en=0;
}
void lcddata(unsigned char value)
{
lcdready();
P3=value;
rs=1;
rw=0;
en=1;
delay();
en=0;
}
void lcdready()
{
busy=1;
rw=1;
rs=0;
while(busy==1)
{
en=0;
delay();
en=1;
}
}
void delay()
{
unsigned int j;
for(j=0;j<2550;j++);
}