Difference between puart_write/puart_print and puart_synchronousWrite?

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

cross mob
Anonymous
Not applicable

What's the difference between these functions and why would I want to use one over the other?

There's some information posted on this thread (Re: Peripheral UART: To FIFO, or not to FIFO) but the question isn't directly answered.

0 Likes
1 Solution
Anonymous
Not applicable

Andrew,

puart_print will only print a string - until a null character.

puart_write will only write a byte.

puart_synchrononusWrite - Keeps writing and might overflow and missing bytes - Not preferred.

Thanks

JT

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

Not completely.  Those posts are useful in that they discuss some of the "how" but not necessarily the "why" I would choose one over the other.

0 Likes
Anonymous
Not applicable

Andrew,

puart_print will only print a string - until a null character.

puart_write will only write a byte.

puart_synchrononusWrite - Keeps writing and might overflow and missing bytes - Not preferred.

Thanks

JT

0 Likes
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

puart_synchronousWrite - will essentially write a series of bytes, but unless you implement some form of flow control external, it will overflow the buffer and could cause bytes to be lost.

puart_write on the other hand will write one byte at a time, check the buffer, then write the next byte in a loop manner.

As JT mentions above, puart_write is almost always preferred over puart_synchronousWrite.

0 Likes