Chương trình
#include <16F877A.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT,NOLVP, NOCPD, NOWRT
#use delay(clock=4000000)
#use standard_io(b)
unsigned char sangtat[]={0b11111111,0b00000000};
unsigned char xenke[]={0b10101010,0b01010101};
unsigned char duoiphaitrai[]={0b00000001,
0b00000010,
0b00000100,
0b00001000,
0b00010000,
0b00100000,
0b01000000,
0b10000000};
unsigned char duoitraiphai[]={0b10000000,
0b01000000,
0b00100000,
0b00010000,
0b00001000,
0b00000100,
0b00000010,
0b00000001};
unsigned char danphaitrai[]={0b00000001,
0b00000011,
0b00000111,
0b00001111,
0b00011111,
0b00111111,
0b01111111,
0b11111111};
unsigned char dantraiphai[]={0b10000000,
0b11000000,
0b11100000,
0b11110000,
0b11111000,
0b11111100,
0b11111110,
0b11111111};
unsigned char trongra[]={0b00011000,
0b00111100,
0b01111110,
0b11111111};
unsigned char ngoaivao[]={0b10000001,
0b11000011,
0b11100111,
0b11111111,};
//khai bao cac bien toan cuc dung trong chuong trinh
unsigned char contro,lap;
void main()
{
while(true)
{
//sang tat
for(lap=0;lap<3;lap++)
{
for(contro=0;contro<2;contro++)
{
output_b(sangtat[contro]);
delay_ms(250);
}
}
//xen ke
for(lap=0;lap<3;lap++)
{
for(contro=0;contro<2;contro++)
{
output_b(xenke[contro]);
delay_ms(250);
}
}
//duoiphaitrai
for(lap=0;lap<3;lap++)
{
for(contro=0;contro<8;contro++)
{
output_b(duoiphaitrai[contro]);
delay_ms(250);
}
}
//duoitraiphai
for(lap=0;lap<3;lap++)
{
for(contro=0;contro<8;contro++)
{
output_b(duoitraiphai[contro]);
delay_ms(250);
}
}
//danphaitrai
for(lap=0;lap<3;lap++)
{
for(contro=0;contro<8;contro++)
{
output_b(danphaitrai[contro]);
delay_ms(250);
}
}
//dantraiphai
for(lap=0;lap<3;lap++)
{
for(contro=0;contro<8;contro++)
{
output_b(dantraiphai[contro]);
delay_ms(250);
}
}
//trongra
for(lap=0;lap<3;lap++)
{
for(contro=0;contro<4;contro++)
{
output_b(trongra[contro]);
delay_ms(250);
}
}
//ngoaivao
for(lap=0;lap<3;lap++)
{
for(contro=0;contro<4;contro++)
{
output_b(ngoaivao[contro]);
delay_ms(250);
}
}
}
}
Không có nhận xét nào:
Đăng nhận xét