Hi Guys,
Been working on this all day.. well I say all day but updating the IDE seemed to break everything, then later updating XC8 broke stuff again.
All good fun though....but there comes a point when you need to ask for help, so I am
I'm trying to read PORTB into a var and then eventually out to term'....as it wasn't working I started to strip bits of code out till I was just getting TMR1 to work....but it isn't. Here's the code. (MPLABX ver5.0, DEV Board - EasPICV7 , Comp- XC8 ver2.0, Debug - ICD3)
Any feedback would be appreciated.
Regards
Les
Been working on this all day.. well I say all day but updating the IDE seemed to break everything, then later updating XC8 broke stuff again.
All good fun though....but there comes a point when you need to ask for help, so I am
I'm trying to read PORTB into a var and then eventually out to term'....as it wasn't working I started to strip bits of code out till I was just getting TMR1 to work....but it isn't. Here's the code. (MPLABX ver5.0, DEV Board - EasPICV7 , Comp- XC8 ver2.0, Debug - ICD3)
Code:
void main(void)
{
// Initialize the device
SYSTEM_Initialize();
// Enable the Global Interrupts
INTERRUPT_GlobalInterruptEnable();
// Enable the Peripheral Interrupts
INTERRUPT_PeripheralInterruptEnable();
unsigned char temp;
unsigned int countTMR1IFs=0;
void TMR1_Initialize(void);
void TMR1_StartTimer(void);
void INTERRUPT_Initialize (void);
while (1)
{
if (PIR1bits.TMR1IF) //If flagged run ISR
{
void TMR1_ISR(void); // Calling ISR
void TMR1_StartTimer(void); // & restart timer
}
}
/*
************* END OF MAIN ****************
*/
void TMR1_ISR(void);
{
countTMR1IFs++; // TMR1 Flagged count number of times
if (countTMR1IFs==10) // Too slow for application, but it's fine for testing.
{
temp=PORTB; // After flagging 10 times read PORTB
countTMR1IFs=0; // reset counter
}
PIR1bits.TMR1IF = 0; // Reset flag
}
}
/**
End of File
*/
Regards
Les