Hank, Please note from the first post that an advantage of interrupts without DT_INTS is a major saving in code space. My sample program compiled with 625 fewer program words when using the 16F1828 vs. a 16F690.
Hank, Please note from the first post that an advantage of interrupts without DT_INTS is a major saving in code space. My sample program compiled with 625 fewer program words when using the 16F1828 vs. a 16F690.
Hi Dick....thanks point noted. As it goes, while saving space is always welcome the 16f1828 has a reasonable amount - plus, my intended program is going to be very small.
While I've got you ear....do I just use the syntax exactly as per your example, ie.....
ie headed up by an ASM label with no colon, then on the following line the label as defined by the DEFINE INTHAND command?Code:ASM RDT BCF IOCAF,IOCAF1 ;clear IOCA negative change interrupt flag BCF INTCON,3 ;disable interrupt on change by clearing INTCON bit 3 BCF PORTC,5 ;turn on led solid RETFIE ;return to main ENDASM
Any idea how two interrupts are catered for? (yes, I know DTS_INT handles multiple interrupts already, but just wondering how to do it manually)
The test program I ran in post #14 compiled to 133 words without DT-INTS, and 153 words with DT_INTS.
I don't think the code savings was due to not using DT_INTS.
That's using an ASM type INT_Handler. If using a PBP type handler, it goes up to 285 words.
But that's not a good comparison, because if you want to do PBP type interrupts without DT_INTS the program will get huge from all the checks placed between every line of code.
DT
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