LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time out in event structure

Solved!
Go to solution

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!

0 Kudos
Message 1 of 13
(3,576 Views)

I guess it is a race condition issue.

http://labviewwiki.org/Race_condition

0 Kudos
Message 2 of 13
(3,569 Views)

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?

0 Kudos
Message 3 of 13
(3,568 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 13
(3,531 Views)

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?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 13
(3,530 Views)

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.

0 Kudos
Message 6 of 13
(3,524 Views)

How many bytes should the microcontroller be sending back?  What is the format of the data being sent by the microcontroller?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 13
(3,517 Views)
Format is: <stx><stx><dlen><data byte1><data byte2>...<data byteN>
The vi has to wait till this data is received or the timeout(defined by the user based on microcontroller' code execution time) elapses.
0 Kudos
Message 8 of 13
(3,492 Views)
Solution
Accepted by topic author mnx

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 13
(3,483 Views)
Thanks crossrulz..:-)this I have to put in 2nd while loop is it??.. And how will I monitor the timeout??
0 Kudos
Message 10 of 13
(3,473 Views)