Hi Chris,
Could you post your corrected code? Myself and others also use 16F1 parts, so this is an important issue.
Thanks,
Dick
Hi Chris,
Could you post your corrected code? Myself and others also use 16F1 parts, so this is an important issue.
Thanks,
Dick
Hello Dick
I tested the same code as above, changing the interrupt handler to the following
If in doubt, add another bankselCode:asm myint: banksel PIR1 btfss PIR1,5 goto int_out bcf PIR1,5 banksel RCREG movfw RCREG banksel _RX_BYTE movwf _RX_Byte banksel TXREG movwf TXREG nop btfss PIR1,TXIF goto $-1 int_out: retfie endasm
I'm not using the code now but I did test it upon receipt of Darrel's input to check it out.
I have used this part as a battery cell monitor and I can recall scratching my head over the same issue as then.
Hopefully I'm twice bitten, third time shy![]()
Are you missing a bank select in that code snippet?
If _RX_Byte is in bank 0, then maybe this would work?Code:asm myint: banksel PIR1 ' |B0 btfss PIR1,RCIF ' |B0 goto int_out ' |B0 bcf PIR1,RCIF ' |B0 banksel RCREG ' |B3 movfw RCREG ' |B3 banksel _RX_BYTE ' |B? movwf _RX_Byte ' |B? banksel TXREG ' |B3 movwf TXREG ' |B3 nop ' |B3 btfss PIR1,TXIF ' |B0 <-- ***** goto $-1 ' |B0 int_out: retfie endasm
Code:asm myint: banksel PIR1 ' |B0 btfss PIR1,RCIF ' |B0 retfie ' |B0 bcf PIR1,RCIF ' |B0 banksel RCREG ' |B3 movfw RCREG ' |B3 movwf TXREG ' |B3 banksel _RX_BYTE ' |B0 movwf _RX_Byte ' |B0 btfss PIR1,TXIF ' |B0 goto $-1 ' |B0 retfie ' |B0 endasm
Last edited by Mike, K8LH; - 6th December 2012 at 03:52.
Whatever.
Darrel's answer covered it.
Bookmarks