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

XMC™ Forum Discussions

arunprasath_95
Employee
Employee
First reply posted First question asked Welcome!
Hi I am new to XMC microcontrollers. I have a problem in converting the analog signals using ADC app in XMC µc using DAVE IDE. I was able to convert for 1 input. But for multiple inputs it gives me wrong answer.

This is my program:

#include "DAVE.h" //Declarations from DAVE Code Generation (includes SFR declaration)

XMC_VADC_RESULT_SIZE_t result[2];
uint8_t cnt=0;

void Adc_Measurement_Handler()
{
result[cnt] = ADC_MEASUREMENT_GetResult(&ADC_MEASUREMENT_0);
cnt = cnt+1;
if(cnt == 2)
{
cnt = 0;
}

}


int main(void)
{
DAVE_Init(); //(DAVE_STATUS_t)DIGITAL_IO_Init(&DIGITAL_IO_0) is called within DAVE_Init()

ADC_MEASUREMENT_StartConversion(&ADC_MEASUREMENT_0);

return (1);
}

when i read multiple signals, my output tends to get collapsed like the output for channel 1 is stored in result[1] instead of result[0] and likewise for the rest too. Kindly help me. I don't where my problem is
0 Likes
1 Solution
Rodrigo_RT
Level 4
Level 4
50 sign-ins 10 likes given 25 replies posted

Hello Arunprasath_95

The XMC1100 only has a single ADC value return register. With each reading, it changes the channel you added in the dave App

I made an example for you to test in your Bootkit.

Use the Help APP there you will find a lot of information regarding the Peripheral you want to use.

Rodrigo_RT_0-1653594074230.pngRodrigo_RT_1-1653594151641.png

 

View solution in original post

0 Likes
1 Reply
Rodrigo_RT
Level 4
Level 4
50 sign-ins 10 likes given 25 replies posted

Hello Arunprasath_95

The XMC1100 only has a single ADC value return register. With each reading, it changes the channel you added in the dave App

I made an example for you to test in your Bootkit.

Use the Help APP there you will find a lot of information regarding the Peripheral you want to use.

Rodrigo_RT_0-1653594074230.pngRodrigo_RT_1-1653594151641.png

 

0 Likes