ADC not working
Hey, im working on a robot that will follow people around.· Im using the Eltec pyroelectric sensor to detect people.· For the sensor, i have one pin hooked up to +5V, another hooked up to GND, and the third is the output, ranging from 0-5V, with it normanlly hovering around 2.5V.· When i just hooked the output up to a volt meter, it worked well, staying at around 2.5V, and then jumping up to 3V or down to 2V if i waved my hand in front of it.· However, i need to hook it up to my basic stamp 2, and when i plugged the output of the sensor in to the input of the ADC0831, the results were wierd.· While about half of the values read 120ish, which is right for right around 2.5V input, it would all of a sudden jump up to 255, then down to 30, and be all over the place, even though the output voltage from the sensor stayed within 2.48-2.53V.· the program i'm using for the ADC0831 is:
·DO
··· LOW CS····································· ' activate the ADC0831
··· SHIFTIN AData, Clk, MSBPOST, [noparse][[/noparse]adcRes\9]···· ' shift in the data
··· HIGH CS···································· ' deactivate ADC0831
··· DEBUG ? adcRes····························· ' show conversion result
··· PAUSE 500································· ' wait half of a second
· LOOP········································· ' repeat
· END
can anyone explain why the values the ADC is giving me·are all over the place?· And more helpful, could anyone help me get the ADC0831 to give more consistent readings?
thanks for any help,
max
·DO
··· LOW CS····································· ' activate the ADC0831
··· SHIFTIN AData, Clk, MSBPOST, [noparse][[/noparse]adcRes\9]···· ' shift in the data
··· HIGH CS···································· ' deactivate ADC0831
··· DEBUG ? adcRes····························· ' show conversion result
··· PAUSE 500································· ' wait half of a second
· LOOP········································· ' repeat
· END
can anyone explain why the values the ADC is giving me·are all over the place?· And more helpful, could anyone help me get the ADC0831 to give more consistent readings?
thanks for any help,
max
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
Metron: The extra clock bit in the SHIFTIN statement provides the start cycle for the ADC0831.
I thought you had to send the start bit with the MUX data and then the conversion would begin. The SAR line would signal LOW at completion. Perhaps this is another mode but I thought I would post this link to the datasheet as it is different from the other datasheets.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
Post Edited (metron9) : 7/6/2007 8:02:05 PM GMT
cache.national.com/ds/DC/ADC0831.pdf
you'll find the timing for the ADC0831 and you can see that it just takes one extra clock bit (hence the \9) to get things rolling. As I stated before, I've used that code fragment being cited and I know it works (with the ADC0831 -- not with the others in that family).