11-05-2019 06:39 AM
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.
Solved! Go to Solution.
11-05-2019 06:51 AM
11-05-2019 07:03 AM
This looks good, I'm going to try it.
@thols wrote:
Like this for example:
I'm kinda new, what pallet did you get the 'loop condition' from?
11-05-2019 07:12 AM
11-05-2019 07:42 AM
@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.
Can I get this to work somehow>?
11-05-2019 07:53 AM
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>?
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.)
11-05-2019 07:58 AM - edited 11-05-2019 08:00 AM
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.
11-05-2019 08:13 AM - edited 11-05-2019 08:23 AM
Your guess is incorrect I think. I am not using any property nodes. The warning is generated at the circled VISA Read.
11-05-2019 08:18 AM - edited 11-05-2019 08:25 AM
@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...
11-05-2019 08:24 AM