Hi all!
Sorry, I was partly on a wrong way. In fact it is a capacitive voltage divider,
and in theory there is no need to read the value at a certain time.
Input leakage current at room temperature is typical 0.1, maximum 50nA. (Values
from 18f45k22 datasheet)
(0.1nA*210us)/30pF=0,7mV
(50nA*210us)/30pF=350mV
Loading the CVD by a capacitor to measure increases the overall capacitance.
However, when looking at te attached diagram...
The pin capacitance is only marked as 5pF, while the ADC-hold-capacitance is
nominal 13.5pF. The hold capacitor is disconnected while the main program is
running.
So, after the CVD settles to a voltage between (cap to measure) and 5pF,
another 13.5pF capacitor is connected, which can alter the voltage quite a bit.
What capacitances did you test? I think values like 1pF, 10pF, 27pF should show
different readings. With values over 100pF there's a chance they do not differ
much. As 100pF can be reached by 2 meters of cable, your board layout could
also be of interest.
GreetsKiste
Am Dienstag, 4. Februar 2020, 21:03:39 MEZ hat 'Oliver Seitz' via jallib
<[email protected]> Folgendes geschrieben:
Hi Rob,
a *very* good point.
The physical magic behind that "measurement" is indeed the fact, that you take
a sample right *within* the acquisition time.
And, as the line
-- adc_conversion_delay = adc_conversion_delay / 10
in adc.jal is commented out, I presume the delay is not 10us and not the
recommended approx. 20us, but like 210us. No chance with a 30pf CVD to measure
anything after such a long wait.
You have to address the ADC module yourself then, for in fact it is an error
you're measuring. The library is meant to not measure errors.
But, when you can't use the library in the first place, I'd highly recommend
reading chaper 19 of the 18f45k22 datasheet. It explains the periperal which is
meant to measure capacitors.
Sorry for not checking the library... I only had the hardware in mind ;-)
GreetsKiste
Am Dienstag, 4. Februar 2020, 19:08:13 MEZ hat RobJ <[email protected]>
Folgendes geschrieben:
Hi Gilles,
I am not sure but if you check the adc library you see this code: ADCON0_ADON
= TRUE -- turn on ADC module
delay_10us(adc_conversion_delay) -- wait acquisition time
ADCON0_GO = TRUE -- start conversion
while ADCON0_GO == TRUE loop -- wait until conversion
completed
So when you start reading the ADC there is first a delay of 10us of acquisition
time and I wonder if this delay influences your measurement.
Kind regards,
Rob
On Tuesday, February 4, 2020 at 8:53:08 AM UTC+1, Gilles BARTHELEMY wrote:
I received my brand new 18F45K22, and tested with it... with exactly same
result. I invariably get:
A0 alone (tied to nothing) = 841A0 tied to ground = 0A0 tied to VCC = 1023A0
tied to B7 (i.e OUT_PIN) = 1015
Also, I commented the line "enable_digital_io()" => same measurement.
I can't see any difference in the way it's done with Arduino, and my code...
Obviously, I miss something, but where ? Hardware maybe ? Or am I simply blind
? ;-)
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jallib/18728482-9fd4-42cb-8b6e-f5c7fa55437b%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jallib/1306732347.447101.1580846551659%40mail.yahoo.com.
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jallib/854806716.928418.1580920422054%40mail.yahoo.com.