Searching \ for '[PIC] How to detect if an input pin gets stuck' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=input
Search entire site for: 'How to detect if an input pin gets stuck'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] How to detect if an input pin gets stuck'
2002\08\06@173941 by Tony Pan

picon face
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


2002\08\06@175859 by sbryden

flavicon
face
What do you mean by "gets stuck at"? Do you mean remains in one state for more
than a certain length of time? If so, test it, store the state, delay, test
again, compare the state.

Maybe you should be more specific about your requirements.

Cheers,
Simon.
---

On Tue, Aug 06, 2002 at 05:32:58PM -0400, Tony Pan wrote:
{Quote hidden}

--
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


2002\08\06@182822 by Jinx

face picon face
> 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


2002\08\06@183053 by Scott Dattalo

face
flavicon
face
On Tue, 6 Aug 2002, Tony Pan wrote:

> 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?


What's driving the input normally? SBO's in an RTU have to deal with this
issue. I've seen several designs involving resistors, bidirectional I/O
lines, diodes, capacitors, etc.

If you can route the input to two  I/O's and can momentarily make one of
them an output, then there's a good chance you can monitor a stuck line
(or detect a damaged input pin).

Scott

--
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


2002\08\06@200519 by Tony Pan

picon face
Sorry that I wasn't specific enough.

I monitor the input pin. The input voltage normally is high all the time. If
it's high, my program runs. If it gets low, I terminate the program.

Now I need to know for sure that the pin is high because the input voltage
is high, not because it gets not stuck at high due to microelectronic
failure. If such failure occurs, even if the input voltage becomes low, the
input bit would still be high and I would not know the differences. I detect
such failure, I was told to do a periodic self-check to detect if the pin
gets stuck.

By the way, I don't have a spare pin to implement hardware solution. All the
detection and mitigation must be done in software.

My question is, how to do it? The standard auditor said they are not allowed
to tell me how to do it. They can only tell me if me solution is acceptable.

Thanks.


{Original Message removed}

2002\08\06@201539 by Spehro Pefhany

picon face
At 08:01 PM 8/6/02 -0400, you wrote:


>By the way, I don't have a spare pin to implement hardware solution. All the
>detection and mitigation must be done in software.
>
>My question is, how to do it?

If you set the input pin to output, drive it low and then read it, you can
tell if it is *really* stuck to Vdd, as the PIC reads the actual pin state
rather than the output latch. You might have to beef up your
external drive circuit to guarantee it has more drive than the internal
n-channel transistor.

Connecting a small capacitor on the pin might allow you to get an idea
that is more accurate (drive it low, then wait- with a time-out- for the
pin to come high with your external pullup (open-drain or collector drive).
If the pin fails to come high, or comes high TOO fast, then you have
a problem. Don't make the time constants more fussy than you have to,
the thresholds vary on the inputs etc. Homework.

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
spam_OUTspeffTakeThisOuTspaminterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
9/11 United we Stand

--
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


2002\08\07@042409 by Alan B. Pearce

face picon face
>>By the way, I don't have a spare pin to implement hardware solution. All
the
>>detection and mitigation must be done in software.
>>
>>My question is, how to do it?
>
>If you set the input pin to output, drive it low and then read it, you can
>tell if it is *really* stuck to Vdd, as the PIC reads the actual pin state
>rather than the output latch. You might have to beef up your
>external drive circuit to guarantee it has more drive than the internal
>n-channel transistor.
>
>Connecting a small capacitor on the pin might allow you to get an idea
>that is more accurate (drive it low, then wait- with a time-out- for the
>pin to come high with your external pullup (open-drain or collector drive).
>If the pin fails to come high, or comes high TOO fast, then you have
>a problem. Don't make the time constants more fussy than you have to,
>the thresholds vary on the inputs etc. Homework.

Also have a series resistor from the external circuit to the pin. This will
serve three purposes.

1. It protects the pin from ESD damage or other damaging transients coming
from the external circuitry. To maximise the protection I would put the
resistor as close to the processor pin as practical to reduce static and EMC
pickup, but this is a personal preference.

2. It gives a time constant for the capacitor charge mentioned in the quoted
piece above.

3. It means that when you change the pin to output mode, the output has an
impedance to drive which will allow the pin to change state so you can see
that state change during your test. If the impedance is too low then the
output driver will get damaged by attempting to supply too much current, and
damage the processor chip, rather defeating the test :) I would be looking
at using a resistor in the 100 ohm to 1k range, but possibly going higher to
help item (2). However you do not want to go too high, else you will get
problems of the type mentioned in item (1).

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\08\07@063715 by ISO-8859-1?Q?Ruben_J=F6nsson?=

flavicon
face
One way to do it is to use an output with a pulse/pattern,
connected through the sensing device (switch, photo sensor...)
connecting it back to the input. If the switch is closed the
pulse/pattern should be available on the input. If the
pulse/pattern isn't on the input you know that the switch isn't
closed, isn't working or that the circuit isn't working, which
should be a safe state (not dangerous state - motors or relays
off).

To improve safety, the sensing device should invert the signal
(photo sensor) so that a simple short circuit on the input and
output wires also can be detected.

To improve safety even more, the input should be doubled (two
sensors) and both should be working in parallell to be able to
set the device in the dangerous state.

What kind of device is it for?

Ruben


{Quote hidden}

==============================
Ruben Jvnsson
AB Liros Electronic
Box 9124, 200 39 Malmv, Sweden
TEL INT +46 40142078
FAX INT +46 40947388
.....rubenKILLspamspam@spam@pp.sbbs.se
==============================

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\08\07@072935 by Wouter van Ooijen

picon face
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 removed}

More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...