ADC Problem

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
5 postsPage 1 of 1
5 postsPage 1 of 1

ADC Problem

Post by ets » Wed Dec 29, 2010 10:24 pm

Post by ets
Wed Dec 29, 2010 10:24 pm

Hi !

I just bougth the RB-110 and I have a hard time using the ADC. I tried to use the code that was given with the library and also the code I found in that thread : http://robosavvy.co.uk/forum/viewtopic.php?p=27654

The problem is that no matter what is connected (or not connected) to the pins of the adc, the output is 1023 (when unsigned) and -1 (when signed) (and it is 32767 for the second code). Sometimes, the port #7 output something different like -1.

Does anyone know what could be wrong (bios settings, spi settings, etc) ? I read that it could be burned. If so, does anyone has a rapid alternative solution (a chip I could buy and plug and not that hard to use) ?

Thanks !

Ps: Os: Ubuntu 2.6.34.1-vortex86-sg
Hi !

I just bougth the RB-110 and I have a hard time using the ADC. I tried to use the code that was given with the library and also the code I found in that thread : http://robosavvy.co.uk/forum/viewtopic.php?p=27654

The problem is that no matter what is connected (or not connected) to the pins of the adc, the output is 1023 (when unsigned) and -1 (when signed) (and it is 32767 for the second code). Sometimes, the port #7 output something different like -1.

Does anyone know what could be wrong (bios settings, spi settings, etc) ? I read that it could be burned. If so, does anyone has a rapid alternative solution (a chip I could buy and plug and not that hard to use) ?

Thanks !

Ps: Os: Ubuntu 2.6.34.1-vortex86-sg
ets offline
Newbie
Newbie
Posts: 2
Joined: Wed Dec 29, 2010 10:15 pm

Post by josh » Thu Dec 30, 2010 2:07 am

Post by josh
Thu Dec 30, 2010 2:07 am

hi,

you find the code that is useful for RB-100.

you could add the function roboio_SetRBVer(RB_110) before the function spi_Initialize().

And try it again.
hi,

you find the code that is useful for RB-100.

you could add the function roboio_SetRBVer(RB_110) before the function spi_Initialize().

And try it again.
josh offline
Robot Builder
Robot Builder
Posts: 21
Joined: Wed Apr 07, 2010 1:43 am

Post by ets » Thu Dec 30, 2010 2:42 am

Post by ets
Thu Dec 30, 2010 2:42 am

josh wrote:hi,

you find the code that is useful for RB-100.

you could add the function roboio_SetRBVer(RB_110) before the function spi_Initialize().

And try it again.


Already did. My code starts with roboio_SetRBVer(RB_110)
josh wrote:hi,

you find the code that is useful for RB-100.

you could add the function roboio_SetRBVer(RB_110) before the function spi_Initialize().

And try it again.


Already did. My code starts with roboio_SetRBVer(RB_110)
ets offline
Newbie
Newbie
Posts: 2
Joined: Wed Dec 29, 2010 10:15 pm

adc problem

Post by suv23 » Thu May 05, 2011 10:47 am

Post by suv23
Thu May 05, 2011 10:47 am

this is my sensor program..this program only can read value 1023..after the value have remove from textbox and read again, the same value will appear although the range of sensor to detect was change..

Imports RoBoIO_DotNet.RoBoIO ' import the RoBoIO .Net Warper
Public Class Form1
Dim adc_data As Integer
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (spi_Init(SPICLK_21400KHZ) = False) Then ' init SPI lib for accessing the A/D converter
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
adc_data = adc_ReadChannel(ADC_USECHANNEL0, ADCMODE_RANGE_2VREF, ADCMODE_UNSIGNEDCODING)
TextBox1.Text = adc_data
End Sub
End Class
this is my sensor program..this program only can read value 1023..after the value have remove from textbox and read again, the same value will appear although the range of sensor to detect was change..

Imports RoBoIO_DotNet.RoBoIO ' import the RoBoIO .Net Warper
Public Class Form1
Dim adc_data As Integer
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (spi_Init(SPICLK_21400KHZ) = False) Then ' init SPI lib for accessing the A/D converter
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
adc_data = adc_ReadChannel(ADC_USECHANNEL0, ADCMODE_RANGE_2VREF, ADCMODE_UNSIGNEDCODING)
TextBox1.Text = adc_data
End Sub
End Class
suv23 offline
Newbie
Newbie
Posts: 3
Joined: Tue Feb 15, 2011 2:54 pm

Re: adc problem

Post by roboard » Thu May 05, 2011 1:00 pm

Post by roboard
Thu May 05, 2011 1:00 pm

suv23 wrote:this is my sensor program..this program only can read value 1023..after the value have remove from textbox and read again, the same value will appear although the range of sensor to detect was change..

...


Hi,

please change

adc_data = adc_ReadChannel(ADC_USECHANNEL0, ADCMODE_RANGE_2VREF, ADCMODE_UNSIGNEDCODING)

to

adc_data = adc_ReadChannel(0, ADCMODE_RANGE_2VREF, ADCMODE_UNSIGNEDCODING)

:)
suv23 wrote:this is my sensor program..this program only can read value 1023..after the value have remove from textbox and read again, the same value will appear although the range of sensor to detect was change..

...


Hi,

please change

adc_data = adc_ReadChannel(ADC_USECHANNEL0, ADCMODE_RANGE_2VREF, ADCMODE_UNSIGNEDCODING)

to

adc_data = adc_ReadChannel(0, ADCMODE_RANGE_2VREF, ADCMODE_UNSIGNEDCODING)

:)
roboard offline
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am


5 postsPage 1 of 1
5 postsPage 1 of 1