FYI: BCF IOCAF,IOCAF1 in your int handler is probably not doing what you think. IOCAF is in bank 7 on the 16F1828, and PBP resets the bank to 1 when you use ASM. It's up to you to make sure you're in the correct register bank in your .asm routines.
FYI: BCF IOCAF,IOCAF1 in your int handler is probably not doing what you think. IOCAF is in bank 7 on the 16F1828, and PBP resets the bank to 1 when you use ASM. It's up to you to make sure you're in the correct register bank in your .asm routines.
Bruce, Thanks for the info re. IOCAF bank switching in the handler. Actually, I don't think I need that line of code anyway. As stated in the header, the test program is for one-time use only. The circuit works correctly as is.
Hank, With two interrupt sources you would first go to the handler identified after DEFINE INTHAND. Once there, set up a test to determine which interrupt occurred by polling the interrupt flags. Then carry out the appropriate interrupt action. I have never done this, so maybe Bruce or Darrel could help with a better explanation.
Hint: BTFSS or BTFSC, or BIT?GOTO
;************************************************* ***************
;* BIT?GOTO : Macro - Bit test and Long Goto *
;* *
;* Input : Cstate = constant desired state for goto *
;* Regin = register *
;* Bitin = bit *
;* Label *
;* Output : None *
;* *
;* Notes : Preserves C, Z, handles page boundaries, resets bank.*
;************************************************* ***************
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
16F1828 now working with two interrupt sources.
BTFSS works well as a source selection tool ... thanks Steve.
Automatic context saving feature of the chip working.
End of story.
Bookmarks