illegal121
Member level 2
Hello Friends...
here is my code for PIC16F877A using two 10bit ADC ..
PIC ADC is giving enough samples of sinewave below 5-7 Hz and that is reconstructing perfectly using this program but as I am changing frequency and moving above 10 Hz there is not enough sample by ADC to reconstruct sinewave as it is...
I know that changing baud rate (increasing) will give more good result but even when I have changed baud rate to 57600 so it reconstruct upto 20 Hz
I have to reconstruct atleast upto 50 Hz..
Hope you people Helps me out....
here is my code for PIC16F877A using two 10bit ADC ..
Code:
unsigned int temp_res;
unsigned int temp_res1;
char buf2[6];
char buf[6];
int i;
void main() {
UART1_Init(9600);
delay_ms(100);
TRISA = 0xFF;
CMCON = 0x07;
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
temp_res1=ADC_read(1);
WordToStr(temp_res,buf2 );
for(i = 0; i < 6; i++)
{
UART1_Write(buf2[i]); //Write Channel 0
Delay_us(1);
}
UART1_Write(13); //
WordToStr(temp_res1,buf );
for(i = 0; i < 6; i++)
{
// Write channel 1
UART1_Write(buf[i]);
Delay_us(1);
}
}
while(1);
}
I know that changing baud rate (increasing) will give more good result but even when I have changed baud rate to 57600 so it reconstruct upto 20 Hz
I have to reconstruct atleast upto 50 Hz..
Hope you people Helps me out....