Go Down

Topic: What is OUTPUT_BUFFER_EMPTY in Java? (Read 751 times) previous topic - next topic

DROBNJAK

May 06, 2010, 08:00 am Last Edit: May 06, 2010, 09:39 am by DROBNJAK Reason: 1
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.

Groove

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.
Per Arduino ad Astra

DROBNJAK

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?

PaulS

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.

DROBNJAK

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

AWOL

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

DROBNJAK

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

Go Up