Hi tom,
The 16F876 has 8K of program space.
PBP automatically inserts an Interrupt "Stub" for you if the program space is greater than 2K. Why?, I don't know. The "Stub" is identical to what you have at the beginning of "myint", and it's all done before getting to "myint". Then once in "myint" it tries to save them again, but now the registers have been modified. When they get restored after the interrupt, something will have the wrong value, affecting the main PBP program.
By testing for the code size first you can avoid the problem. Or, since you know the code size is larger than 2K, you can just leave that part out entirely.
Code:
IF (CODE_SIZE <= 2)
movwf wsave
swapf STATUS,W
clrf STATUS
movwf ssave
movf PCLATH,W
movwf psave
endif
Bookmarks