LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Serial + Arduino Read Buffer not working (Write works)

Solved!
Go to solution

@rolfk wrote:

@Gyc wrote:

Thank you all for the explanations.

 

Today is already late, I'll post one of the latest vi's where I found this error tomorrow.

I am aware of the response delay between sending a command and receiving a reply, so I do take into account that bytes may not be immediately available - quick&dirty trick is just inserting a delay between send and receive and tweak it.

It is a bit of a Heisenbug, yes - but we learn to recognize and deal with these early in our "careers" 😉 😁


And if you are a little further in your career, you might learn that instead of creating Heisenbugs, there are more reliable ways of doing things. Ways that work in production, day in day out, without introducing long delays that slow down your communication unnecessarily in 99.9% of the cases, just to try to avoid that Heisenbug. Except you don't avoid it really, even very extreme delays may sometimes not be enough. You never will know, except that your system spuriously causes errors.

 

Your serial port or network protocol (really any protocol that is based on a byte stream) should either be in ASCII and include a well defined EndOfMessage character, or if it is binary it should use fixed size messages or messages with a fixed size header that lets you determine how much data the remainder contains. Anything else is a hobby project, not a real device.

 


Delays only for assessing and studying the issue.

 

Delays are never a good bet for a stable and reliable solution - nature always finds a way to blow it up 😎

 

0 Kudos
Message 11 of 11
(64 Views)