#pragma config WDTEN = OFF //WDT disabled (enabled by SWDTEN bit)
#include <timers.h>
#define TRUE 1
#define FALSE 0
#define HIGH 1
#define LOW 0
void main(void)
{
unsigned char config1=0x00;
unsigned char config2=0x00;
unsigned int timer_value=0x00;
// PIE2bits.TMR3IE=TRUE; //这段注释掉就不进中断
// T3CONbits.TMR3ON=TRUE;
config1 = TIMER_INT_ON | T1_16BIT_RW | T1_SOURCE_FOSC | T1_PS_1_1;
config2 = TIMER_GATE_OFF | TIMER_GATE_INT_OFF;
timer_value = 0xffa0;
WriteTimer1(timer_value);
OpenTimer1(config1,config2);
INTCONbits.GIEH=TRUE;
INTCONbits.GIEL=TRUE;
RCONbits.IPEN=TRUE;
IPR1bits.TMR1IP=TRUE;
while(1)
{
Nop();
}
}
void high_isr (void);
void low_isr (void);
#pragma code high_vector=0x08
void high_vector (void)
{
_asm goto high_isr _endasm
}
#pragma code low_vector=0x18
void low_vector (void)
{
_asm goto low_isr _endasm
}
#pragma code
#pragma interrupt high_isr
void high_isr (void)
{
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
}
#pragma interruptlow low_isr
void low_isr (void)
{
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
} |