Pages: [1]   Go Down
Author Topic: What is OUTPUT_BUFFER_EMPTY in Java?  (Read 732 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 269
Arduino has it all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to communicate with Arduino from Java. But I can not find a descent explanation of what OUTPUT_BUFFER_EMPTY means?

Does it mean that Java had sent data to Arduino and Arduino read all the data and that is why the PC's otput buffer is now empty? In other words, all the bytes, were successfully transfered from PC to Arduino and PC can start sending new data gain.
« Last Edit: May 06, 2010, 02:39:08 am by DROBNJAK » Logged

UK
Offline Offline
Faraday Member
**
Karma: 17
Posts: 2884
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
all the bytes, were successfully transfered from PC to Arduino

All it means is that the PC's buffer is now empty; whether or not the transfer is successful, the PC can't say, just that all the data it was aked to transmit has left.
Logged

Per Arduino ad Astra

London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 269
Arduino has it all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just few more questions.

What happens if I send more data to serial buffer than it can hold?

What is the best way to do output? Send a half of buffer's capacity, than wait for it to go empty, than repeat. Or just ram as much data as you can and just not care at all, since hardware is supposed to handle it for you?
Logged

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

Quote
What happens if I send more data to serial buffer than it can hold?

It gets discarded.

Quote
What is the best way to do output? Send a half of buffer's capacity, than wait for it to go empty, than repeat. Or just ram as much data as you can and just not care at all, since hardware is supposed to handle it for you?

The best way is through the use of handshaking. The Arduino sends a message to the PC that it is ready to receive data. The PC sends data (no more than the Arduino can handle), and then waits for the Arduino to say that it is ready again.
Logged

London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 269
Arduino has it all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How does Arduino tell PC that it finished receiving and is ready for more?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26538
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's the bit you have to write.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 269
Arduino has it all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, so Arduuino just sends back CR or any other prearranged byte.
Logged

Pages: [1]   Go Up
Jump to: