08-18-2014 04:47 AM
Hi,
I am trying to configure timeout in event structure to 5s using the loop as shown in the attached image. The problem is that this time out event happens only when I debug the code and doesnt occur when I run the same without debug. Any suggestions on this?
Thanks!
Solved! Go to Solution.
08-18-2014 04:52 AM
I guess it is a race condition issue.
08-18-2014 04:52 AM
Here I am just waiting for the bytes to be available at serial port till the time out occurs at the 1st loop. Any suggestions on how can I implement this in a better way?
08-18-2014 06:40 AM
When configuring the serial connection (VISA Configure Serial), you can pass a timeout time for read/write to the session.
Please use this instead of creating obscure approaches for a workaround.
On a side note:
Please do not use "value" property nodes unless it is really necessary. Same applies to variables of course.
Norbert
08-18-2014 06:40 AM
Each time you write to that Value (Signaling) property, you are generating a Value Change event for that control. It doesn't matter if the value actually did change or not. The event is generated regardless.
There has to be a better way to do this than that setup you have. What exactly is the protocol you are trying to read?
08-18-2014 06:48 AM
I am initially sending some bytes of data to a microcontroller via serial port. After receiving these bytes, the controller starts executing some code. After executing it completely, the controller sends a frame of data back to LV and hence till that time the LV should wait.
Thats why I implemented a time out event while simultaneously monitoring the "byte received"..I should come out of both the loops once any of the two i.e timeout event occurs or the bytes are received.
08-18-2014 06:53 AM
How many bytes should the microcontroller be sending back? What is the format of the data being sent by the microcontroller?
08-18-2014 08:56 AM
08-18-2014 09:06 AM - edited 08-18-2014 09:06 AM
Ok, just use VISA Read to read the first three bytes. Then do another VISA Read set to the number of bytes defined in dlen. If the data doesn't come, then you will get a VISA Timeout.
08-18-2014 09:30 AM