Can't be done in software alone, but you coudl: connect your input via a suitable resistor, connect a small capacitor between the pin and ground. Now make the pin a high output for a short time, make it input and read it: it should be high. Same for low. Of course this setup slows the response of the pin to the external input. Depending on various things mostly beyond your conbtrol (leakage currents etc) you could get by without the cap. Wouter van Ooijen -- ------------------------------------ http://www.voti.nl PICmicro chips, programmers, consulting > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Tony Pan > Sent: Tuesday, August 06, 2002 10:33 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC] How to detect if an input pin gets stuck > > > Hi, > > 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? > > Thanks alot! > > Tony > > -- > 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 > > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.