Society of Robots - Robot Forum
Software => Software => Topic started by: orchid on April 04, 2008, 12:24:00 AM
-
Hi there...
I have a problem here regarding to the ADCRESULT1. When I use 1 sensor, then I got the ADC value on the ADCRESULT0. But, when I connect the second sensor to the ADC pin on the tms320f2812 dsp board, the ADC value on the ADCRESULT1 are not as expected. Here I attach some of the source code that I have edited for your reference.
AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK;
AdcRegs.ADCTRL3.bit.ADCCLKPS = ADC_CKPS;
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 1 Cascaded mode
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x8;
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0xA;
AdcRegs.ADCTRL1.bit.CONT_RUN = 1; // Setup continuous run
AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0x1; // convert and store in 2 results registers
// Clear SampleTable
for (i=0; i<BUF_SIZE; i++)
{
SampleTable[i] = 0;
}
// Start SEQ1
AdcRegs.ADCTRL2.all = 0x2000;
GpioDataRegs.GPBDAT.all = 0xFFFF;
// Take ADC data and log the in SampleTable array
while(1)
{
for (i=0; i<AVG; i++)
{
while (AdcRegs.ADCST.bit.INT_SEQ1== 0) {} // Wait for interrupt
// Software wait = (HISPCP*2) * (ADCCLKPS*2) * (CPS+1) cycles
// = (3*2) * (1*2) * (0+1) = 12 cycles
asm(" RPT #11 || NOP");
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
Voltage1[ConversionCount] =( (AdcRegs.ADCRESULT0>>4) );
Voltage2[ConversionCount] =( (AdcRegs.ADCRESULT1>>4) );
Please help me to solve this prob.
thanks...
-
When I use 1 sensor, then I got the ADC value on the ADCRESULT0. But, when I connect the second sensor to the ADC pin on the tms320f2812 dsp board, the ADC value on the ADCRESULT1 are not as expected.
It sounds like cross interference.
Make sure your power supply is clean and good.
Also, make sure you have the sensors plugged into the same place as specified in code - sometimes the ADC can 'take' voltages from nearby ADC pins.
-
i got it...
thanks