HI i m using this usart program in mikroc pro using pic18f2580 @ 8 Mhz,the program has to return back the same data which sent to it
the code is written to send back the same data which it received.
can any one tell why this sort of data is been there in response of above program.
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received:q
sent
received:q
sent
received:q
sent
received:q
sent
received:q
sent
received:q
sent
received:q
sent
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:7
sent:7
received:777
sent:777
received:777
sent:777
received:7
sent:7
received:777
sent:777
received:777
sent:777
received:2
sent:2
received:2
sent:2
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
if u look at the sequence u can see that what ever the data u are sending same no of digits are to be received
but the program as described earlier has to send same data as it is send. some time it send the same data it receive no matter how many times u send the same digits but some times it send some different data for a digit
for example if i sent it digit 4 it will send 6 in response of it no matter how many times u sent digit 4.
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
on the another hand if i m specifically sending 7 it also send 7 in response of it as no matter how many time u send data as shown here
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:77
sent:77
received:77
sent:77
received:77
sent:77
so i mean to say that i m involved in some hardware problem which some time send accurate data but some time send incorrect data but always send the same ascii code for specified digit. please tell what gonna happening i m using max232n with 10uF caps .
Code:
char uart_rd;
void main() {
ADCON1 |= 0x0F; // Configure AN pins as digital
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
while (1) {
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
UART1_Write(uart_rd);
}
}
}
can any one tell why this sort of data is been there in response of above program.
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received
sent
received:q
sent
received:q
sent
received:q
sent
received:q
sent
received:q
sent
received:q
sent
received:q
sent
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:h
sent:~
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:44
sent:66
received:7
sent:7
received:777
sent:777
received:777
sent:777
received:7
sent:7
received:777
sent:777
received:777
sent:777
received:2
sent:2
received:2
sent:2
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
received:h
sent:n
if u look at the sequence u can see that what ever the data u are sending same no of digits are to be received
but the program as described earlier has to send same data as it is send. some time it send the same data it receive no matter how many times u send the same digits but some times it send some different data for a digit
for example if i sent it digit 4 it will send 6 in response of it no matter how many times u sent digit 4.
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
received:4
sent:6
on the another hand if i m specifically sending 7 it also send 7 in response of it as no matter how many time u send data as shown here
received:7
sent:7
received:7
sent:7
received:7
sent:7
received:77
sent:77
received:77
sent:77
received:77
sent:77
so i mean to say that i m involved in some hardware problem which some time send accurate data but some time send incorrect data but always send the same ascii code for specified digit. please tell what gonna happening i m using max232n with 10uF caps .