DSPRelated.com
Forums

ADC problem

Started by praveen November 12, 2004

Hi

can anyone help me with this one. I got stuck with this for a week. I am using dsp56f801 . I have an Input voltage(dc) say 1v. scan mode - is sequential once
divisor -4
instead of sync i use start command.

The problem that i have , i am not getting the ADC
value everytime i run program. Sometimes i get 32760
sometimes 11492(i.e the correct value since the input
is a dc 1v and vref 2.75).

I have the following question

1. I want to read only AN0 sample. How to disable
other sample. My input 1 v is to the AN0 line. 2.is it necessary that all the ADC channels should have
the voltage lesser than the voltage vref, eventhough i
am not using those channels.In my case i have Rest of the Pins (AN1 to
AN7) tied to a 5v supply.

i have attached the code

#include "port.h"
#include "bsp.h"
#include "adc.h"
#include "fcntl.h" void CC_CallBack( adc_eCallbackType type,
adc_tSampleMask causedSampleMask ); static const adc_sState sadc0 = {

/* AnalogChannel = */ ADC_CHANNEL_0,
/* SampleMask = */ 0x01,

/* OffsetRegister = */ 0,
/* LowLimitRegister = */ 0,
/* HighLimitRegister = */ 0,
/* ZeroCrossing = */ 0,

};

static bool ScanComplete = false; main()
{

int Adc0FD;
int NumRead0;
Frac16 Sample0;

Adc0FD = open(BSP_DEVICE_NAME_ADC_0, 0, &sadc0 );
ioctl( Adc0FD, ADC_START, 0 );
while(1) {
if (ScanComplete) {

NumRead0 = read( Adc0FD, &Sample0, sizeof(Sample0)
);
//ioctl(Adc0FD,ADC_STOP,0);
ScanComplete = false;
ioctl( Adc0FD, ADC_START, 0 ); //restart ADC
}
}
}

void CC_CallBack( adc_eCallbackType type,
adc_tSampleMask causedSampleMask )
{

ScanComplete = true;

} these are appconfig.h

#define INCLUDE_SCI
#define INCLUDE_GPIO
#define INCLUDE_IO
#define INCLUDE_ADC
#define INCLUDE_QUAD_TIMER
#define ADC_CLOCK_DIVISOR 4 #define EXT_OSC_STABILIZATION_DELAY 100

#define PLL_CONTROL_REG (
PLL_LOCK_DETECTOR \
|
PLL_ZCLOCK_POSTSCALER \
|
PLL_PRESCALER_EXTERNAL_CLK_SELECT)

#define INLCUDE_ADC_SAMPLE_0

#define ADC_SCANMODE ADC_SEQUENTIAL_ONCE

#define ADC_RAW_CONVERSION_COMPLETE_CALLBACK
CC_CallBack
#endif
//////////////////////////////////////

can anyone give me a sample program for sequential once and triggered
sequential It could be a great help. thanks
Praveen





--- In , "praveen" <powerarm2001@y...>
wrote:
>
> Hi
>
> can anyone help me with this one. I got stuck with this for a week.
.
.
.
>
>
> thanks
> Praveen

Check the Freescale FAQs at
http://www.freescale.com/webapp/sps/site/faq_search.jsp.

Select "DSP" as product and "56800/E" as series.

Two FAQs are of interest: 11525 and 11868. The latter has software
examples for every type of ADC operation you are likely to need. The
software projects are in SDK, but for an 807 EVM instead of your 801,
but you should be able to reuse the example code.