Forums

ADC question

Started by david wiernicki January 17, 2004

Hi. I'm new. :P

I'm using a DSP56f805 to do a 6-axis motor controller for a motion
platform.

I grab analog inputs for feedback, pulse width input from a PC for
control, and PWM output to run the motors.

I'm using Code warrior 5 with SDK 2.5.

I've got everything working but the ADC input.

My problem is that I can make one ADC pin work fine, but if I enable
more than one pin, trying to read from any pin other than the first one
initialized in the code results in a crash.

I haven't been able to find any clear explanation of how the SDK's
interface with the ADC works - there are examples all over the place,
but one of them will have:

static const adc_sState sadc0 = {

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

/* OffsetRegister = */ FRAC16(0.0),
/* LowLimitRegister = */ 0,
/* HighLimitRegister = */ 0,
/* ZeroCrossing = */ 0,

};

...and the other one will have

static const adc_sState sadc0 = {

/* AnalogChannel = */ ADC_CHANNEL_0,
/* NumSamples = */ 0,

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

};

...so I haven't got the *slightest* idea what's going on. SampleMask and
NumSamples are confused; I've looked at the samplemask grids and that
makes sense, but where the hell do I put it when the code that works
says that it's supposed to be NumSamples?!

I've dug through the help docs, through the archives of this group, been
around the block three times with motorola AND my local applications guy
- who sent me code that uses all 8 ADCs but doesn't use the SDK!

I'm at wit's end, and would really appreciate some info on using the ADC
that doesn't already assume you know how to use it!

Thanks in advance,

-David Wiernicki

[ps: if the yahoo groups thing says something about the message being
from 'charles derry', ignore it. I had to create another yahoo account,
because despite my best efforts I was unable to change the password for
my old account - it emailed me a new password and then staunchly refused
to accept it...]