Oct 13, 2017
04:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 13, 2017
04:37 AM
Hello,
I configured the Dave APP to make two ADC measurements (P2.7 and P2.9) and I'm not having success reading the values. I can read one value but I don't know how can I read the other one because it uses a global register to store the values.
I'm using DAVE 4 with a Sense 2 Go Kit (XMC1100).
Following is my code:
// Global variables
XMC_VADC_RESULT_SIZE_t adc1Raw;
XMC_VADC_RESULT_SIZE_t adc2Raw;
int main(void)
{
DAVE_Init();
ADC_MEASUREMENT_StartConversion(&ADC_MEASUREMENT_0);
while(1)
{
}
}
// Interrupt
void Adc_Measurement_Handler()
{
adc1Raw = ADC_MEASUREMENT_GetGlobalResult() & 0xFFF;
adc2Raw = ???
}
I configured the Dave APP to make two ADC measurements (P2.7 and P2.9) and I'm not having success reading the values. I can read one value but I don't know how can I read the other one because it uses a global register to store the values.
I'm using DAVE 4 with a Sense 2 Go Kit (XMC1100).
Following is my code:
// Global variables
XMC_VADC_RESULT_SIZE_t adc1Raw;
XMC_VADC_RESULT_SIZE_t adc2Raw;
int main(void)
{
DAVE_Init();
ADC_MEASUREMENT_StartConversion(&ADC_MEASUREMENT_0);
while(1)
{
}
}
// Interrupt
void Adc_Measurement_Handler()
{
adc1Raw = ADC_MEASUREMENT_GetGlobalResult() & 0xFFF;
adc2Raw = ???
}
- Tags:
- IFX
3 Replies
Oct 16, 2017
05:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 16, 2017
05:22 AM
Hello persike,
-enable continuouse conversion to get more then one meassurement (or call the api ADC_MEASUREMENT_StartConversion(&ADC_MEASUREMENT_0 ) after each measuerement again...)
-change your result variables to an array like adcRaw[2] ...
-then make a for loop and get the results after each other (with the ADC_MEASUREMENT_GetGlobalResult())
or:
adcRaw[0]=ADC_MEASUREMENT_GetGlobalResult():
adcRaw[1]=ADC_MEASUREMENT_GetGlobalResult():
... and so on.
the right order is a little bit tricky (which channel is what)
it is desrcibe in the application manuel... i dont have access at the moment to this...
look also at:
https://www.infineonforums.com/threads/4563-XMC-1100-ADC-how-to-add-a-second-channel
best regards
andi
-enable continuouse conversion to get more then one meassurement (or call the api ADC_MEASUREMENT_StartConversion(&ADC_MEASUREMENT_0 ) after each measuerement again...)
-change your result variables to an array like adcRaw[2] ...
-then make a for loop and get the results after each other (with the ADC_MEASUREMENT_GetGlobalResult())
or:
adcRaw[0]=ADC_MEASUREMENT_GetGlobalResult():
adcRaw[1]=ADC_MEASUREMENT_GetGlobalResult():
... and so on.
the right order is a little bit tricky (which channel is what)
it is desrcibe in the application manuel... i dont have access at the moment to this...
look also at:
https://www.infineonforums.com/threads/4563-XMC-1100-ADC-how-to-add-a-second-channel
best regards
andi
Sep 15, 2021
07:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 15, 2021
07:20 AM
Hello,
I am having the same problem and i saw your explanation and tried to make it like you described. The pins are reading values but not the rigth way(always oscillating between 0 and the value, and when i connect all the pins to 3.3v they stop oscillating and the value is stable in 4095[12 bits adc] ).
Can you please give me an example code for 2 ADC channels? (I am using the XMC1100 2GO).
Also, can you show the adc configurations?
Best regards,
Tiago Rocha
I am having the same problem and i saw your explanation and tried to make it like you described. The pins are reading values but not the rigth way(always oscillating between 0 and the value, and when i connect all the pins to 3.3v they stop oscillating and the value is stable in 4095[12 bits adc] ).
Can you please give me an example code for 2 ADC channels? (I am using the XMC1100 2GO).
Also, can you show the adc configurations?
Best regards,
Tiago Rocha
Jul 26, 2022
01:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 26, 2022
01:59 PM
Hi!
I'm new to Infineon uC's but i think i have the solution here.
I've been testing the ADC on my XMC2Go 1100 and fount that this u'C doesnt have a vector to save each vonvertion, so you have to check if the result is for one port or the other.
To do this you can use the ADC_MEASUREMENT_GetGlobalDetailedResult() function which returns the measurment and other information on the same uint32_t variable.
So my code look like this:
uint16_t ADC_result[2]; //Vector to store the results
void Adc_Measurement_Handler(void)
{
uint32_t result; //Var to store the result
result = ADC_MEASUREMENT_GetGlobalDetailedResult(); //Getting the result
//If the chanel is eq to Channel_A it stores it on first place
if( ADC_MEASUREMENT_Channel_A_handle.ch_num == (result & VADC_GLOBRES_CHNR_Msk) >> VADC_GLOBRES_CHNR_Pos )
{
ADC_result[0] = (result & VADC_GLOBRES_RESULT_Msk) >> ((uint32_t)ADC_MEASUREMENT_0.iclass_config_handle->conversion_mode_standard * (uint32_t)2);
}
//If the chanel is eq to Channel_B it stores it on second place
if( ADC_MEASUREMENT_Channel_B_handle.ch_num == (result & VADC_GLOBRES_CHNR_Msk) >> VADC_GLOBRES_CHNR_Pos )
{
ADC_result[1] = (result & VADC_GLOBRES_RESULT_Msk) >> ((uint32_t)ADC_MEASUREMENT_0.iclass_config_handle->conversion_mode_standard * (uint32_t)2);
//Triggers another convertion
ADC_MEASUREMENT_StartConversion(&ADC_MEASUREMENT_0);
}
}
Also my ADC DAVE appconfiguration is the next:
Hope it solves your problem.