schematics of voltage comparator BS2PX
celestino_galan
Posts: 44
Please, could anyone draw for me an schematics of voltage comparator with ·BS2PX.
The battery to measure is 7,2 V.
Thanks
The battery to measure is 7,2 V.
Thanks
Comments
Get_ADC:
· FOR adcVal = 0 TO 255
··· PWM DacOut, adcVal, 1
··· COMPARE 2, result
··· IF (result = 1) THEN EXIT
· NEXT
· RETURN
This will return a value to 0 - 255.· In your case you could multiply adcVal by 28.235 (7200 / 255) to get 0 - 7200 millivolts.· Do that like this:
· mVolts = adcVal */ $1C3C······· ' adcVal x 28.235
Now you can do things like this:
· IF (mVolts < 5500) THEN
··· ' batter is less than 5.5 volts -- do something
· ENDIF
You may need to adjust the numbers a tiny bit -- but this should get you started.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 8/11/2005 1:18:57 PM GMT
¿what is DacOut ?
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Thank you
I did the schema (but with 5% resistors at the moment) a C1 100nK but I don't have result just
0.000 volts is·what could be the problem?
Like the diagram I put 1 wire, throught R1 to + 7.2V (...) of my battery·to P1 and other R2 to VSS of the "Board of Education"
P3 ---· R3
|c1|----VSS
··················· |
P2
Thanks for help
Post Edited (celestino_galan) : 8/10/2005 7:33:02 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
The VSS on P1 is from the battery and the VSS P2,P3 is from the board? isn't it?
Because I used only the board one.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
The code uses P3 to create a voltage on P2 using PW (through a 10K and 0.1 uF) cap; by knowing what the P3 output voltage is the ADC software can know what the voltage on P1 is when the comparator state changes.
The point is that the BS2px does not have an ADC -- one is being created using a trick with the comparator.· See this article (using a BS1 and a hardware comparator) to an explanation: http://www.parallax.com/dl/docs/cols/nv/vol1/col/nv25.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 8/12/2005 1:05:43 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
It is curious that when I Umplug cumpletely (H) the cap it start measuring...
Is my cap wrong?
I have checked in (E) and it is 4,96 V, in (F-G) and it is like 3,2V or so...
Please have a look at the image and if you could see something...
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Now, in Spain everybody is in hollydais and most shops are closed, so I have to wait till september for the capacitor.
...
thanks