I have to write and read integers from the UART peripheral.
In what format does the UART transmits the integer? Is it in ascii? Even if I send characters as numbers (0 to 255) how is it transmitted?
Do I need to internally convert the data read from UART from ascii to int ?
I am confused over the answers from different blog. Could anyone suggest a link or provide answer.
I tried different things like programmed the board to continuously transmit the data. If I transmit the character from the board's UART to the putty, it displays in the putty as a character but it won't display in my c code written in linux. So what should be the format specifier?
Thanks in advance
Hello David,
as you know the UART interface has defined protocol, which consists of:
1. START bit
2.Data array - usually 8-bit (one byte), but could be 9-bit also,
3.Parity bit
4.STOP bit.
So the information is covered in the Data = one byte. It is up to you what these data will represent. It can be "read" as ASCII character, as hex format number (0x..), as decimal number (0 - 255) or something else.
So what is placed into UART Tx buffer, the same will be received from the UART RX buffer on opposite site. The final interpretation depends on the system using the transferred data.
Best Regards,
Stano.