DSPRelated.com
Forums

Help ADC

Started by praveen November 5, 2004


Hi All I am working on the DSP56F801 processor. Just wrote a simple program
for ADC

#include <math.h>
#include "port.h"
#include "bsp.h"
#include "io.h"
#include "fcntl.h"
#include "gpio.h"
#include "adc.h"

static const adc_sState sAd1 = {

ADC_CHANNEL_0,
1,
0,
0,
0,
0,
};

void main (void)
{ ssize_t Num;
UWord16 Adc1;
FRAC16 Readvalue;

Adc1 = open (BSP_DEVICE_NAME_ADC_0,O_RDONLY,&sAd1);

ioctl(Adc1,ADC_START,0);

while(1)
{
Num = read(Adc1,&Readvalue,sizeof(Readvalue));
}

close(Adc1); }

My input is 1 v at AN0 . But everytime i execute this program i am
getting Num = 0 or 1 and Readvalue 2760. Can you help me with this. I am not getting the exact value.

Thanks
Praveen