> I am writing a safety-related software and need to detect if > an input pin gets stuck at 1 (or 0). Could any one tell me how > to do it in the software? "Stuck" implies the pin remains at 1 for a certain length of time, (how long ?) so you could use the pin test to reset the timer btfsc pin return clrf tmr1l ;or here you could clear WDT if using WDT timeout clrf tmr1h if the pin doesn't go to 0 before the timer rolls over then an IRQ or WDT timeout is generated, or you could test tmr1if. You don't give enough info for many more suggestions -- 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