Go Down

Topic: Is serail.write() blocking? (Read 1 time) previous topic - next topic

jimLee

Do I need to worry about over running buffers when calling serial.write()? Or will it block 'till it has room for the data I called it with? I can't find any info on how this works.

Thanks!

-jim lee

PaulS

Quote
I can't find any info on how this works.

Why not? You have the source code. Look at it.

If there is no room in the buffer, the function blocks until there is room. On 1.0, the buffer size is 64 bytes. On 0023 and earlier, the buffer size was a bit smaller - 1 byte.

jimLee

I have the source code? Really? Where?

-jim lee

Nick Gammon

On my Windows PC, version 0022:

Code: [Select]
C:\Documents and Settings\Owner\Desktop\arduino-0022\hardware\arduino\cores\arduino\HardwareSerial.h
C:\Documents and Settings\Owner\Desktop\arduino-0022\hardware\arduino\cores\arduino\HardwareSerial.cpp


Depends somewhat on where you installed it. So basically:

Code: [Select]
<install directory>\arduino\hardware\arduino\cores\arduino\HardwareSerial.h
<install directory>\arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp


Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics


Nick Gammon

On my Mac, version 1.0 it is:

Code: [Select]
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.cpp

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

jimLee

Found it and it blocks. Was even a note about what it should be doing.

Thanks again, this will be a great help.

-jim lee

Go Up