Need source code to create voltmeter using built-in ADC... help please!
Mach3Maelstrom
Posts: 7
Hey all! I'm fairly new with the chip itself and need some quick assistance for a business project that involves reading the voltage drop across a resistor at a given time.
I'm using the C compiler because I know C language MUCH better than Basic. I just want to know how to call upon the VDC to assign the voltage drop value at a given time to a float variable.
Can someone assist me with this? Time is of the essence and while I'm learning fast, it may not be fast enough [noparse]:([/noparse]
I'm using the C compiler because I know C language MUCH better than Basic. I just want to know how to call upon the VDC to assign the voltage drop value at a given time to a float variable.
Can someone assist me with this? Time is of the essence and while I'm learning fast, it may not be fast enough [noparse]:([/noparse]
Comments
But, I've got some info and Spin code here:
http://www.rayslogic.com/propeller/Programming/ADC.htm
Also, as newbie as a question this may be, but instead of the Sigma-Delta ADC couldn't I build a full-wave rectifier with a cap to smooth the signal? If not, just let me know. The AC signal is going to be wall current (the project is for a home appliance) and so I'd like to know as soon as you can let me.
[noparse][[/noparse]EDIT:] Forgot to mention the important fact that I will be testing the voltage coming off of the *common* lead (aka the voltage will be ~0) and NOT the hot lead (aka the voltage being +- 120V). That way you know I'm not killing myself doing this project lol.
Post Edited (Mach3Maelstrom) : 4/27/2009 3:03:48 PM GMT
It would be much better, if you want to measure current, to use a current transformer or a Hall-effect current sensor. Both provide galvanic isolation between the mains and your sensing circuit.
-Phil
You will still need some kind of ADC. A full-wave rectifier and filter cap just changes the AC to DC.
"But it seems to only display how to graph the function and I can't find where it declares the y-values in the code"? Do you mean the Microphone2VGA demo? There the assembly routine does its own graphing.
I had been warned regarding the latter, so I figured I would utilize a linear optocoupler to fix the voltage differential problem.
I'm unfamiliar with ADCs and how to use them, I suppose. I was under the impression that the lack of floating variables was the reason I couldn't use the Basic Stamp, but I've been informed that I can make the math all integers as long as I kept proper "bookkeeping" throughout the code. Can someone shed light on that issue?
And once again, thank you everyone for helping me in this matter! Especially Phil and Mike for convincing me to change the schematic. (P.S. I can just build this circuit in a lab and have no qualms, right? If so, in this system, is Vdd a separate supply or can I get it elsewhere more suitable in appliances?)
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
-Phil
The board layout would need to be·considered to carry the isolation through.
http://www.allegromicro.com/en/Products/Part_Numbers/0756/
There are quite a few similar items knocking around as well.
D