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.
04-15-2015 06:31 AM
Hello
I'm working on project with labview .
with this program i connecting PC to the MCU through sreial RTU modbus .
in this program there are some data need to be read and some data need to write .
what i need is most of my time reading polet exuted exept when some of control element (like edit box) has changed by user .
when ever some thing changed by user write polet excuted .
now what is the best way to do this ?
Best Regards.
Solved! Go to Solution.
04-15-2015 06:45 AM
Event Structure inside of a While loop. With the event structure, you detect the changing of values and send the appropriate commands. You could use the Timeout case for reading the status from the MCU.
04-15-2015 07:35 AM
Thanks crossrluz
I did it but with this way while loop's stop button dosen't work !
Best regards
04-15-2015 07:38 AM
Code? It is impossible to debug your application without it.
04-15-2015 08:05 AM - edited 04-15-2015 08:10 AM
sorry you are right .
04-15-2015 08:28 AM
It works for me. Granted, I had to remove all of the Modbus communications in order to run it. Are the statuses taking a long time to come in? I would also recommend using an event case for the stop button.
04-15-2015 08:36 AM
Here is a good "rule" that will help your LabVIEW coding -- NEVER use a Stacked Frame! If you want to do a multi-step procedure on a set of variables, use a State Machine, a While loop inside of which is a Case Statement, with something wired to the Case Selector that "steps" you through the various steps. Use Shift Registers on the While loop to pass the variables seamlessly from one Case to the next (none of these "the wire goes out on this edge and pops back in over there" guesswork with Stacked sequences). Note that you can also use a For loop and wire the Loop Index to your Case Selector to do Steps 0, 1, 2, 3 (you'll need to add a "default" case in this model). Here is a snippet, where the Enum has been given the less-than-descriptive names "Step 1", "Step 2", etc. If using a While, wire the last Case to the Stop indicator, of course.
Here is a Very Simple example.
Bob Schor
04-15-2015 08:40 AM
Thanks
I think my USb->Serial had problem after restart my pc my code work too.
this is my Secend project with labview. i'll be happy if you have any comment about my code .
best Regards .
04-15-2015 09:08 AM
Thanks Bob
What uou said sound complicated to me .
i'm trying to undrestand your solution .
i'll be happy if you upload sample program .
04-15-2015 09:13 AM
mori64 wrote:
What uou said sound complicated to me .
i'm trying to undrestand your solution .
i'll be happy if you upload sample program .