arup
Member level 2
16f877a && adc
sir, me new to pic micros.
I have to measure 50Hz signal amplitude(230V,50Hz AC) using on-chip 10-bit adc.The ac signal is rectified , filtered and fed as dc(with max limit 5V) to a analog channel i/p say,AN0.I have com across following steps.
1) Configure analog/ digital i/o pins in ADCON1
2) selection of i/p channel in ADCON0
3) Turn On A/D and give some stabilization time say 10uS
4) start ADC conversion with GO bit set and check for end of the conversion .and get the result in ADRESH:ADRESL
Now i feel to measure the signal i have to take n no samples and take avg of that.
As a general rule sampling freq will be 2x freq of signal to be measured.
Now i have the following query on the above:
1) i found in the datasheet(PIC16FXXA) "page 131" - table 11-1 : Max Device frequency .......is it the crystal frequency or (Crystal freq / factor ).if it is the 2nd case then what is the factor. pls get me some tech data about prescaler for pic cpu clock.
2) What should be the actual adc clock conversion(in ADCON0) in aboe example ? how to calculate that.
3) What should be sampling freq for n no of samples? How to select it?
4) How many samples will give me good result.
5) Is there any better method than averaging the adc samples in given time?
Thanks for any help.Correct me if anything written wrong.
Regards,
Arup
sir, me new to pic micros.
I have to measure 50Hz signal amplitude(230V,50Hz AC) using on-chip 10-bit adc.The ac signal is rectified , filtered and fed as dc(with max limit 5V) to a analog channel i/p say,AN0.I have com across following steps.
1) Configure analog/ digital i/o pins in ADCON1
2) selection of i/p channel in ADCON0
3) Turn On A/D and give some stabilization time say 10uS
4) start ADC conversion with GO bit set and check for end of the conversion .and get the result in ADRESH:ADRESL
Now i feel to measure the signal i have to take n no samples and take avg of that.
As a general rule sampling freq will be 2x freq of signal to be measured.
Now i have the following query on the above:
1) i found in the datasheet(PIC16FXXA) "page 131" - table 11-1 : Max Device frequency .......is it the crystal frequency or (Crystal freq / factor ).if it is the 2nd case then what is the factor. pls get me some tech data about prescaler for pic cpu clock.
2) What should be the actual adc clock conversion(in ADCON0) in aboe example ? how to calculate that.
3) What should be sampling freq for n no of samples? How to select it?
4) How many samples will give me good result.
5) Is there any better method than averaging the adc samples in given time?
Thanks for any help.Correct me if anything written wrong.
Regards,
Arup