|
/***************************************
/延时函数delay_short(ms)
/延时函数delay_long(10ms)
/中断函数
/初始化函数
/**************************************/
#include <reg51.h>
#include "delay.h"
#include "const.h"
#include "scan.h"
#include "SHUMA_hc595_drive.h"
void delay_short(uint i) //i=1时延时1ms
{
uint j;
for(j=0;j<i;j++)
{
;
}
}
void initial()
{
EA=1;//开总中断
ET0=1;//开定时器中断
TH0=(65536-300)/256;
TL0=(65536-300)%256;//0.5ms中断
TMOD=0x01; //方式一 16位
TR0=1; //开启定时器1
beer=0;//关闭蜂鸣器
P_GND=0;//接地
}
void timer0() interrupt 1
{
TF0=0; //清除中断标志
TR0=0; //关中断
scan(); //在中断中扫描键盘
SHUMA_display();
TH0=(65536-300)/256;
TL0=(65536-300)%256;//0.5ms中断
TR0=1; //开中断
}
|
|