đây là code C của minh
còn đây là mô phỏng.nó sai ở đâu rồi hay sao ý .lúc play chỉ sáng mỗi cái màn hình hic
#include<AT89X52.H>
unsigned int i,j;
const unsigned char h1[16]={" adsadsaddad "};
const unsigned char h2[16]={" ccsdd "};
void delay(unsigned int n)
{
for(i=0;i<n;i++)
{;}
}
void lenh_viet()
{
P1_0=0;//chon thanh ghi lenh
P1_2=1;//
P1_2=0;
delay(100);
}
void dl_viet()
{
P1_0=1;//chon thanh ghi du lieu
P1_2=1;
P1_2=0;
delay(100);
}
void setup_lcd()
{
P1_2=1;P1_0=1;P1_1=0;
P2=0x38; lenh_viet();delay(10000);
P2=0x0C; lenh_viet();
P2=0x01; lenh_viet();
P2=0x06; lenh_viet();
P2=0x80; lenh_viet();delay(10000);
}
void main()
{
setup_lcd();
for(j=0;j<16;i++)
{P2=h1[j];dl_viet();
}
P2=0xC0;
lenh_viet();
delay(10000);
for(j=0;j<16;i++)
{P2=h2[j];dl_viet();}
while(1){}//DUNG YEN
}
unsigned int i,j;
const unsigned char h1[16]={" adsadsaddad "};
const unsigned char h2[16]={" ccsdd "};
void delay(unsigned int n)
{
for(i=0;i<n;i++)
{;}
}
void lenh_viet()
{
P1_0=0;//chon thanh ghi lenh
P1_2=1;//
P1_2=0;
delay(100);
}
void dl_viet()
{
P1_0=1;//chon thanh ghi du lieu
P1_2=1;
P1_2=0;
delay(100);
}
void setup_lcd()
{
P1_2=1;P1_0=1;P1_1=0;
P2=0x38; lenh_viet();delay(10000);
P2=0x0C; lenh_viet();
P2=0x01; lenh_viet();
P2=0x06; lenh_viet();
P2=0x80; lenh_viet();delay(10000);
}
void main()
{
setup_lcd();
for(j=0;j<16;i++)
{P2=h1[j];dl_viet();
}
P2=0xC0;
lenh_viet();
delay(10000);
for(j=0;j<16;i++)
{P2=h2[j];dl_viet();}
while(1){}//DUNG YEN
}
Comment