#include<reg51.h>
#define Lcd P2
#define port P3
#define port P1
void delay(unsigned int x)
{
while(x--);
}
void cmd(unsigned int x)
{
P2=x;
P3=0x04;
delay(100);
P3=0x00;
}
void intiz()
{
cmd(0x01);delay(1000);
cmd(0x0e);delay(1000);
cmd(0x80);delay(1000);
cmd(0x38);delay(1000);
}
void dat(unsigned int x)
{
P2=x;
P3=0x05;
delay(100);
P3=0x01;
}
void num(unsigned int x)
{
unsigned int a,b=1;
a=x;
while(a>9)
{
b=b*10;
a=a/10;
}
while(b>0)
{
dat((x/b)+48);
x=x%b;
b=b/10;
}
}
void main()
{
intiz();
while(1)
{
num(P1);
cmd(0x80);
delay(100);
}
}
//Please comment below for any queries
#define Lcd P2
#define port P3
#define port P1
void delay(unsigned int x)
{
while(x--);
}
void cmd(unsigned int x)
{
P2=x;
P3=0x04;
delay(100);
P3=0x00;
}
void intiz()
{
cmd(0x01);delay(1000);
cmd(0x0e);delay(1000);
cmd(0x80);delay(1000);
cmd(0x38);delay(1000);
}
void dat(unsigned int x)
{
P2=x;
P3=0x05;
delay(100);
P3=0x01;
}
void num(unsigned int x)
{
unsigned int a,b=1;
a=x;
while(a>9)
{
b=b*10;
a=a/10;
}
while(b>0)
{
dat((x/b)+48);
x=x%b;
b=b/10;
}
}
void main()
{
intiz();
while(1)
{
num(P1);
cmd(0x80);
delay(100);
}
}
//Please comment below for any queries
No comments:
Post a Comment