#include <SH79F3283.H>
#define uint8_t unsigned char
#define uint16_t unsigned int
uint16_t Time;
void Time_Init()
{
T4CLKS = 0; //系统时钟源
T4PS0 = 0; //不分频
T4PS1 = 0;
T4M0 = 0; //工作方式0(自动重载初值)
T4M1 = 0;
TL4 = (0xffff - 50000)%256 ; // 50ms初值
TH4 = (0xffff - 50000)/256 ;
TR4 = 1; //开始计数
IEN1 = 0x40 ; //开TM4中断,ET4 = 1;
EA = 1; //开总中断
}
void main ()
{
Time_Init ();
while(1)
{RSTSTAT = 0x00; //ι¹·
}
}
void Time4(void) interrupt 13
{
TF4=0;
Time ++;
}
以上是我简化了的定时器4定时程序,求大神帮忙看看为什么不进中断,已近调试了一晚了,
万分感谢!
|