problem with formatting 16 bits for UART

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RiTh_4546911
Level 1
Level 1

I am trying to put 16bits output from the filter to the UART but keep getting corrupted results.

CY_ISR(filterVDAC)

{

     char transmission[16];

     uint16 c = Filter_Read16(Filter_CHANNEL_A);

     sprintf(transmission,"%d",c);

     UART_1_PutString(transmission);

}

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

> If you get the wrong result, there are two possibilities,

> one: the UART transmit the wrong data, the second maybe the filter gives wrong.

Some more things, I just remembered is,

(1) if I connect rx and tx swapped the data seems to be corrupted.

(2) if the baud rate is wrong between UART and the receiver (serial terminal),

      the data also seems to be corrupted.

(3) if the UART's tx is not connected to the receiver's rx, floating,

    also gives us seems to be corrupted data.

I'm surprised we have so many ways to get "seems to be" corrupted data.

moto

View solution in original post

4 Replies