> Here's my ISR. I'm fairly sure I've covered all the bases, but I'm new to > this. Pick away. > > Pulse ; called every 1.0ms on > Timer0 timeout > ; note to self: must be > <900 instructions total (incl. worst-case sub/rt's) > BCF INTCON,T0IF ; clear Timer 0 interrupt flag > BSF INTCON,T0IE ; re-enable Timer 0 interrupt (if > necessary) It is pointless to disable then immediately re-enable the timer 0 interrupt. > BCF STATUS,RP0 > BCF STATUS,RP1 ; Bank 0 This corrupts STATUS before it is saved. It has the effect of randomly trashing the bank bits in the foreground code (it hates that). > MOVLW d'008' ; reset Timer 0 by reloading TMR0 reg This randomly trashes W from the foreground code's point of view (it really hates that). Very bad unless your foreground code is the equivalent of "10 GOTO 10". > MOVWF TMR0 ; FFh-248d=8d (req'd for 1.00ms > overall Timer 0 rate) It is better to add a value into timer 0 during the interrupt than to reset it to a fixed value. The add is independent of relative position from the start of the interrupt, and accumulates no long term error due to interrupt jitter, disabled interrupts, etc. Check the manual about timer 0 stopping for a few cycles after it is written to. While there is nothing wrong with using timer 0 to generate a periodic interrupt, it is easier to use timer 2 and its period register if you are using a machine that has timer 2. > MOVWF W_TEMP ; save W contents during ISR Too late, W already contains 8. > SWAPF STATUS,W ; > CLRF STATUS ; select Bank 0 and clear IRP > MOVWF STATUS_TEMP ; save status to Bank 0 temp reg > MOVF PCLATH,W ; > MOVWF PCLATH_TEMP ; save PCLATH in temp reg > . > . > . You need to carefully read the section about interrupts and how to save/restore state in the ISR. PICs don't do anything special on an interrupt except to clear INTCON,GIE and CALL 4. The rest is left as an exercise to the coder. You have to save/restore everything you use in software including W and STATUS. This is a little tricky since everything uses W, including any method of saving STATUS, but you can't set the bank without altering STATUS. I have a template interrupt routine and lots of other stuff at http://www.embedinc.com/pic. Take a look at QQQ_INTR.ASPIC. It is an example of the right way to get into and out of an interrupt. It also automatically saves/restores PCLATH if running on a machine with more than one code page, and lets you set an assembly time switch to save/restore FSR in case your interrupt routine uses FSR. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics