ADC average values

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC average values

1,212 Views
Alexshea
Contributor III

@xiangjun_rong Hi, I used the code that you recommended for calculating the average temperature. However, after using that now I don't receive any temperature. Could you please check the code once again and help me resolve that problem. I added the whole project as you asked the last time.

Labels (1)
0 Kudos
Reply
4 Replies

1,157 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

you use the code:

#define TOTAL_AVERAGE_NUMBER 200
for (uint16_t i=0; i<TOTAL_AVERAGE_NUMBER; i++)
{
uivoltage=HW_ADC_Read(0);
temp=calcTemp(uivoltage);
totalTemp+=temp;

}

The above code takes a lot of time so that the core has not time to handle the interrupt.

Pls try to change

#define TOTAL_AVERAGE_NUMBER 2

and have a try.

BR

XiangJun Rong

1,137 Views
Alexshea
Contributor III

@xiangjun_rong Hi, I tried what you said, but even setting #define TOTAL_AVERAGE_NUMBER 2 didn't solve the problem maybe because I don't have any interrupt in my code. Last time you recommended me not to use interrupt, since I'm using all the 8 adc channels. But, thanks for your help

0 Kudos
Reply

1,191 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi 

@xiangjun_rong  is on leave. He will answer you next week when he gets back.

Thanks,

Jun Zhang

0 Kudos
Reply

1,189 Views
Alexshea
Contributor III

Thank you so much for letting me know. I'll wait for him 

0 Kudos
Reply