h4ctic wrote: > Right, have to use interrupt. So will it be like, choose pulse edge, > enable interrupt on say rising edge and then turn ON LED? But how to > turn it OFF when square wave pulse is low? What are you trying to accomplish? Why do you need anything more than a transistor to control a LED on/off from a digital signal? Something isn't making any sense. > bsf option_reg, intedg ; select interrupt on > rising edge of b0/int pin > bsf intcon, int0ie ; enable rb0/int external interrupt > intchk btfss intcon, rbif ; check interrupt flag bit > goto intchk > movf portb, 1 ; end mismatch condition > bcf intcon, rbif ; clear interrupt flag > bsf portb, 1 ; turn on led > btfss intcon, rbif ; check rbif bit > bcf portb, 1 ; turn off led > retfie At least you should syntax check your code before asking others to look at it. This mess would give you lots of errors and warnings because opcodes can't start in column 1. This simulator is a good tool for checking out code like this. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist