Anonymous
Not applicable
May 09, 2012
12:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 09, 2012
12:48 AM
I just follow the template of C51,but nothing happend.
I put timer2 interruppt service function in fw.c and set the interruppt number to 1 according to the advice from somebody else,but still failed.
void TD_Init(void) // Called once at startup
{
WORD i,freq=1000;
i=1000000/freq;
// set the CPU clock to 48MHz
//CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;
//CPUCS = CPUCS ;
// set the slave FIFO interface to 48MHz
//IFCONFIG |= 0x40;
IFCONFIG=0;
CKCON&=~bmBIT5;
RCAP2H=MSB(0xffff-i);
RCAP2L=LSB(0xffff-i);
//T2CON=bmBIT1;
OEA=0x00;
PA0=1;
EA=1;
TR2=1;
ET2=1;
}
void ISR_TIMER2(void) interrupt 1
{
TF2=0;
PA0=~PA0;
}
3 Replies