Go Down

Topic: Arduino serial transmit (Tx) buffer - software/hardware question (Read 188 times) previous topic - next topic


Hi all.

This question involves using "Serial.print" for serial communications. In one online discussion, there's discussion about a 63 or 64 byte buffer --- maybe ring-buffer. In another discussion, there is a mention of 1 byte hardware buffer. In the end, just to get things properly understood..... this 64 byte buffer is a software queue buffer, right?

So a "Serial.print" dumps the various bytes it contains to the 64 byte software buffer, right? And arduino serial communications handling code will check to see if the hardware buffer can accept 1 byte, right?

Just trying to piece things together here, to see if I can understand it a bit. Thanks all!




Mrs Drew
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.


So a "Serial.print" dumps the various bytes it contains to the 64 byte software buffer
Serial.print() doesn't "contain" any data. It may need to convert int or float data to a string. It then write()s the characters in the string to the outgoing buffer and returns, if there is room in the buffer for the data that it needs to add.

If there is not room, print() blocks until there IS room in the buffer. The bytes from the buffer are then copied, one at a time, to the one byte register, where they are output one bit at a time.
The art of getting good answers lies in asking good questions.

Go Up