about send the binary into the UART

4 posts / 0 new
Last post
liuluan002
Offline
Last seen:3 months 2 weeks ago
加入:2015-11-27 14:24
about send the binary into the UART

Hi Dialog,

I am trying to make a code to send the binary through the UART instead of the ASCII through the UART. Is there any function I can call with for the application?

Device:
MT_dialog
Offline
Last seen:8 hours 23 min ago
工作人员
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

I am not sure i get the question, when you send data over the UART they are just binary data, zeros and ones, how you interpret them results to hex numers or ascii.

Thanks MT_dialog

liuluan002
Offline
Last seen:3 months 2 weeks ago
加入:2015-11-27 14:24
For example, if we want to

For example, if we want to use the "data=0x08; printf_byte(data);" to send in ascii, we will get two bytes, 0x30 and 0x38 then it displays as "0" and "8". If I send through the data link it will cost more bandwidth, so I want to directly to send "0x08" in hex instead.

MT_dialog
Offline
Last seen:8 hours 23 min ago
工作人员
加入:2015-06-08 11:34
Hi liuluan002,

Hi liuluan002,

If you are using the common_uart functions i assume that you are using the an example from the peripheral examples projects, so you could use the uart2_write() directly in order to do what you want, since the printf_byte converts the data in hex format.

Thanks MT_dialog