c8051f单片机遇到的问题
c8051f单片机突然TIM3中断不好用。设置为:void Timer3_Init (void)
{
char SFRPAGE_SAVE = SFRPAGE; // Save Current SFR page
SFRPAGE = TMR3_PAGE;
TMR3CN = 0x00; // Timer3 external enable off;
TMR3CF = 0x00; // Timer3 uses SYSCLK/12
RCAP3 =65535 -36; // Timer3 configured to overflow after20uS
TMR3 = RCAP3; // ~25ms (for SMBus low timeout detect)
EIE2 |= 0x01; // Timer3 interrupt enable
TR3 = 1; // Start Timer3
SFRPAGE = SFRPAGE_SAVE; // Restore SFR page detector
}
void Timer3_ISR (void) interrupt 14
{
char SFRPAGE_SAVE = SFRPAGE; // Save Current SFR page
SFRPAGE = TMR3_PAGE;
TF3 = 0; // Clear Timer3 interrupt-pending flag
SFRPAGE = SMB0_PAGE;
SMB0CN &= ~0x40; // Disable SMBus
SMB0CN |= 0x40; // Re-enable SMBus
SMB_BUSY = 0; // Free bus
// SFRPAGE = SFRPAGE_SAVE; // Switch back to the Timer3 SFRPAGE
SFRPAGE = SFRPAGE_SAVE; // Restore the SFRPAGE
}
仿真寄存器为:
c:tu.jpg 图片没发上。
页:
[1]