LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA read timeout error at uneven intervals

I am trying to write a vi to check the stir speed of a Scilogex stir plate at set time intervals (for example every 10 minutes) over about a two week time frame. The program will run for a while and give the current stir speed of the stir plate.  I've had it run for up to 180 times, but eventually it gives an error of "VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed."

 

There's no set number of iterations before the program times out.  It can be after 40 times or 140 times just as often. I'm not sure if this is caused by a communication problem in the stir plate or in Labview. After Labview gives the error, it quits running and I have to turn the stir plate off and back on again before the program will rerun. How do I avoid getting this error? Does Labview send a message to the stir plate after the error that I could somehow change to keep the stir plate from stopping communication?  Is there a way to get Labview to keep running after the error? I've attached the files for the program.  The main vi is Continuous Serial Write and Read Hexadecimal Alici and the other three files are subvis.

0 Kudos
Message 1 of 25
(3,483 Views)

First thing.

 

Get rid of the shift registers on the error wire.  I find they are a bad idea.  (Others might disagree.)  Yours is a perfect example why those shift registers are bad.

 

Right now you have no idea if that timeout error is some random, odd occurrence, or something that will persist.  Maybe it just happens rarely, but the next VISA read will work fine.  With the shift register, once you have an error, it will persist forever without any special code to do something else or clear the error.  That error goes to the beginning of the next loop iteration.  All the VISA commands have standard error input functionality which means they won't execute if there is an incoming error.  They all do nothing and just pass the error message on.  And the next loop iteration gets it, and it goes on forever until you stop your VI and restart.

 

Make those error wires normal tunnels.  Put an indicator on the wire so if something does happen, you can see it on the front panel.  Perhaps create a logging function that if there is an error, it rights the date, time, error message to a file that you can review later to see how frequently the errors occur.

0 Kudos
Message 2 of 25
(3,463 Views)

You have some insane code in there.

 

Every 200mS read 1 char untill 11 characters have been read (with a 40Sec timeout?)

 

Why not just read 11 chars once?Smiley Wink

 

Holding up the whole loop for a minute if your reading is questionable too.  Read the value finish the iteration! be ready to run another task.

 

You really only need to set the timeout once.  Why not set it to whatever value you want at VISA Configure Serial Port.vi where you left it at the 10Sec default?


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 25
(3,435 Views)

Thanks for the suggestions. Scilogex (the company that makes the stir plate) has told us that there needs to be at least a 50 ms delay between every two bytes. I had increased that time to 200 ms just in case 50 ms wasn't long enough, but have decreased it to 50 ms now since that doesn't seem to be the issue anyway. The stir plate's response is 11 characters long so we get one response each iteration of the loop. 

 

I hadn't realized there was a 10 second timeout in the code (started with an example Labview vi)  so I took out the 40 second timeout.  Thanks for letting me know about that.

0 Kudos
Message 4 of 25
(3,397 Views)

I changed the shift registers to tunnels and the code is running right now (approximately 90 iterations so far).  I'll find out over the weekend what happens. I apologize if this is a basic question, but what kind of indicator would I put on the error wire?  When I tried to connect a string indicator, it showed the wires were the wrong charactor type. Thanks for the suggestions.

0 Kudos
Message 5 of 25
(3,394 Views)

@Alici wrote:

Scilogex (the company that makes the stir plate) has told us that there needs to be at least a 50 ms delay between every two bytes.


Is this for the read or write function? I once had a serial device where you had to input the command 1 byte at a time.

 

mcduff

0 Kudos
Message 6 of 25
(3,388 Views)

It's for the VISA read function.

0 Kudos
Message 7 of 25
(3,386 Views)

Timing does not matter.  If you try to read 11 bytes the read will wait for 11 bytes (or timeout) and read 11 bytes.  YEAH VISA!


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 25
(3,379 Views)

@Alici wrote:

. I apologize if this is a basic question, but what kind of indicator would I put on the error wire? 


Right click on the error wire.  Pick Create Indicator.  Done.

 

The error cluster is not the kind of indicator you'd show on a front panel if you were creating a polished application for an end user.  But is is just fine for a LabVIEW programmer or user for showing what is happening on the error wire.

 

(You can also find the error in control and the error out indicator on the front panel palette User & Dialog section.

0 Kudos
Message 9 of 25
(3,366 Views)

@RavensFan wrote:

@Alici wrote:

. I apologize if this is a basic question, but what kind of indicator would I put on the error wire? 


Right click on the error wire.  Pick Create Indicator.  Done.

 

(You can also find the error in control and the error out indicator on the front panel palette User & Dialog section.


The Controls palettes "Array, Matrix & Cluster" Contain Error In and Error Out or error in (no error) and error out depending on style


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 25
(3,360 Views)