Dario Greggio wrote: > I took your code and made it into C: > > if(!BusyADC10()) { // non deve succedere > ADC_220_sample=ReadADC10(0); > } > > ConvertADC10(); > > ADC_220_old_sample=ADC_220_sum/(1000/50); // freq. sampl > ADC_220_sum-=ADC_220_old_sample; > ADC_220_sum+=ADC_220_sample; > // ADC_220_old_sample=ADC_220_sample; > if(!(cnt % 50)) { > ADC_220=ADC_220_sum; // > ADC_220_sum=0; > } > Dario, just an OT observation: you can improve readability (now and especially in the future) if you use more meaningful function and variable names and replace magic numbers with variables or #defines. Also, proper use of whitespace can make a huge difference. Best regards, Vitaliy -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist