View Full Version : sharp ir sensor analog im using ADC0831
09-26-2008, 04: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?
09-26-2008, 04:19 AM
that depends ! witch IR analog from sharp are you using ,, and what are you trying to read !
09-26-2008, 05:43 AM
Please see the following links for the GP2D12 connection using an ADC0831. This should help get you started either way. Take care.
09-26-2008, 10: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
09-27-2008, 03: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
· AvgReading = 0
· FOR counter = 1 TO 3 ' Average reading
··· GOSUB ADC0831_Reading ' Get 8 bit data from ADC.
··· AvgReading = AvgReading + (ADResult/3)
··· PAUSE 50
· IR_Range = (m /(AvgReading + b)) - k ' Get ADC0831 distance
' Get ADC0831 8 bit data
· 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.
Post Edited (MSDTech) : 9/26/2008 8:34:10 PM GMT
09-28-2008, 11:52 PM
can u explain the steps that you wrote?
09-29-2008, 04:36 AM
These come from the sample code and datasheets on the Crustcrawler web site: