Need help with ADC

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

cross mob
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

I need to take an ADC reading at a specific point in received data stream from a wireless system.

   

First I dropped an SAR_ADC on the project and tested it worked using this code.

   

ADC_Start();

   

ADC_StartConvert();

   

result = ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);

   

RSSI_Val = ADC_GetResult16(); 

   

Next, I set a flag at the point in data reception I wanted to start sample and when I read the flag in main code I do an ADC sample. Trouble is that I do not have control over the point a packet arrives and therfore the sampling of the ADC is not always occurring when I need it.

   

Would someone have an example how I could start and ADC conversion within the Uart Interrupt routine so that when I get back in main loop the conversion would have been doen at the right time and I can read the value at that point?

   

 

   

Thanks

0 Likes
13 Replies