I´m working with the newly supported PIC16F1829 and I´m trying to adapt a firmware to the new controller. After 2 days looking for the error I found the problem, and in my opinion it is not in the firmware...
Below you find a Code-Snippet, where the error happens:
Code: Select all
void interrupt()
{
if (PIR1.RCIF) //Serieller Empfangsinterrupt
{
komRxData = RCREG;
eventKomRX = 1;
}
else if (PIR1.TMR2IF) //Timer 2 Interrupt
{
.....
if PIR1.RCIF is false, the program should jump to "else if ...", but it does a jump somewhere in my program. I examined the Assembler Code and Listing. In assembler, its:
Code: Select all
;.c,294 :: if (PIR1.RCIF) //Serieller Empfangsinterrupt
BTFSS PIR1+0, 5
GOTO L_interrupt34
;.c,297 :: komRxData = RCREG;
MOVF RCREG+0, 0
MOVWF _komRxData+0
;.c,298 :: eventKomRX = 1;
BSF _event_bits0+0, 3
;.c,300 :: }
GOTO L_interrupt35
L_interrupt34:
;.c,303 :: else if (PIR1.TMR2IF) //Timer 2 Interrupt
BTFSS PIR1+0, 1
This error happens on both, the chip and the simulator.
Best regards
Patric