On 1 July 2013 16:26, Electronic Consultation < electronic.consultation.au@gmail.com> wrote: > state.asm > state1 > ., > ,, > ,, > return > ;how can I put interrupt here based on timer.asm, I called it *A* > You can't. Interrupt is happened independently from your main code. When interrupt happens, it interrupts the execution flow, it suspends whatever your main code is doing, and starts executing the code at the interrupt vector (depending on your PIC that interrupt vector can be in different places). It is your responsibility to write an interrupt handler, or Interrupt Service Routine (ISR). Previously I put an example how it is done. Within the interrupt handler you set a flag or increment a counter which you can check in your main code... So for example: incf COUNT1, f > movlw .10 ;Compare count to 100 decimal > subwf COUNT1, W ;Store the result back in > btfss STATUS, C ;Is the result 0, skip if no > goto exittimer > clrf COUNT1 > This is pretty much you do, except you do not need to increment COUNT1 in here -- you do that in the interrupt handler... Here you only check if that reached 10 or not... Does it make any sense? Tamas --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .