Hi Guys,
Need some more help on interrupts, im trying to use the timer0 stack overflow as an interrupt. I've got the interruprt working without any errors. However i want to make 'PORTA=0xFF' during the interrupt function, but this doesnt seem to work and PORTA does not update.
I've attached my code below.
Thanks,
Ash
#include <pic16f73.h>
#include <htc.h>
#define _XTAL_FREQ 4000000 //Set frequency to 4Mhz, refer to resonator specs
__CONFIG(FOSC_XT & WDTE_OFF & PWRTE_OFF & CP_ON & BOREN_OFF );
void interrupt Timer0_ISR(void)
{
TMR0IF=0; //Disable TMR0 Overflow Flag Bit
PORTA=0XFF;
GIE=1; //Enable Global Interrupt
}
void main(void)
{
TRISA=0b00000000;
TRISB=0b00000001; //Initialise I/O ports
TRISC=0b00000000; //Initialise I/O ports
PORTB=0b10000000; //Initialise I/O ports
OPTION_REG=0b01000000; //Enable Rising Edge Trigger
TMR0IE=1; //Enable TMR0 Overflow Interruprt
GIE=1; //Enable Global Interrupt
while(1)
{
if (TMR0<252)
{
TMR0=252;
}
}
}
Need some more help on interrupts, im trying to use the timer0 stack overflow as an interrupt. I've got the interruprt working without any errors. However i want to make 'PORTA=0xFF' during the interrupt function, but this doesnt seem to work and PORTA does not update.
I've attached my code below.
Thanks,
Ash
#include <pic16f73.h>
#include <htc.h>
#define _XTAL_FREQ 4000000 //Set frequency to 4Mhz, refer to resonator specs
__CONFIG(FOSC_XT & WDTE_OFF & PWRTE_OFF & CP_ON & BOREN_OFF );
void interrupt Timer0_ISR(void)
{
TMR0IF=0; //Disable TMR0 Overflow Flag Bit
PORTA=0XFF;
GIE=1; //Enable Global Interrupt
}
void main(void)
{
TRISA=0b00000000;
TRISB=0b00000001; //Initialise I/O ports
TRISC=0b00000000; //Initialise I/O ports
PORTB=0b10000000; //Initialise I/O ports
OPTION_REG=0b01000000; //Enable Rising Edge Trigger
TMR0IE=1; //Enable TMR0 Overflow Interruprt
GIE=1; //Enable Global Interrupt
while(1)
{
if (TMR0<252)
{
TMR0=252;
}
}
}