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

cross mob
Not applicable
Hi, can anyone advise how to map a potential value using XMC1300 dave apps.
For example 5V. I would like to map it to value 0 to 100.
If my potential volue is 2.5V, my output value should gives 50.
I'm not sure do i need to use ADC?

Can i read my voltage value using IO001 [1.0.12] with the coding below?:

#include

int main(void)
{
bool Value = 0;
DAVE_Init(); // IO001_Init() is called within DAVE_Init()
Value = IO001_ReadPin(IO001_Handle0);
return 0;
}

I could not get any value with the coding above
0 Likes
3 Replies
Not applicable
Hi,

You should use ADC00x Apps for your case. IO001 App is used by a top level App (eg. ADC00x) to configure a pin in Analog mode only. IO001_ReadPin() API just gives you a logic value.

BR,
Zain
0 Likes
Not applicable
Hi Zain,

Yes you are correct. I can't use IO001_ReadPin().
However, i still couldn't get the output using ADC001.
Both the code below does not gives me result.

*****
int main(void)
{
status_t Status;
ADC001_ResultHandleType Result;
DAVE_Init();//ADC001_Init is called within DAVE_Init

//Get the result
Status =
ADC001_GetResult(
(ADC001_HandleType*)&ADC001_Handle0, &Result);
while(1);
return 0;
}

*****
int main(void)
{
uint32_t AdcResult;
DAVE_Init();//ADC001_Init is called within DAVE_Init

//Get the result
AdcResult = ADC001_GetFastResult((ADC001_HandleType*)&ADC001_Handle0);
while(1);
return 0;
}
0 Likes
Not applicable
Hi,

You may want to take a look at "ADC001_Example1_XMC13"?!
If you are not sure how to get this example project, you can refer to "DAVE TIP of the day: Where to get DAVE Example Projects".

BR,
Zain
0 Likes