上传者: 43934844
|
上传时间: 2022-06-19 14:03:50
|
文件大小: 13KB
|
文件类型: DOC
#include sbit P1_1=P1^1; unsigned char i,k,ge,shi; unsigned char a[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; unsigned char b[2]; void latetime(unsigned int t) { unsigned char j; while(t--) { for(j = 0; j < 125; j++); } } void main() { ge=0,shi=6; TMOD=0x01; TH0=0xD8; TL0=0xf0; EA=1; ET0=1; TR0=1; while(1) { for(k=0;k<2;k++) { P0=b[k]; P2=k; latetime(3); } } } time0_int(void) interrupt 1 { TH0=0xD8; TL0=0xF0; i++; b[0]=a[ge]; b[1]=a[shi]; if(i==100) { i=0; ge--; } if(ge==6