piclist 2001\04\30\003905a >
Thread: How to convert Resistance to digital data directly
www.piclist.com/techref/mems.htm?key=data
flavicon
face BY : David VanHorn email (remove spam text)



>
>Good points.
>
>I'm curious how this "2-instruction loop" is implemented. How can this be done
>AND count the number of cycles? I know one way, but from the context I'm sure
>that's not being done.

With the timer running, and the cap discharging:

Here: BTFSC     PORTB,Pin
        goto    Here


>To achieve the +/- 2% repeatibility to which Bob alludes you'll have to be
>extremely careful in keeping track of ALL cycles and ALL voltages.

What I'm referring to isn't a 2% sort of thing.
The discharge time is arbitrarily doubling due to an apparent change in the
low logic threshold.


>First the voltages: you've got ground, Vcc, and the two switching
>thresholds of
>the I/O pin (the low-to-high and the high-to-low).
>
>Others here have more experience than me with the PIC I/O thresholds. But one
>thing I'd comment on is that the thresholds are sensitive to variations in
>Vcc.

I'm aware of that, but I'm not seeing anything significant on VCC.
This is all happening on an MPLAB ICE, so I'm calling uChip tomorrow.


>This will give you a good idea of the thresholds at a given vcc. In your lab
>notebook, you may wish to record the results for a few different Vcc's
>(e.g. 4.5, 4.75, 5.0, 5.25 etc)

Should all be factored out, as long as the thresholds don't change between
measurements.
That's the problem I'm hitting.
The low threshold appears to go absurdly low, practically to zero on occasion.

{Quote hidden}

A bit more complicated than that.
I have three pic pins connected to the cap.
One has a fixed 10k ref value.
The other two have 0-150k jumperable in 10k increments.
There is no charge or discharge except through a pic pin.



>2) Begin charging the cap. Make sure it's fully charged! The pic I/O pin has
>fairly low output impedance, so should charge the cap in a much shorter time
>than your unknown resistor.

BTDT, I'm WAY into the flat part of the curve.
I'm using a pin through a 10k, which is my known component in the system.
That pin then is used to determine the discharge through the 10k, which
factors out the cap value.
Then I measure discharges through the active pins with 0-150k in 10k steps,
and divide by the time observed in the reference measurement.


>3) At the same time you change the output pin that was charging the cap to an
>input, start a timer. Note that the I/O pin that was charging the cap is now
>monitoring the cap's voltage.

I could charge through the discharge resistors, but that could take up to
15x, and I have no way (yet) to know what's jumpered in. So, I charge
through my 10k fixed R.


>4) When the PIC I/O goes low, stop the timer.

This is where the problem comes in.

>------
>
>Sounds easy enough.
>
>But to get repeatable results you'll need an accurate counter. I don't know
>which PIC you're using. If you're using one with the Timer 1 peripheral (like
>the F877) then the timer is trivial.

'876 running at 1 MHz.
There's a preset routine that starts the counter fast, and re-reads the
standard 10k, changing the prescaler till it gets an 8 bit value, assuring
that the granularity, and the odd instruction cycle difference won't be a
problem.


--
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 listservTakeThisOuTspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


<4.3.2.7.2.20010429231128.00e13870@mail.cedar.net>

In reply to: <Pine.LNX.4.21.0104291555500.2876-100000@tempest2.blackhat. net>
See also: www.piclist.com/techref/mems.htm?key=data
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) How to convert Resistance to digital data directly

month overview.

new search...