sfr dataP = 0x90; // du lieu la P1
// ma 7 thanh tu 0 den 9 la
// 0x81h,0xcfh,0x92h,0x86h,0xcch,0xa4,0xa0h,0x8fh,0x80h,0x84h.sbit ctac = P3^4; sbit ctac = P3^4;
unsigned char dem=0;
/*====================Khai bao ham==================*//*---ham delay========================*/ /*---ham delay========================*/ void delay(long time)
{
while(time--);} }
/*---chuong trinh con kiem tra co phim nhan---*/void phim_an(void) void phim_an(void)
{
if(ctac==0) //co phim nhan{ {
delay(500); //chong rung phimwhile(ctac==0); //Cho nha phim while(ctac==0); //Cho nha phim delay(500); // chong rung phim dem++; //tang bien dem
if(dem==10) dem=0;} }
}
/*---hien thi so lan an phim---*/void solan_an(void) void solan_an(void) { switch(dem) { case 0: {dataP=0x81;break;} case 1: {dataP=0xcf;break;}
case 2: {dataP=0x92;break;}case 3: {dataP=0x86;break;} case 3: {dataP=0x86;break;} case 4: {dataP=0xcc;break;} case 5: {dataP=0xa4;break;} case 6: {dataP=0xa0;break;} case 7: {dataP=0x8f;break;} case 8: {dataP=0x80;break;} case 9: {dataP=0x84;break;} }; }
/*---chuong trinh chinh---*/void main(void) void main(void)
{