C源代码:
#include
/*定义字型字位口*/
#define DIGPORT P2
#define WORDPORT P0
/*定义键盘口*/
#define KEYPORT P1
#define uint unsigned int
#define uchar unsigned char
#define uong unsigned long
sbit P_7=P3^7; //PWM信号输出
bit OVER;
uint k,dt;
uong KEYNUM;
uchar qu,NUM;
void Delay(uint ms)
{
while(--ms);
}
void timer0(void) interrupt 1 using 1
{
TL0=-(10248%256);
TH0=-(10248%256);
NUM+=1;
if(NUM>=10){
TR1=0;
TR0=0;
OVER=1;
}
}
uint CK(void)
{
uint number=0;
P_7=1;
OVER=0;NUM=0;
EA=1;ET0=1;
TH0=(10203/256);
TH0=(10203%256);
TH1