piclist 2001\01\19\043553a >
Thread: Reading Outputs as Inputs
picon face BY : Bob Ammerman email (remove spam text)

> Bob Ammerman wrote:
> >
> > > Barry,
> > >
> > > I am trying to avoing the adding of a pull-up.  Till now, the pin had
> > > purpose.  It is not connected to any circuitry except for a header.
Now I
> > > want to use that pin as an input to allow the user to select a setting
> > > shorting or not shorting the header to power or ground.
> >
> > Ah, the light goes on.
> >
> > Ok, so the pin is connected to either ground, high or nothing.
> >
> > I am assuming that the pin's connection does _not_ change while the
{Quote hidden}

> > float.
> >
> > done:
> >
> > Note that this tecnhique lets you detect you three possible states for
> > pin (high, low, float).
> >
> > At worst, you are only driving it for an instruction time or two against
{Quote hidden}


I agree that this is _not_ a really good idea, but it isn't as awful as not
being able to perform a required function at all. The original post
indicated that no changes to the board were permitted.

Also, we have to think about the consequences of driving into a short. There
are three that I can think of:

1: Meeting Voh / Vol specs. This isn't  an issue here, or course.

2: Idd spike with attendent Vdd glitch with all kinds of possible trouble -
that's why I mentioned checking for this.

3: Chip damage. This is a thermal issue.

The first question you have to ask: what is the short circuit current.
Looking at a 16F84A as an example (I don't recall what the original poster
was using):

Max output current (low) = 25ma

Max output current (high) = 20ma

Vol @ 8ma = 0.6V (max)

Voh @ 3ma = Vdd - 0.7V (min)

Ok, from the latter two values we can compute a max value for Rdson of the
output FETs of:

0.6V/8ma == 75 ohms (low side)
0.7V/3ma == 233 ohms (high side)

Given that Microchip isn't in the business of giving away silicon, and that
they probably have a pretty good handle on their process, I'm going to go
out on a limb and assume that the minimum Rdson is at least 33% of the max


Rdson (min, low side) = 25 ohms
Rdson (min, high side) = about 80 ohms

Lets take the worst case, the low side.

5V / 25 ohm = 200 ma

Assume we use this code (to minimize the drive time):

   movlw   TRISB,FSR    ; Point at TRIS register
   bcf    PORTB,x             ; Get ready to drive a low
   bcf    INDF,x                  ; Start the short in this instruction
   movf PORTB,W           ; Get the value
   bsf    INDF,x                 ; Clear the short in this instruction
   <now check the value in PORTB at our leisure>

Thus, we are in the shorted condition for only 2 instructions, or 2
microseconds at 4Mhz (the clock rate is another assumption, of course).

So, we are drawing 200ma for 2 microseconds.

Thermally this is the same as 20ma for 20microseconds.

But, we are allowed to draw 20ma indefinitely.

So, unless the thermal time constant of the output driver is less than about
20microseconds, we are not going to thermally damage the output.

Now, I admit that some of the above analysis is not 'worst case', but it is
reasoned, not just a 'try it and see if it works' attitude.

And no, I didn't do this analysis before posting my orignal response, my
answer was based on a 'seat of the pants' engineering judgement (ie: I've
been here before).

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level

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

<00fb01c081fa$67f217a0$16e9c540@sciencekit.com> 7bit

See also: www.piclist.com/techref/microchip/ios.htm?key=input
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Reading Outputs as Inputs

month overview.

new search...