From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-23-2015 07:33 AM
Without restructuring your code I can reduce the number of local variables by 3 and still give you the same functionality.
There is zero purpose to reading a control value, and then writing that value back to that same control. And that is what you are doing. You are also reading that controls value in two other locals, right next to the terminal. Why do this when the data is right there available for you? Local variables can make debugging difficult, and the number of them used should be kept to a minimum. This doesn't mean "Never use local variables", this means "Use them when appropriate, but choose to read from the terminal first, and use locals only when the data isn't easily available on a wire."
Also if you want to get real fancy you should look into the event structure which can generate events as a control value changes, which can simplify code because you don't need to constantly poll values.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-23-2015 07:41 AM
Can you give me an exemple using the event with my code please ?
06-23-2015 08:07 AM
It'll look something like this:
06-23-2015 08:11 AM
Run the attached VI. Entering Hi or Hello will turn on the LED for that value. Notice the loop doesn't poll and only performs an action if the user closes the window, or changes the value in the string. I also show an alternate way of doing the same check, using an array of strings to check.
In the future post code not pictures. Pictures cannot be ran.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-23-2015 08:12 AM
Are you trying to verify a string "chaine" is a particular value? If so, try using an Event structure with a Value Change event for the string value. Within the Value Change event, add a Case structure with the NewValue of the string as the input with multiple cases containing your valid string values.
06-23-2015 09:55 AM
Ok thanks you very much for your example guys. I will try to adapt it for my IT application.