LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Case Structure Input Tunnel

Solved!
Go to solution

I am working on a serial controller for a custom serial device.  In doing optimization to cut down on number of serial calls needed I have run into an issue.  A case structure is being used to flip between a read and write mode depending on whether 2 array elements are equal or different. The read mode is looped through continuosly until the user inputs a variable, then it is supposed to write the value to a location given by an indexed string array element then switch back to read mode.  The mechanics behind this all work fine, but when in write mode, the location string array element is passed into the structure as blank.  All other data passes into the loop fine, and when in read mode the string array element is passed in fine. I am guessing it must be a timing /race issue, but can not for the life of me figure out how to solve it.

 

I have attached a snippet of the offending case statement, both read and write cases.  All lines are properly attached but apparently snippets detach them before making a picture from them, the progam will run in it's full form. Sorry if it's a mess, this is my first Labview program.

0 Kudos
Message 1 of 6
(3,531 Views)

You need to include all code in the snippet. Currently there are tons of broken wires because most controls are missing. Why not attach the actual VI?

0 Kudos
Message 2 of 6
(3,500 Views)

Good to know about snippets,  I have attached the vi.

0 Kudos
Message 3 of 6
(3,488 Views)
Solution
Accepted by topic author Argon522

Hi Argon522,

 

Thanks for attaching the VI. Given that this is your first LabVIEW program, have you had a chance to use the debugging tools available to probe lines and watch the execution of your code?

 

Debugging Tools in LabVIEW

https://www.ni.com/getting-started/labview-basics/debug

 

Unfortunately because it appears you may have some custom subVIs created, I cannot run and probe the data itself. From a troubleshooting standpoint given the size of your code I might suggest adding comments to your code (double left click anywhere on the BD or FP to add a text box), and consider adding a Select VI to pass 'Read' and 'Write' versus true and false in your cases for added clarity (unless your code is absolutely time critical). 

 

This will make it easier for viewers to debug instead of having to navigate through all of the code. I'll continue to analyze your code on my end. On your end I would recommend setting probes at some of the critical points of your code as well as using highlight execution to see where the error may be occuring. If you are not familiar with the highlight execution tool, note that it will slow down the execution of your code. In the case of a race condition, slowing down the code may indeed make it function correctly, not exposing the run time error.

 

Keep me posted with any updates and I'll do the same.

 

Regards,

 

Finch Train

 

 

0 Kudos
Message 4 of 6
(3,379 Views)

Hi FinchTrain,

 

Thank you for the tips.  After having some time with the debugging tools I found the error was actually caused by blank elements in the string array.  They were desyncing the location array with the constants and, of course, passing in as blanks when called.  Unfortunately the array border wasn't dragged out far enough to show them.  Thank you for your time and help.

0 Kudos
Message 5 of 6
(3,358 Views)

Hi Argon522,

 

Anytime. Glad to hear you've been able to fix the issue!

 

Regards,

 

Finch Train

0 Kudos
Message 6 of 6
(3,355 Views)