我是新手,我的gz60 time base module 中断不工作,LED没有动静,寄存器设置有问题吗?
看了好几天文档都没用,各位给个调试思路吧,先谢了
#include <hidef.h> /* for EnableInterrupts macro */ #include "derivative.h" /* include peripheral declarations */
#define ON 0 #define OFF 1
#define LED1 PTF_PTF0 #define LED2 PTF_PTF1 #define LED3 PTF_PTF2 #define LED4 PTF_PTF3 #define LED5 PTF_PTF4 #define LED6 PTF_PTF5 #define LED7 PTF_PTF6 #define LED8 PTF_PTF7
#define COUNT 75 /* Interrupts per sec */ unsigned char cCounter=0x00; /* Interrupt Events Counter */
void main(void) { CONFIG1 = 0x0B; CONFIG2 = 0x03;
DDRF = 0xFF; /* Configure PortF as Output */  TF = 0x00; /* Initialize PortF */ TBCR = 0x06;
cCounter = COUNT; /* Initialize the Counter */ EnableInterrupts;
TBCR_TBON=1; /* Turn TBM on */ while(1);
}/* END main() */
interrupt 16 void TBM_ISR (void){
TBCR_TACK=1; /* TimeBase Interrupt Acknowledge */
if( !(--cCounter) ){ /* If Counter is ZERO then */ PTF = ~PTF; /* Toggle LED */ cCounter = COUNT; /* Reinitialize the Counter */ } }/* END TBM_ISR() */
|