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.
10-19-2016 09:47 AM
@ICCR-Lab wrote:I have been told to use a producer - consummer VI. But I am quite new to Labview and beside my research I don't really understand/ see how to transform my code into P-C version.
Help !! 😞
Take the Core 1 training. You can go through it in 3 days...At the end you will understand how to design state machines.
10-19-2016 09:54 AM
Another advice, do not use your actual VI for testing other examples, in the VI which you attached, I can see 2 Event Structures, 2 Notifiers, and 1 Queue... Taking some training would really help you, if you have licence, you have also free access to the Core1-2-3 training material online...
10-19-2016 09:56 AM
That will sound wrong, but I don't have 3 days... maybe in November, but this as to be due by friday 😕
10-19-2016 10:05 AM - edited 10-19-2016 10:07 AM
I am not sure, but that kind of overusage of local variables looks also dangerous. I hope this code does not need to control hardware equipment where human injury can happen.
Anyway, if somehow this code can run for you, and only that msg part is the problem, just use a single Notifier as I wrote. Delete that other loops with the second Event Structure and the Queue. What do you get now? I cannot test your code, since I do not have the HW you have, also many subVIs are missing...
edit: the other problem is that, you send Notification at every iteration of the While loop. Put the SEnd Notification into the corresponding Event case, delete it from the main While loop!
10-19-2016 10:44 AM
ok, here a slightly modified VI, But, If the message stays , it doesn't seem to correctly works once I do another action (click on another button for example).
Also, when I stop the VI I get an error.
10-19-2016 01:17 PM
You did not do what I have asked for. See my above post. I can still see that extra two loops (with the Queue test), and also the "Stop condition" Notifier (also that error wire goes backward in a silly way from that Send Notification at the top right of the main While loop, you even have a Feedback node on it, by accident??). It is really difficult to follow what your code should do, it is a nice spagetti monster...
I put here a little example how a single Notifier could be used to send msgs alongside with an Event Structure:
10-19-2016 02:05 PM
All these suggestion seem way too convoluted. All you need is a shift register to keep the current message unless a new message arrives or a certain time has elapsed.
This would need minimal changes to your current code.
Don't overcomplicate things with multiple loops and queues and such!
10-19-2016 02:17 PM - edited 10-19-2016 02:28 PM
altenbach wrote:Don't overcomplicate things with multiple loops and queues and such!
Here's what I had in mind. Right now it will display the last message until it is overwritten by a new message. It would be trivial to modify to e.g. reset the message to an empty string after a certain time or even to display the last N message, each with a timestamp, for example. Modify as needed.
(Also note that the terminal of the OK button belongs inside it's event case. There should be an event for the stop button and since you are discarding all decimals anyway, the numeric input should be integer (blue!). Your Visa session needs to be wired across the other cases, else closing it will fail if the timeout case is the last event executed.)
10-20-2016 04:32 AM
waouh, what a very easy and convinient way to do the job !!
The simple VI I showed you is just an simplified version of my (very messy) code.
And it works perfectly fine !!!
Thank you !
10-20-2016 10:54 AM
Also note that if "numeric" is a user control, you can define the allowed input range in the control (right-click...data entry...). Once you do that, the values are always in range (because out of range entries can no longer be entered!) and you can even eliminate the inner case structure and the in range function.