@xiangjun_rong Hello, now thanks to you my code works with all adc channels, however when I used interrupt I used a function to calculate the mid values of 200 samples of my sensors, but now I don't use adc interrupt and I don't know how can I use the function to calculate the mid value.
So as you can see I used to calculate the mid value when I used adc interrupt, but now I don't know how properly can I use calcTemp function. I once again added the intact project
Thanks in advance,
Alex
void calcTemp(uint16_t voltage, float temp) {
calcVolt=(volatge*3.6F)/4096;
temp=(calcVolt*1000.0F);
total+=temp;
countOfSum++;
if(countOfSum==200)
{
countOfSum=0;
realTemp=total/200.0F;
total=0;
flagOfTemp=1;
}
else
ADC_StartCmd(LPC_ADC,ADC_START_NOW);
}
void ADC_IRQHandler()
{
if(ADC_ChannelGetStatus(LPC_ADC,ADC_CHANNEL_0,ADC_DATA_DONE)==0)
{
float temp;
volatge=ADC_ChannelGetData(LPC_ADC,ADC_CHANNEL_0);
/*
3 4096
x volt
x=volt*3/4096
*/
calcTemp(volatge,temp);
}
if(ADC_ChannelGetStatus(LPC_ADC,ADC_CHANNEL_1,ADC_DATA_DONE)==0)
{
float temp;
volatge=ADC_ChannelGetData(LPC_ADC,ADC_CHANNEL_1);
calcTemp(volatge,temp);
}
}