Hi Alain - I really needed coffee. Too much stress I guess. I mistook it for a 16F device!!! haha
OTOH 64 bytes RAM should be good enough to do asm interrupts no?
This is what I did with the 16F628 interrupts.
I have not checked the datasheet for the banks used in the 12F629, but the wsave registers may need to change accordingly. Otherwise, the context save and restore takes just 4 bytes of RAM !!!!Code:' define the interrupt handler define INTHAND _IntHandler ' These variables are used to save the machine state on interrupt wsave var byte $20 SYSTEM ' location for W if in bank0 wsave1 var byte $A0 SYSTEM ' location for W if in bank1 wsave2 var byte $120 SYSTEM ' location for W if in bank2 ssave var byte BANK0 SYSTEM ' location for STATUS register psave var byte BANK0 SYSTEM ' location for PCLATH register fsave var byte BANK0 SYSTEM ' location for FSR register IntHandler: asm movwf wsave ; Save the W register swapf STATUS, W clrf STATUS ; Point to bank 0 movwf ssave ; Save the STATUS register movf PCLATH, W ; Save PCLATH movwf psave movlw ((INTHAND) >> 8) ; Set PCLATH for jump movwf PCLATH btfss INTCON, INTF ; branch if PULSEIN arrived goto EndInt ; your code goes here ; restore the machine context EndInt movf fsave,w ;restore the FSR movwf FSR movf psave,w ;restore PCH movwf PCLATH swapf ssave, W ;restore STATUS movwf STATUS swapf wsave, F swapf wsave, W ;restore W retfie endasm
That also answers Damien as to the code needed for the CONTEXT RESTORE of proton
![]()




Bookmarks