> about the "running" switch: the machine have a part that > move alternately all the time (forward - backward) so each > time the moving part is crossing the middle of it's travel it > press a switch OK, that's something that an external interrupt pin would be useful for. When the switch is activated by this moving piece of machinery it can alert the PIC a couple of ways. One is to use the INT flag to store this event. Whether or not the external interrupt is enabled, INTF will be set by a switch transition until your code resets it. You could look for this flag as part of the Timer1 ISR. If it's set, turn a LED on for a Timer1 interrupt period. An 80ms flash is quite noticeable, but you could keep the LED on for the duration of a counter driven by Timer1 IRQs #define led porta,2 ISR ----- bcf led ;turn LED off by default btfss intcon,intf ;test for external event goto process_timer1_irq ;no, carry on with no LED lit bcf intcon,intf ;yes, clear flag bsf led ;light LED bcf tmr1if ;clear Timer1 flag process_timer1_irq ;continue retfie The other way would be to have Timer0 as a counter and set it to 0xFF. A pulse coming into RA4 will cause Timer0 to rollover to 0x00 and set T0IF, which you can check for -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body