Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC analog input impedance question

Status
Not open for further replies.
The original A2D specs called for 2.5K maximum, so that's what I consider the maximum spec for high speed.

No higher than 2.5K - the specification is for maximum speed (and nothing to do with possibly minute leakage).

Hello again,

"No higher than 2.5K - the specification is for maximum speed (and nothing to do with possibly minute leakage)"

But 2.5k is certainly SLOWER than 1.5k, so it cant be for maximum speed either. This is one of the key points to this interesting issue.

10k is certainly slower, 2.5k is faster, but 1.5k is even faster, and 100 ohms is just about as fast as we can get without going too low. That's why i asked you about an application that only requires a 1 second sample time...because that would lead to a very high value using the timing as a criterion. Also, why would you say that 10k is the correct value and then change it to 2.5k later (or vice versa). That's because the 10k is quoted on the date sheet, but it's not the right value either :)

Here's a little math to show what this means...

From the data sheet they state that the time is Tc:
Tc=-Chold*(Ric+Rss+Rs)*K
where K is just a negative constant and Chold is the hold capacitor value. So we simplify to:
Tc=Chold*(Ric+Rss+Rs)*K
making K negative.

Now Ric is 1k and Rss is 7k, and Rs is the resistor in question so we have:
Tc=Chold*(8000+Rs)*K

So the "fastest" time is with Rs=0 (if we allow that or say 100 ohms if we want some resistance) which comes out to;
Tc=Chold*8000*K

That's the fastest we can ever possibly hope to get. So you see the best value is zero ohms (or 100 ohms if you prefer).

But since they quote either 10k or 2.5k as the "maximum" resistance value, that would imply (going by the timing) that they dont want to allow
a time with Rs=22k of:
Tc=Chold*(8000+22000)*K

which of course equals:
Tc=Chold*(30000)*K

and so we ask the question, "What is wrong with that?". The answer is simple, the only difference is we have to allow more time for the acquisition.

So by reason of the timing alone, we see that we are not limited on the resistor value in any way. 10k works, 2.5k works, 100k works, 10megohms works, as long as we allow enough time for the Chold capacitor to charge.

However, by reason of the leakage current, we find the value to be 2.5k or less. Anything higher than 2.5k and the leakage current affects the accuracy.

Also, and this is even more interesting, they show the 2.5k value for both Chold=10pf and Chold=150pf, two widely different cap values!

Oh yeah, with a 10k resistor we get immediately a 2 bit error, even without considering the timing yet. With a 2.5k resistor we only get 1/2 bit error max even without considering the timing.

If you dont understand this by now i dont know what else to tell you. They actually STATE this on the data sheet as well so i cant see why you would want to argue that it's only the timing that counts.

Does this make more sense now?

I've also been searching around on the web but there isnt too much of value to be found, even on the Microchip site unfortunately :-(
 
If you dont understand this by now i dont know what else to tell you. They actually STATE this on the data sheet as well so i cant see why you would want to argue that it's only the timing that counts.

I've never said it's 'only' the timing that counts, but that's by far the most important reason.

As for your timings above it's pretty pointless asking about faster charge/discharge times if you're going to exceed the speed that the A2D is capable of.

If I was buffering, in an actual application, I'd probably just feed the opamp straight in, but with my tutorial hardware I added a series resistor, on the basis that's likely that the port could be set to an output accidentally.

I can't really see why you don't actually TRY a PIC, rather than just using simulators and calculators?.
 
Hello there Nigel,

Well i've used PIC's before on many projects, but i've never tried to test for this kind of thing because if i happen to test a part that is exceptionally good then i'll see less error. The only way to test and be sure is to test a large quantity from different production lots. I cant really do that :)

But rather than we go on and on about this, i'll just state my point in the simplest terms and leave it at that, and you can disagree if you like.

My main point is that when we look at the data sheet we see a max leakage current of 1ua and 1ua causes a 2 bit count error, and that 1ua can be plus or minus over the full temperature range. That's explains the leakage current clearly and that is gleaned from the data sheet on several PIC chips. I am looking at the worst case scenario. So if we input a voltage with a 10k source impedance and we expect to see a count of exactly (hex) 0x0108 for example, we could end up seeing 0x0106 to 0x010A. Since a count of 0x0108 represents a voltage of 1.320 volts (using the 5mv per bit approximation for simplicity), at best we could see anything from between 1.310 to 1.330 volts. So that's a span of 20mv, not too bad, but something to think about. However, with a 2.5k resistor, that same 0x0108 can only vary from 0x0107 and a half to 0x0108 and a half, which is a span of only 1 bit which means the voltage span is only 5mv, so that's 1.3175v to 1.3225v. In a table this looks like this:
Code:
20k, 1.3000 to 1.3400 volts, 40mv span (plus and minus 20mv)
10k, 1.3100 to 1.3300 volts, 20mv span (plus and minus 10mv)
2.5k, 1.3175 to 1.3225 volts, 5mv span (plus and minus 2.5mv) [1/2 bit target]
1.125k, 1.31875 to 1.32125, 2.5mv span (plus and minus 1.25mv)

and that is over the full temperature range as guaranteed by the chip, and that's all just because of the leakage current alone.
Note the entire range with 1.125k is really close to 1.320 volts the expected 100 percent accurate measurement value, (only 1.25mv off either way)..

Now if we consider the timing and our application has a 1 second sample rate (ie a slow process) then either of those values from 1.25k to 20k would meet the timing requirement, but not all of them meets the 1/2 bit accuracy requirement. So we have two target requirements to meet, the leakage pin current and the timing, and some of those values meet both of these requirements and some of them dont (over the full temperature range specified for the chip).
 
...
Yeah a 1ua meter :)

Ouch was that sarcasm? :( I have a 10uA fullscale Avometer here, and assumed someone with better equipment than me (which would not be hard) may have a 1uA meter at hand.

...
Regarding the max condition for the leakage current, you are saying that Microchip doesnt know
how to properly rate their chips so it's ok to second guess what they really meant.
...

Again you seem to be a bit too harsh here! I did NOT say "Microchip don't know how to rate their chips".

I stated a fact that if some spec is in a grey area, Microchip move the "max" spec to be VERY conservative. It suits their M.O. to make very conservative specs. They are also known to change and improve their process technology, but still leave the datasheet worst case specs for the first (lower performing) chips. I've been doing this for enough years to have seen both of those occur many times over.

And as for "second guess what they meant" my point is that it is good engineering practice to TEST and KNOW exactly how the part performs, regardless of whether the datasheet spec is overly conservative, OR the datsheet has repeats of outdated specs from previous process technology.
 
Ouch was that sarcasm? :( I have a 10uA fullscale Avometer here, and assumed someone with better equipment than me (which would not be hard) may have a 1uA meter at hand.

No no, i thought it was just something that was so direct that is appeared to be a little funny that's all. We want to measure a 1ua current so we use a 1ua meter movement. It's not that funny really i guess. A 10ua meter would be nice too yes. I think i would just use a large value resistor and measure the voltage with a 10Meg input VOM. After all, the theory is that the external Rs develops an error voltage due to the resistance itself, so we could measure that directly.
But as i said before, it's not an all telling test to test one single PIC chip. We'd have to test more, probably a lot more, to get a good idea what the stats are. For example, if we tested 100 chips from various production lots and we saw that 90 of them had shown 1ua leakage at the max temperature, we'd be pretty sure the spec should be 1ua. But if we only saw 10 chips show 1ua then we'd know it was a bit under rated. But because of what the data sheets show and how they evolved, it looks like Microchip made a mistake in the first data sheets and then corrected it on some of the data sheets that came later. Did they make a mistake on the 1ua spec too? I cant answer that, but all the data sheets are consistent on this spec unlike the "max source resistance for the ADC" issue.

Again you seem to be a bit too harsh here! I did NOT say "Microchip don't know how to rate their chips".

I stated a fact that if some spec is in a grey area, Microchip move the "max" spec to be VERY conservative. It suits their M.O. to make very conservative specs. They are also known to change and improve their process technology, but still leave the datasheet worst case specs for the first (lower performing) chips. I've been doing this for enough years to have seen both of those occur many times over.

And as for "second guess what they meant" my point is that it is good engineering practice to TEST and KNOW exactly how the part performs, regardless of whether the datasheet spec is overly conservative, OR the datsheet has repeats of outdated specs from previous process technology.

My apologies if i came off as harsh or rude. I was merely stating something that could really happen, ie that Microchip may not know how to rate their chips properly. That is entirely possible. Also possible is that they made some typo's on some of the data sheets. For example, they may have meant "10k pot" instead of just a 10k resistor.
So thinking along these lines, they could also have messed up the max leakage spec in some way. But i also believe it could actually be higher in some cases, but i dont worry about that end of it too much. And all this boils down to second guessing which i really hate to do.

I dont always agree with you but most of the time i do. That goes with Nigel too. And i appreciate both of your inputs on subjects like this and other topics too as i find your ideas and opinions very interesting and usually informative.

Also, as Nigel suggests, i am in fact what some people would call "nit picking". Im looking for the worst that could happen and seeing what i could do about it. That's the way some engineering has to be so some fellows would find this very important but yes others will not be so worried about it. I like to know both angles so that i know for sure what might happen when i use a (for example) larger resistor value then i should. I have done this in the past and accepted the extra error, but at least i know what it might be.

So if you are not interested in the finer detail about the error due to leakage current, then you wont find any of this too interesting or it might seem too overly paranoid. But when the costs rise the risks rise with it. For small 20 dollar projects nobody cares, but when the project costs rise up like a 2 million dollar project, then the company has a lot more to loose and every loose end has to be accounted for. I've worked on small projects, i've worked on very costly projects that involves millions of dollars. The ones that are more costly cause the most worry when there is something that may not be even slightly not right :)
 
Last edited:
Hello again,


Hey i found some more data that is quite interesting. I ran into this by accident because somebody on the Microchip site was complaining about having to use a very very low value (like 200 ohms) on the input of one of the PIC chips to ensure accuracy with the ADC. It was kinda funny really, and the guy was hoping for a non amplifier solution. But in this case i think an amplifier is a necessity.

The line i am talking about now is an extreme example, probably one of the worst input's we'll ever see. It is seen in the PIC24HJ line not the PIC12F675 we were originally talking about, and i have to make this distinction because this other chip is even worse. But this time it's very significant and really can not be ignored.

The ADC in this (or one in this line) chip has the ability to do 12 bit AD conversions, and the power supply limit is 3.3 volts. That is partly what makes this chip more difficult to use. Because of the higher bit accuracy it's easier to be 1/2 bit off, and because of the power supply voltage that brings the voltage value per bit count much lower than before.
The value now comes down to 0.0008056640625 volts per count. So a count of 0x0002 is 0.0008056640625 volts higher than a count of 0x0001.
Now the value for 1/2 bit is down to 0.0008056640625/2=0.00040283203125 volts. So now with a leakage current of 1ua and 10k source resistance we see an error of (a whopping) 25 bit counts!

I wish that was the end of the story, but alas, it's not :)

The max leakage spec for this chip is 8ua !!! Since i calculated the max error above based on 1ua and got a plus or minus 25 bit count error, that will be 8 times higher (max) or it would be equal to a plus or minus 200 bit count error. So now we see an error count range of 0x00C8, so for example when we measure a voltage we might see anything between 0x0100 and 0x01C8. Interestingly, that means an error of 0.1611 volts! So now we start to see the method in the madness really start to stand out :)

So just what does it take to meet the 1/2 bit requirement now?
Well, since one half bit count is equal to 0.00040283203125 volts and the max leakage current is 8ua, we get 0.00040283203125/8ua=50.34 ohms.
Geeze, that's really low now. Much lower than 10k and even much lower than 2.5k.

If we want to allow the same assumed ok error as with the 12F675 chip, then we can multiply this by 4, and that gives us about 200 ohms. But we can really see now how the leakage current starts to degrade the accuracy of the ADC without the proper source resistance.
 
  • Like
Reactions: 3v0
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top