SX A/D conversion
jmokie
Posts: 13
First time SX user, not familiar with machine code, former STAMP user and a electronics hacker needs help.·
I'm trying to use the a/d method in the sample code for the SXB on an SX28AC to read the output of a line sensor output to do PID control on the motors of my robot.· I'm using the Vishay TCRT5000 reflex detector.· The code is straight out of the example
I am trying to scale the output in a usable range.· The ckt is attached.
Right now with the resistors shown, the transistor·collector reads:
0.181 vdc with white resulting in .48 ma
3.08 with black resulting in .192 ma
Which sounds like a good range. But the a/d, monitored with the Watch/Poll command in the Debug mode,·starts counting at 0 or 1 @ 0.3vdc on the·collector·and reaches 240 @2.67 vdc, which is really dark grey.·
I would like to have 0·counts = white and 255 = black
My sensor has the emitter tied to gnd on the ckt board, so putting another resisor in the emitter ckt means more cut-n-kludge.· Hoping for some advice that will give a better range in counts.
I'm trying to use the a/d method in the sample code for the SXB on an SX28AC to read the output of a line sensor output to do PID control on the motors of my robot.· I'm using the Vishay TCRT5000 reflex detector.· The code is straight out of the example
I am trying to scale the output in a usable range.· The ckt is attached.
Right now with the resistors shown, the transistor·collector reads:
0.181 vdc with white resulting in .48 ma
3.08 with black resulting in .192 ma
Which sounds like a good range. But the a/d, monitored with the Watch/Poll command in the Debug mode,·starts counting at 0 or 1 @ 0.3vdc on the·collector·and reaches 240 @2.67 vdc, which is really dark grey.·
I would like to have 0·counts = white and 255 = black
My sensor has the emitter tied to gnd on the ckt board, so putting another resisor in the emitter ckt means more cut-n-kludge.· Hoping for some advice that will give a better range in counts.
Comments
I'm not following what you want. You're not going to get consistance values everytime.
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
"People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
·
Is there any place that tells me the voltage range equivalent at Rb.1 for 0-255 counts?