sx used as a comparator?
infinkc
Posts: 9
can the sx be used as a comparator(LM339)? any code examples? i have an input that is around 2.5v and want that to compare with +5v and output a low signal.
TIA!
TIA!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Post Edited (Chris Savage (Parallax)) : 2/14/2007 9:35:14 PM GMT
The RB1 and RB2 port pins can be configured as comparator input pins, and the RB0 port pin can optionally be configured as the comparator putput pin (see the SX data sheets for more details).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
And of course you also could configue an R/C digital to analog onverter on the SX, and let that be one of the comarator inputs. Then with very simple software you can chose the trigger level anywhere from 0 to 5 volts.
In fact, if you wanted to get cute, you could even use the one comparator input AS the DAC. Done this a number of times.
Cheers,
Peter (pjv)
MyPin PIN RB.0 INPUT CMOS
This will set the threshold voltage to 2.5 (if running at 5V), so if the voltage goes from 5 to 2.5 you might or might-not get a change in the input.
It would be better to run the voltage into a voltage divider (two resistors) to get the levels down.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman