刚开始用中颖芯片,现在设置定时器时有问题。我设置的定时中断时间是250uS,但是实际测出来是3mS,不知道是那里设置不对,谁能帮我看下。定时器3配置如下:
void Timer_Initial(void)
{
#define Time_250uS 6000
#define Time_10uS 240
BANK1_SET();
//***********************************************************************
TL3 = (65536-Time_250uS)%256; //
TH3 = (65536-Time_250uS)/256;
ET3 = 1; //
T3CON = Bin(00000000); //
TR3 = 1; //
//***********************************************************************
//***********************************************************************
// T4CON = Bin(01000000); //
//
// TL4 = (255-240);
// TH4 = 0xff; //
// TR4 = 1; //
//***********************************************************************
BANK0_SET();
}
中断配置如下:
void Interrupt_Initial(void)
{
IEN0 = Bin(10100010); //总中断使能,定时器3中断使能,触摸中断使能
IEN1 = 0x04; //定时器4中断使能
IEN2 = 0x00;
IENC = 0x00; //外部中断除能
ELEDCON = 0x00; //LED/LCD帧中断关闭
TCON = 0x00; //外部中断除能
EXF0 = 0x00; //
IPL0 = Bin(00000000); //
IPH0 = Bin(00000000);
IPL1 = Bin(00000100); //定时器4中断等级3
IPH1 = Bin(00000100);
EXCON = 0x00; //
}
|