05-02-2021 07:08 AM
hello everyone,
I'm new to labview (i have Labview 2019) and I'm working on small project which is reading holding register program of a PID regulateur using modbus library throught serial connection RS485, in order to establishe the connection between my program and the machine i created a start button my goal is to run the the program through this button instead of the traditionl run vi i tried to work with states machine but the program freez once i push the start button and the others button stop working i know i made a mistake somewhere_( in the visible property node button most likely ) but i cant seem to locate it I'm hoping you guys can help me.
i have attached the code below.
thanks in advance.
05-02-2021
10:46 AM
- last edited on
06-17-2025
06:20 PM
by
Content Cleaner
You have an event structure buried inside a case structure. And it's Start Value Change case is set to the LabVIEW default of Lock Front Panel Until Event Case Completes. Also Connect/Disconnect Value Change
Read Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2016 Help
The problem is if you hit one of those buttons, it locks the front panel, but if that event structure never gets to be executed because of the flow of your state machine, you'll lock up your VI.
A simple fix *might* be to set those event cases to not lock the front panel. But in general, the VI architecture should be such that the event structure gets handled frequently no matter what state you're in. That means not burying them in a case structure and bring them up a level or two.
05-03-2021 04:01 AM
hi there thank you for helpping me i tried what you suggested on a more simple block diagram i unlocked the front panel and it worked however the start button is still not working.
i have attached the code below
05-03-2021 07:38 AM
I can't comment on the start button now. But I do see a huge problem with your queue.
When the timeout case of the event structure runs, since it doesn't wire through the queue reference, it will replace it with an empty reference and your queue will never run again. Right click on those tunnels on the event structure and uncheck "Use Default if Unwired".
05-03-2021 08:02 AM
OK donne is this correct ?
05-03-2021 09:34 AM
That fixed the wiring problem. Is it working correctly now?
05-03-2021 12:00 PM
well its not blocking anymore and its connected to the machine but it doesnt read my register value
05-03-2021 12:52 PM - edited 05-03-2021 12:54 PM
Your Modbus register is only read once because it isn't in a loop. It is in a flat sequence structure outside of the loop, and even that flat sequence structure is unnecessary.
Why didn't you put your Modbus read inside the loop?
05-03-2021 01:06 PM - edited 05-03-2021 01:08 PM
i guess i was trying to work with supvi which didnt work i spend the whole day wasting my time with it cuz i want my program to identify my machine through the unit ID which is add 01 then start reading the rest of registers adds cuz after this i will be reading add from two machine and i need to identify each of them to not mix the whole process