sharp ir sensor analog im using ADC0831
enkei
Posts: 23
im using the sharp ir analog and i read that i need the ADC0831 to convert the signal from analog to digital right?
Comments
http://www.parallax.com/dl/docs/prod/acc/SharpGP2D12Snrs.pdf
http://www.parallax.com/dl/docs/cols/nv/vol5/col/nv114.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
'IR Rangefinder Constants from the Sharp datasheet
m CON 3200
b CON 3
k CON 4
Get_IR_Detectors:
· AvgReading = 0
· FOR counter = 1 TO 3 ' Average reading
··· GOSUB ADC0831_Reading ' Get 8 bit data from ADC.
··· AvgReading = AvgReading + (ADResult/3)
··· PAUSE 50
· NEXT
· IR_Range = (m /(AvgReading + b)) - k ' Get ADC0831 distance
RETURN
' Get ADC0831 8 bit data
ADC0831_Reading:
· LOW IR_CS ' Activate the ADC.
· SHIFTIN IR_Data,IR_CLK, ' Get data bits from.
· MSBPOST,[noparse][[/noparse]ADResult\9] ' ADC0831
· HIGH IR_CS ' Deactivate the ADC.
RETURN
Post Edited (MSDTech) : 9/26/2008 8:34:10 PM GMT
http://www.crustcrawler.com/downloads/datasheet/dsadc0831.pdf
http://www.crustcrawler.com/downloads/datasheet/gp2d12.pdf
http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html