Pages: [1]   Go Down
Author Topic: Is serail.write() blocking?  (Read 943 times)
0 Members and 1 Guest are viewing this topic.
Anacortes, WA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 45982
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Anacortes, WA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the source code? Really? Where?

-jim lee
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

On my Windows PC, version 0022:

Code:
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:
<install directory>\arduino\hardware\arduino\cores\arduino\HardwareSerial.h
<install directory>\arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp

Logged

Anacortes, WA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh cool! Thanks!

-jim lee
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

On my Mac, version 1.0 it is:

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

Anacortes, WA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: