سلام:
من برای کار با LCD دچار مشکل شدم برنامه پایین رو نوشتم ولی داره توی پروتئوس جواب نمی ده.
#include <reg51.h>
int a,x;
sbit e =P2^0;
sbit rs=P2^2;
sbit p=P1^7;
void delay ()
{
for (x=0;x<850;x++);
}
void instruction()
{
delay();
P1=a;
rs=0;
e=1;
e=0;
}
void send_dat()
{
delay();
P1=a;
rs=1;
e=1;
e=0;
}
void main()
{
a=0x38;
instruction();
a=0x0f;
instruction();
a=0x01;
instruction();
a=0x06;
instruction();
a=0x80;
instruction();
while (1)
{
a=1;
send_dat();
}
}
من برای کار با LCD دچار مشکل شدم برنامه پایین رو نوشتم ولی داره توی پروتئوس جواب نمی ده.
#include <reg51.h>
int a,x;
sbit e =P2^0;
sbit rs=P2^2;
sbit p=P1^7;
void delay ()
{
for (x=0;x<850;x++);
}
void instruction()
{
delay();
P1=a;
rs=0;
e=1;
e=0;
}
void send_dat()
{
delay();
P1=a;
rs=1;
e=1;
e=0;
}
void main()
{
a=0x38;
instruction();
a=0x0f;
instruction();
a=0x01;
instruction();
a=0x06;
instruction();
a=0x80;
instruction();
while (1)
{
a=1;
send_dat();
}
}
دیدگاه