ADC001 App

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
nikhil2402
Employee
Employee
Hello,

From the past 1 week i have been trying to get a 4Hz sinusoidal signal converted using ADC001 app. I followed the example project and made small modifications as follows:

#include //Declarations from DAVE3 Code Generation (includes SFR declaration)
int count = 0;
int buff[100] = {0};
ADC001_ResultHandleType Result;
int main(void)
{
// status_t status; // Declaration of return variable for DAVE3 APIs (toggle comment if required)
int x = 0;

DAVE_Init(); // Initialization of DAVE Apps
ADC001_GenerateLoadEvent((ADC001_HandleType*)&ADC001_Handle0);

while(1)
{
x++;
}
return 0;
}

void GlobalResultEvent()
{
ADC001_GetResult((ADC001_HandleType*)&ADC001_Handle0, &Result);
buff[count] = Result.Result;
count = count + 1;
if(count==70)
count = 0; // I put the break point here to see the values in buff array(basically its an array of sampled values )


}


So as can be seen in the comments above, I put a break point at "count = 0" and look at the sampled values stored in buff array. When I plot these values, I dont see any sinusoid signal, its some kind of noise. Could you tell why is this happening? And also is there a possibility to change the sampling frequency of ADC using ADC app.

I appreciate the help,

Thank You

Kind Regards
Nikhil
0 Likes
1 Reply
Not applicable
Hi Nikhil,

May I know which device are you using?
If you are using XMC4500, by default, each 12-bit conversion only took approximately 550ns.
Since you put a break point after 70 ADC conversion, this means 70 X 550ns = ~38.5 usec.
Since you are sampling a rather slow sinusoid signal (4Hz), you would not see the sinusoidal waveform from the sampled result.
The whole waveform took about 0.25 sec and now you only sampled 38.5usec out of it.
That is why you only see some noise.
So, I would suggest you use a timer to trigger the ADC sampling over the whole signal period (0.25sec).

Regarding your question on changing the sampling frequency, it is not possible with the DAVE App configuration.
But you can do it by changing the divider in GLOBCFG.DIVA register.
0 Likes