Searching \ for '[PIC]: Pin impedance' 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/devices.htm?key=pic
Search entire site for: 'Pin impedance'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Pin impedance'
2001\04\25@192121 by David VanHorn

flavicon
face
I've hit an Funky problem.

For many reasons, I'm discharging a 0.1uF cap through a selectable
resistance, using a pic output to discharge it,  and a pic input to sense
when it's done.

I first discharge the cap through a known resistance to get a nominal time
value.
Then I discharge through the variable resistance, and I had expected that
4.7k would take roughly 5x as long to discharge as a 1k
would.  Unfortunately, this is not the case.

Discharging through various multiples of 1k, here's the timing values I get:

Test run:
Capsense value (nominal "1") 07Bh
Set     Time    Delta
0       00A             All shorted
1       079     6F      Note that the delta is roughly the same as the nominal value,
as you'd expect.
2       0E2     69
3       12D     48      However, as R increases, the delta shrinks rather a lot.
4       187     5A
5       1B7     30
6       1EA     33
7       214     2A
8       241     2D
9       25C     1B
A       27A     1E
B       292     18
C       2AD     1B
D       2C2     15
E       2CE     0C      (anomaly?)
F       2E3     15      All open

I expected to be able to divide the time by the nominal value, and get 0-15
out of it, but obviously that's not working very well.

The charge routine runs through the fixed resistor, and charges FAR longer
than required, before each discharge,  in order to get up into the very
flat part of the charge curve, so that the measurements would be repeatable.

Is this showing me something unusual about PIC output pin impedances, or ???

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\04\25@194817 by Alice Campbell

flavicon
face
Hi dave,

try running the whole thing into the pic through an opamp set
up as a follower.  an amazing difference.

alice
BTDT(been there done that)

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2001\04\25@224514 by David VanHorn

flavicon
face
At 04:48 PM 4/25/01 -0700, Alice Campbell wrote:
>Hi dave,
>
>try running the whole thing into the pic through an opamp set
>up as a follower.  an amazing difference.

Not this round. I'd have to park the chip in hyperspace.
--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2001\04\25@224942 by Bob Blick

face
flavicon
face
At 06:08 PM 4/25/2001 -0500, you wrote:
>I've hit an Funky problem.
>
>For many reasons, I'm discharging a 0.1uF cap through a selectable
>resistance, using a pic output to discharge it,  and a pic input to sense
>when it's done.
>
>I first discharge the cap through a known resistance to get a nominal time
>value.
>Then I discharge through the variable resistance, and I had expected that
>4.7k would take roughly 5x as long to discharge as a 1k
>would.  Unfortunately, this is not the case.

Hi Dave,

Are you using port C? Port C is funky that way.

-Bob Blick

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2001\04\25@231039 by David VanHorn

flavicon
face
>
>Are you using port C? Port C is funky that way.

Only A and B on this pic.

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2001\04\25@233456 by Bob Blick

face
flavicon
face
>>Are you using port C? Port C is funky that way.
>
>Only A and B on this pic.

OK, are you using RA4 as the input? I have a grudge against PIC Schmitt
Trigger inputs, the thresholds are unpredictable.

Cheers,

Bob

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2001\04\26@032257 by Michael Rigby-Jones

flavicon
face
{Quote hidden}

Can't answer this one directly, but I spent about a week trying to get this
method to work accurately for a thermistor measurement (although I was
charging the cap, and linearity over the supply range was the problem I
had).  Gave up in disgust in the end.  As Bob says, the Schmitt trigger
input on RA4 is a little unpredicatble.  Using a comparator to sense the
discharge point gives a huge leap in accuracy.

Looking at your figures, the delta seems to stabilise around 15-1B range as
the resistance increases.  The lower value resistanaces obviously dump a
higher peak current through the port, I'm wondering if this upsets the
switching point of your sense pin somehow?  Are you ensuring the cap is
fully charged before starting your discharge cycle?

A possible fix might be to introduce a fixed resistance in series with your
variable one which would move the results down towards the more linear
region.  Obviously the PIC would have to take into account the offset.

Regards

Mike

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu


2001\04\26@050504 by Roman Black

flavicon
face
David VanHorn wrote:
>
> I've hit an Funky problem.
>
> For many reasons, I'm discharging a 0.1uF cap through a selectable
> resistance, using a pic output to discharge it,  and a pic input to sense
> when it's done.

First, are you charging and discharging through
separate pins? They may have different properties.

The PIC output low (current sink) saturation
voltage varies with current. By varying resistances
there is a variance in current and also discharge
curves. The output sat curves are in the datasheet.

Maybe try using a second series resistor
so your variable range is only 20% of the total,
not 95% of the total. This should flatten it out
a bit, also maybe try using higher value resistors
to get the currents lower.
-Roman

--
http://www.piclist.com hint: To leave the PICList
TakeThisOuTpiclist-unsubscribe-requestEraseMEspamspam_OUTmitvma.mit.edu


2001\04\26@061106 by Peter L. Peres

picon face
What's your limiting resistor when discharging ? It should be fairly large
(current under 1mA). The curve is not linear with time but you already
know that. The intersect point with the threshold voltage will not change
linearly with R, because of the shape of the curve. The RC timeconstant
values are only valid for 10%-90% standard step measurements. If you want
a really linear input wire a NPN as a Miller integrator with your
(smaller) cap and use that with your present circuit. I don't think that
$0.01 for a BC547B will bankrupt your project. ;-) You can use RBPU for
pullup. I'd recommend the double slope approach using a Schmitt Trigger
input pin...

Peter

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspamTakeThisOuTmitvma.mit.edu


2001\04\26@114650 by David VanHorn

flavicon
face
At 08:31 PM 4/25/01 -0700, Bob Blick wrote:
> >>Are you using port C? Port C is funky that way.
> >
> >Only A and B on this pic.
>
>OK, are you using RA4 as the input? I have a grudge against PIC Schmitt
>Trigger inputs, the thresholds are unpredictable.

Nope, I sidestepped that landmine.  Though I am using RA4, it's only used
as an output, pulling low.

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestEraseMEspam.....mitvma.mit.edu


2001\04\26@114841 by David VanHorn

flavicon
face
>
>Can't answer this one directly, but I spent about a week trying to get this
>method to work accurately for a thermistor measurement (although I was
>charging the cap, and linearity over the supply range was the problem I
>had).  Gave up in disgust in the end.  As Bob says, the Schmitt trigger
>input on RA4 is a little unpredicatble.  Using a comparator to sense the
>discharge point gives a huge leap in accuracy.

I'm using RB5 to sense the cap, the comparator's busy on other stuff.
A4 is used, but only to discharge.


>Looking at your figures, the delta seems to stabilise around 15-1B range as
>the resistance increases.  The lower value resistanaces obviously dump a
>higher peak current through the port, I'm wondering if this upsets the
>switching point of your sense pin somehow?  Are you ensuring the cap is
>fully charged before starting your discharge cycle?

Yes. I scoped the cycle, put in enough time to flatten it, then doubled it.
So, it's charged to a very repeatable point.

>A possible fix might be to introduce a fixed resistance in series with your
>variable one which would move the results down towards the more linear
>region.  Obviously the PIC would have to take into account the offset.

I've switched up to 10k resistors, and I'm going to run another sweep on
the values.

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspammitvma.mit.edu


2001\04\26@115042 by David VanHorn

flavicon
face
>
>First, are you charging and discharging through
>separate pins? They may have different properties.

I am charging through the same pin, discharging through different pins, and
measuring with two of three pins.
In the AVR, I could measure through the same pin I'm discharging with, and
then I could do all the measuring on one pin.


>The PIC output low (current sink) saturation
>voltage varies with current. By varying resistances
>there is a variance in current and also discharge
>curves. The output sat curves are in the datasheet.

Apparently this is what's giving me trouble.

>Maybe try using a second series resistor
>so your variable range is only 20% of the total,
>not 95% of the total. This should flatten it out
>a bit, also maybe try using higher value resistors
>to get the currents lower.
>-Roman

Thought about it, but it does make sensing the difference more challenging.

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestEraseMEspamEraseMEmitvma.mit.edu


2001\04\26@115656 by David VanHorn

flavicon
face
At 11:54 AM 4/26/01 +0300, you wrote:
>What's your limiting resistor when discharging ?

Min value was 1k.
With the cap charged to 5V, that would give a max of 5mA


>  It should be fairly large
>(current under 1mA). The curve is not linear with time but you already
>know that.

Yes, but time constant = R*C. Even though it's non-linear, 2R crosses the
same threshold in twice the time.


>The intersect point with the threshold voltage will not change
>linearly with R, because of the shape of the curve. The RC timeconstant
>values are only valid for 10%-90% standard step measurements.

??? Never seen that expressed in a formula



>If you want
>a really linear input wire a NPN as a Miller integrator with your
>(smaller) cap and use that with your present circuit. I don't think that
>$0.01 for a BC547B will bankrupt your project. ;-) You can use RBPU for
>pullup. I'd recommend the double slope approach using a Schmitt Trigger
>input pin...

Not a bad idea, but the boards are already done.
This was working, but now using the MPLAB ice, it's broken.
I didn't expect such variability in the how the pins act.

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspam_OUTspamKILLspammitvma.mit.edu


2001\04\27@045124 by Roman Black

flavicon
face
David VanHorn wrote:
>
> >
> >First, are you charging and discharging through
> >separate pins? They may have different properties.
>
> I am charging through the same pin, discharging through different pins, and
> measuring with two of three pins.
> In the AVR, I could measure through the same pin I'm discharging with, and
> then I could do all the measuring on one pin.
>
> >The PIC output low (current sink) saturation
> >voltage varies with current. By varying resistances
> >there is a variance in current and also discharge
> >curves. The output sat curves are in the datasheet.


David, at the risk of sounding like a "bucket engineer"
have you thought about just measuring your results and
then using a lookup table?? Problem solved, and the
real world approach also compensates for all the
other variables that affect it. :o)
-Roman

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


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