hello dear friends..
I am working on PIC16F887 , when i applied AC signal to its ADC input pin then it is not giving a correct conversion for sine wave ...
So how to select best sampling rate for A/d conversion .. ?
here is my code I changed and implement different values of ADCON0 but no use...
here is my aliased sine wave is attached
I have already pass my signal through clamper and then anti-aliasing filter..
But what i think so that problem is with MCU frequency clock ..When I changes it to 150 Mhz so signals becomes much better but it is too high ..
Please guide...
I am working on PIC16F887 , when i applied AC signal to its ADC input pin then it is not giving a correct conversion for sine wave ...
So how to select best sampling rate for A/d conversion .. ?
here is my code I changed and implement different values of ADCON0 but no use...
Code:
unsigned int temp_res;
char buf2[6];
int i;
void main() {
UART1_Init(9600);
ADCON1 = 0x80;
ADCON0=0xC1;
TRISA = 0xFF;
ANSEL = 0xFF; // Configure AN2 pin as analog
//ANSELH = 0; // Configure other AN pins as digital I/O
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;
TRISA = 0xFF; // PORTA is input
TRISC = 0; // PORTC is output
TRISB = 0; // PORTB is output
do {
temp_res = ADC_Read(0); // Get 10-bit results of AD conversion
PORTB = temp_res; // Send lower 8 bits to PORTB
PORTC = temp_res >> 8; // Send 2 most significant bits to RC1, RC0
wordToStr(temp_res,buf2);
for(i = 0; i < 6; i++)
{
UART1_Write(buf2[i]);
Delay_ms(80);
}} while(1);
}
I have already pass my signal through clamper and then anti-aliasing filter..
But what i think so that problem is with MCU frequency clock ..When I changes it to 150 Mhz so signals becomes much better but it is too high ..
Please guide...