LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run vi continuously when VISA read timeout happens

Solved!
Go to solution
Hi ongeelim, I have the VISA open for both of them outside this SubVI, do I have to repeat them here? There are flaws in this one as I should put the error code node after the VISA read (I did have tried that way but didn't save it I guess). Do you mean that I should put the whole case structure outside the while loop, and the while loop will stop when there is an error? What if the whole SubVI is in a big while loop in my VI? Does it matter? Maybe I should upload the whole VI next Monday, but it is a big mess. Thank you for your help. It is really kind of you.
0 Kudos
Message 11 of 17
(614 Views)

Oh wait, the diagram that you've posted is the SubVI.

 

Sorry, I wasn't paying attention to it.

 

Since you're using the subVI and you have VISA Open and Close functions outside the subVI, then you do not need them in the subVI. So, just remove all the VISA Open and Close function, and more importantly, remove Simple Error Handler.vi and the Stop function (Because you'll still need the main VI to continue running and pass on any errors detected outside of the subVI to the next function until the end of the main VI).



See that button on the left side of this post...

If you feel my post is helpful, all you need is just (at most) 2 seconds to click that button, to show your appreciation. Thank you~~



0 Kudos
Message 12 of 17
(605 Views)

Hi ongeelim

 

Here is my whole VI. I am not sure if you can run it without the driver for ag33xx and DSO6000. I have tried to put a indicater (Read?) after the VISA read. however, the light was not turned on and it means that the program still stops at the VISA read. Also, I put the VISA close and STOP in the case box cause I want the program to stop there if the error occours. 

Download All
0 Kudos
Message 13 of 17
(575 Views)

Hi Lawrence,

 

I was unable to get access to the block diagram since your code is password-protected. From what I've observed from the attached images (subVI_2.JPG), is that the Read? indicator will only light up if the error code is equal to 1073807339. (It should be -1073807339 (timeout error code), not 1073807339)

 

But you mentioned that the LED indicator was not turned on and it means that the program still stops at the VISA read. The statement and label of your LED indicator is contradicting and confusing. What are trying to achieve from using the LED indicator (Read? ). Are you using the indicator to determine whether the read operation is completed or check if the timeout error has occurred.

 

And based on your code, regardless of whether there will be an error occurred, there's no way the program will terminate at VISA Read because the error information will eventually pass to the next function.



See that button on the left side of this post...

If you feel my post is helpful, all you need is just (at most) 2 seconds to click that button, to show your appreciation. Thank you~~



Message 14 of 17
(550 Views)

Hi ongeelim

 

Thank you for pointing out the code is -XXXXXXXX. I just had a test with his code and you are absolutely right as the program continues to the next function. For the LED, I put it in just to see if the program reads the next function (so the label is "read?"). Forget it now. 

 

I think the problem now shall be solved (while, there wasn't a problem indeed but confusions).

 

I forgot that I had a password-protection, sorry. The code is "yichi". I would be grateful if you have time to have a look at my code and help me to improve it. 

0 Kudos
Message 15 of 17
(542 Views)
Solution
Accepted by topic author LawrenceUNSW

Your code should be doing fine (although there are small improvements you can make to improve), but there's too much wires going around the block diagram and can be a bit messy.

 

What I can recommend for you is to try grouping, if possible, all the inputs into 1 cluster, to make the entire block diagram neater. Here are the links to know more about clusters.

http://www.ni.com/gettingstarted/labviewbasics/datastructures.htm#Clusters

http://www.ni.com/white-paper/7571/en/



See that button on the left side of this post...

If you feel my post is helpful, all you need is just (at most) 2 seconds to click that button, to show your appreciation. Thank you~~



Message 16 of 17
(529 Views)

Thank you, ongeelim. I am more confident now. I will try to make it neaty. I was feeling the same way, too. 

0 Kudos
Message 17 of 17
(512 Views)