ernestmyname
Member level 1
I have been unable to get an interrupt timer routine work on my PIC 18F2550. I basically copied the code from the C18 user's guide and it is still not working properly. Any help would be appreciated. PORTA is outputting to a 7 seg display.
The value on the display never changes from zero, so I know it's not entering the ISR routine.
#include <p18f2550.h>
#include <timers.h>
#include <delays.h>
void timer_isr (void);
unsigned char digit[] = {0x01,0x4F,0x12,0x06,0x4C,0x24,0x20,0x0F,0x00,0x04};
#pragma code low_vector=0x18
void low_interrupt (void)
{ _asm GOTO timer_isr _endasm
}
#pragma code
#pragma interruptlow timer_isr
void timer_isr (void)
{ INTCONbits.TMR0IF = 0;
PORTA = digit[3];
Delay10KTCYx(10);
}
void main(void)
{ TRISA = 0x00;
PORTA = digit[0];
OpenTimer0 (TIMER_INT_ON &
T0_SOURCE_INT &
T0_8BIT);
INTCONbits.GIE = 1; //enable global interrupts
while (1);
}
The value on the display never changes from zero, so I know it's not entering the ISR routine.