PIC 10F206 precision"A-D" hack?
|
|
Conundrum
|
Tue Jun 23 2009, 06:51AM
|
|
|
Registered Member #96
Joined: Thu Feb 09 2006, 05:37PM
Location: CI, Earth
Posts: 4061
|
Hi all.
Have been looking at the datasheet/appnotes and it seems that there is a little-used feature of the 10F206, such that if you sacrifice two GPIO lines (GP0 and GP1) its possible to make GP1 do double duty as a primitive yet effective PWM based A-D.
The basic idea is to set up GP1 as a digital output charging a capacitor via a constant current (JFET) from a spare electret microphone and switching to High Z mode after the pulse is complete and do the check, then if comparator detects any increaseregister the value and output on GP2. To discharge the capacitor just ground GP1 for a few us, as the JFET should conduct enough leakage current to work, or add a 10K resistor from GP1 to ground and compensate in the code.
What you will get is a nice well behaved A-D that is fairly slow but should work for most applications where a conventional (expensive!) PIC would be too bulky and/or heavy such as balloon dataloggers and model aircraft telemetry transmitters.
The same code should also work for most accelerometers using the "round robin" switching method such as the KXPA4 to select the required axis, and the sensors on some Apple Mac laptop boards. :) code to follow.
-A
|
Back to top
|
|
Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob
|
|
Powered by e107 Forum System
|