How will be the integers sent though UART

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How will be the integers sent though UART

1,736件の閲覧回数
ddpd
Contributor III

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

ラベル(1)
タグ(3)
1 返信

1,307件の閲覧回数
Stano
NXP Employee
NXP Employee

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.