Another possibility is to use an op-amp·comparitor. This will cut down on the processing needed to know the result of which voltage is higher. You will only have to monitor a high/low signal.
The ADC would require programming overhead to control the device and read the data.
If you have plenty of programming space then the ADC is a good way to go since Parallax has many examples of using ADC's.
What stamp module do you have?· The BS2Px has an analog comparitor function built in.
I too thought of an op-amp when I saw this post. It's not a straightforward design though, the voltage swing on the input will range from -5V to 5V, or a 10V voltage swing. This will need to be scaled down to a 5V swing (gain of 1/2) and the offset will need to be shifted to 2.5V. There are opamps which will permit you to define the opamp ground to be 2.5V and the Vcc = 5V and Vee = 0 V, this will take care of the offset issue, you just need to configure it for a gain of 1/2.
As Ken mentioned, if you only care about which voltage is higher and not what the actual values are, you can simply use an analog comparator, the comparator has a 1 bit digital output. If the output is 1, the voltage on the V+ terminal is higher, if the output is 0, the voltage on the V- is higher.
Post Edited (Paul Baker) : 7/13/2005 2:38:39 PM GMT
I agree that if the input can swing to -5 v that adds some small headache, however I did not see that the input would swing negative....but a very valid point.
I thought a LM339 quad comparitor was open collector output, but now I don't imediately see that on the spec sheet. Now that has me wondering because I know I have used an open collector op amp comparitor before.....device #...???
Sorry ken, I had some confusion about your post at first, thats why I edited my post. No I don't think he has a -5V input, I just poorly communicated that a normal op-amp (not in comparator mode) would generate that sort of voltage swing when V- exceeds V+. But none of this is an issue with an analog comparator, only if he cares what the value of the difference is.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
The ADC would require programming overhead to control the device and read the data.
If you have plenty of programming space then the ADC is a good way to go since Parallax has many examples of using ADC's.
What stamp module do you have?· The BS2Px has an analog comparitor function built in.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ken
As Ken mentioned, if you only care about which voltage is higher and not what the actual values are, you can simply use an analog comparator, the comparator has a 1 bit digital output. If the output is 1, the voltage on the V+ terminal is higher, if the output is 0, the voltage on the V- is higher.
Post Edited (Paul Baker) : 7/13/2005 2:38:39 PM GMT
I thought a LM339 quad comparitor was open collector output, but now I don't imediately see that on the spec sheet. Now that has me wondering because I know I have used an open collector op amp comparitor before.....device #...???
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ken