LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to repeat a subVI that has produced an error?

Solved!
Go to solution

I have a subVI (named: G100) in my main program that communicates a command via RS-485 to the board (UUT) that I am creating a test program for. The G100 VI works 90% of the time, but due to ongoing processes on the UUT the G100 command doesn't always go through. The G100 command VI generates an error when this occurs. I was wondering if there was a way to recognize said error, delay for ~3 seconds then repeat the G100 command? I would want to do this maybe 5 times, or until the command was successful. 

0 Kudos
Message 1 of 13
(2,978 Views)

Like this for example:Untitled.png

Certified LabVIEW Architect
Message 2 of 13
(2,965 Views)

This looks good, I'm going to try it.


@thols wrote:

Like this for example:Untitled.png


I'm kinda new, what pallet did you get the 'loop condition' image.png from?

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

Hi Brother,

 

read the help for the FOR loop structure, then right-click the loop border…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 13
(2,946 Views)

@GerdW wrote:

Hi Brother,

 

read the help for the FOR loop structure, then right-click the loop border…


That's great, I had no idea I could add a conditional terminal to a for loop. Thanks!

 

SO, I tried using the for loop like @thols recommended. I guess I should have been a little more specific with my error. I am getting error code 1073676294, documentation says this can safely be ignored if I am not using any information from the error code. The method we just tried doesn't recognize the error code as an actual problem, but the only time I don't get a response from the G100 vi this error has occurred. 

image.png     Can I get this to work somehow>?image.png

0 Kudos
Message 5 of 13
(2,930 Views)
Solution
Accepted by topic author TheWolfmansBrother

Hi Brother,

 


@TheWolfmansBrother wrote:

I guess I should have been a little more specific with my error. I am getting error code 1073676294, documentation says this can safely be ignored if I am not using any information from the error code. The method we just tried doesn't recognize the error code as an actual problem, but the only time I don't get a response from the G100 vi this error has occurred. 


Yes, you should have been more specifc! This is not an "error", it's just a "warning"! (The error status bit is FALSE.)

 


@TheWolfmansBrother wrote:

Can I get this to work somehow>?image.png


Yes.

Instead of comparison you could use UnbundleByName to read the error code from the error cluster and use this as selector value of the case structure. (With LV2019 you can even wire the error cluster to the case structure selector and choose which error codes to handle.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 13
(2,922 Views)

That code is NOT an error.  Why are you worried about it?

 

We can't see how you are actually communicating with the instrument.  My guess, and I certainly hope you aren't doing this, is that you are using the "Bytes at Port" property mode.  As I and several others say, Bytes at Port is the wrong thing to use 99% of the time.

 

As for your 2nd picture, if you had also attached the VI, it would be easier to know for sure, but my guess is that you have the wrong setting on the Equals comparison.  Right click and set the Comparison Mode to Aggregate rather than Elements.

 

But if you do get this warning, your For Loop will not continue anyway since your Error value is False.

0 Kudos
Message 7 of 13
(2,919 Views)

Your guess is incorrect I think. I am not using any property nodes. The warning is generated at the circled VISA Read. image.png

 

0 Kudos
Message 8 of 13
(2,906 Views)

@RavensFan wrote:

As for your 2nd picture, if you had also attached the VI, it would be easier to know for sure, but my guess is that you have the wrong setting on the Equals comparison.  Right click and set the Comparison Mode to Aggregate rather than Elements.


I also suspect the Source string would be populated, so the Equals on the cluster won't work.

GerdW's suggestion to unbundle the code and use Equals on that will work.

You can also use the Clear Errors function, which doesn't require an error (it will also check a warning). Note you have to specify the code to have it output a true value.

 

As RavensFan said though, perhaps reconsider if you're using Bytes at Port. It's usually unnecessary and causes problems.

 

Edit: I see you're not using Bytes at Port from your message (you replied whilst I did).

Does the device return a longer error message? If so, make sure to take care of the left-over bits of that message before just blindly repeating. VISA Clear might be appropriate, but a better method would be to specify a larger number of bytes (100, 1000 etc) then use the Termination Character (if it exists) to parse the messages.

If you don't have a term char, you're more or less stuck with what you have...

 

Edit 2: I see you set Term Char false, presumably because you don't get one?

I'd suggest you might want to try creating a VI to receive the entire array and parse it into a cluster, because currently it's quite difficult to follow.

You could of course index only the bits you want, but I'm guessing you intend to use some of the "First subarray" outputs in the future?

Parsing into a cluster would both clarify the message structure and give you executable code in the place of the comment you have on the block diagram.

You could move the comment into the parsing VI, assuming I understand what it means...


GCentral
Message 9 of 13
(2,897 Views)

Since you are specifying to read exactly 4 bytes, the warning can be ignored. 

 

Certified LabVIEW Architect
0 Kudos
Message 10 of 13
(2,881 Views)