XMC4500: Single ADC

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

cross mob
Not applicable
Hello,

i am new at uC programming. I get running blinking LEDs and PWM fast by watching the tutorials and the examples. But I don`t get a running program to read the Value of a NTC Sensor. I am using the XMC4500 Relax Lite Kit.

How can i convert the analog signal of a NTC Sensor at one input by a Button request?

I would like to:
1. Press a Button.
2. Start the first conversion and delete the result.
3. Start 3 conversions and store the values to get the median.

The follow Button-Interrupt is running:

#include //Declarations from DAVE3 Code Generation (includes SFR declaration)

void ERU_Handler (void)
{
IO004_TogglePin(IO004_Handle0);

/*
* if (IO004_ReadPin(IO004_Handle0)) // manuelles Toggeln
* IO004_ResetPin(IO004_Handle0);
* else
* IO004_SetPin(IO004_Handle0);
*/
}

int main(void)
{
// status_t status; // Declaration of return variable for DAVE3 APIs (toggle comment if required)

DAVE_Init(); // Initialization of DAVE Apps

while(1)
{

}
return 0;
}


362.attach

-Which ADC-APP should i use?
-Which other Apps (ADC Result Interrupt) should I use?
-What is to be in the ERU_Handler (/Result_Handler)?
0 Likes
6 Replies
Not applicable
Hi Leif,

For ADC, you can use ADC002 and interrupt, use NVIC002.

rgds,
Rou
0 Likes
Not applicable
Rou wrote:
Hi Leif,

For ADC, you can use ADC002 and interrupt, use NVIC002.

rgds,
Rou


I had already tried, but it wasn`t running.

I need a "step by step" instruction, what i have to add and how to connect.
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi Leif,

You can download the ADC example which will give you a better hint of what is happening. Beside this, you need to ensure you hook up your sensor to the correct port pins which you can check on the apps pins assignments.

G@@d Luck
Travis
0 Likes
Not applicable
Leif wrote:
I had already tried, but it wasn`t running.

I need a "step by step" instruction, what i have to add and how to connect.


What is not running? The ADC not converting or the interrupt is not triggering?
Maybe you can be more specify on your issue.

rgds,
Rou
0 Likes
Not applicable
Travis wrote:
Hi Leif,

You can download the ADC example which will give you a better hint of what is happening. Beside this, you need to ensure you hook up your sensor to the correct port pins which you can check on the apps pins assignments.

G@@d Luck
Travis


I had done. I was using pin 14.0 for the NTC.

What is not running? The ADC not converting or the interrupt is not triggering?
Maybe you can be more specify on your issue.

rgds,
Rou


I think the ADC wasn`t running succesful. Which ADC-App should i use for a single convert without background scanning?

My Main-File, the H/W Connection and the manuel pin assignment:

#include //Declarations from DAVE3 Code Generation (includes SFR declaration)

uint16_t Result = 0;

void BUTTON2_Handler (void);

void Result_Handler (void);

int main(void)
{
// status_t status; // Declaration of return variable for DAVE3 APIs (toggle comment if required)


DAVE_Init(); // Initialization of DAVE Apps


while(1)
{

}
return 0;
}

void BUTTON2_Handler (void)
{
ADC002_InitializeQueue(&ADC002_Handle0); // Start the conversion???
}

void Result_Handler (void)
{
ADCCH001_GetResult(&ADCCH001_Handle0, &Result);
ADCCH001_ClearResultEvtFlag(&ADCCH001_Handle0);
}


364.attach
365.attach
366.attach
0 Likes
Not applicable
This thread can be close and delete, i am getting self a running single adc...it`s pity, that the replies wasn`t helpful!
0 Likes