PDA

View Full Version : sharp ir sensor analog im using ADC0831



enkei
09-26-2008, 05:02 AM
im using the sharp ir analog and i read that i need the ADC0831 to convert the signal from analog to digital right?

Amaral
09-26-2008, 05:19 AM
that depends ! witch IR analog from sharp are you using ,, and what are you trying to read !

Chris Savage
09-26-2008, 06:43 AM
Please see the following links for the GP2D12 connection using an ADC0831. This should help get you started either way. Take care.

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

enkei
09-26-2008, 11:50 AM
on the first reply i said is analog, then on the second reply i do have this file can you show me some examples how will i communicate with the SHARP ir in basic stamp code an example of writing i mean

MSDTech
09-27-2008, 04:28 AM
This is what I use with this setup. The Pins on the ADC0831 are IR_CS, IR_Data and IR_CLK for the chip select, data and clock respectively.

'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,[ADResult\9] ' ADC0831
HIGH IR_CS ' Deactivate the ADC.
RETURN

Post Edited (MSDTech) : 9/26/2008 8:34:10 PM GMT

enkei
09-29-2008, 12:52 AM
can u explain the steps that you wrote?

MSDTech
09-29-2008, 05:36 AM
These come from the sample code and datasheets on the Crustcrawler web site:

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