#include <REG52.H>
/* Cot tu P1.0 den 1.7
Hang tu P2.0 den P3.7
De quet dua muc logic 0 lan luot ra cong 0
*/
/* Ham tre */
void delay(long time)
{
long n;
for(n=0;n<time;n++)
{
;
}
}
unsigned char kytu1[23]={0x00,0x81,0x81,0x0FF,0x81,0x81,0x0C,0x3E,0x7F,0x7E,0x0FC,0x7C,0x3E,0x1F,0x0E,0x00,0xFF,0x80,0x80,0x80,0xFF,0x00,0x00};
unsigned char k=0;
/* Ham quet led ma tran_ vua hien thi vua dich ky tu dan sang trai*/
void hienthi(void)
{
unsigned char n,k,lap;
unsigned char cot[8]={0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F};
for(k=0;k<16;k++)
{
for(lap=0;lap<15;lap ++)
{for(n=0;n<8;n++)
{
if((n+k)<50 )
{P0=cot[n];
P2=kytu1[n+k];
delay(45);
}
P0=0xFF;
P2=0x00;
} }
}
}
void main(void)
{
while(1)
{
hienthi();
k=k+1;
if(k==27) k=0;
}
}
mienphivpn.com