Can some one please post an example using the timer interrupt for the 4013. I'm not getting anywhere with the datasheet or help.
thanks
jim
Timer Interrupt help please
Timer Interrupt help please
Here's my crack at the timer interrupt. Just a modification of the Pascal example.
void Timer1Int() org 0x1A
How do we know that the address of this interrupt is 0x1A? I don't see a reference in any documentation.
// timer interrupt
void init()
{
TRISB = 0;
LATB = 255;
ADPCFG= 0XFFFF;
}
void InitTimerInterrupt()
{
IPC0.F12 = 1; // interrupt priority level = 1
IFS0.F3 = 0; // clear TMR1IF
IEC0.F3 = 1; // enable Timer1 interrupts
T1CON.F4 = 0; // timer prescaler bit 4-5 1:1,1:8,1:64,1:256
T1CON.F5 = 1; // timer prescaler bit 4-5 1:1,1:8,1:64,1:256
T1CON.F15 = 1; // Timer On
}
void Timer1Int() org 0x1A
{
IFS0.F3 = 0;
LATB = ~PORTB;
}
int main()
{
init();
InitTimerInterrupt();
while(1) { }
}
void Timer1Int() org 0x1A
How do we know that the address of this interrupt is 0x1A? I don't see a reference in any documentation.
// timer interrupt
void init()
{
TRISB = 0;
LATB = 255;
ADPCFG= 0XFFFF;
}
void InitTimerInterrupt()
{
IPC0.F12 = 1; // interrupt priority level = 1
IFS0.F3 = 0; // clear TMR1IF
IEC0.F3 = 1; // enable Timer1 interrupts
T1CON.F4 = 0; // timer prescaler bit 4-5 1:1,1:8,1:64,1:256
T1CON.F5 = 1; // timer prescaler bit 4-5 1:1,1:8,1:64,1:256
T1CON.F15 = 1; // Timer On
}
void Timer1Int() org 0x1A
{
IFS0.F3 = 0;
LATB = ~PORTB;
}
int main()
{
init();
InitTimerInterrupt();
while(1) { }
}
Re: Timer Interrupt help please
chapmjw wrote:How do we know that the address of this interrupt is 0x1A? I don't see a reference in any documentation.