06-18-2012 09:10 AM
Hello,
Within my project, I am controlling a linear actuator via Modbus TCP, with an event structure within a loop. I control its velocity, acceleration ... etc. It works beautifully, but I must change the values of the mentioned parameters to trigger the event cases, after startup. I would like to trigger the event on startup of the program and take the current values on the front panel.
I have heard about "Property: Value(Signaling)", but I cant seem to understand it and how to implement it..
Any guidance and help would be appreciated!
Thanks,
Danny
06-18-2012 09:27 AM
You write a value to it. The control becomes that value and will trigger the event case that is registered for value changes of that control.
If you just want to use the current value of the control and don't actually want to change it, then read the value property node for that control and write the value back to the Value(Signalling) property node.
To make sure your code will execute at the beginning of your program, either put it in an initialization case in your state machine, or even just by wire up the error wires to the main loop of your code to guarantee these execute before your main code.
06-18-2012 09:35 AM
Danny,
Other alternatives:
1. Use a Producer/Consumer (Events) architecture. Have a state machine in the Consumer. In the initialization state, read the controls and write to the actuator accordingly. This is similar to what Ravbens Fan suggested.
2. Use a timeout event with the initial timeout set to 0. After it executes set the timeout to -1.
Lynn
06-18-2012 09:46 AM
Hey Lynn,
They cases in my event structure:
[0] Timeout --> read registers and coils
[1] Write to Registers --> inputs velocities and accelerations (triggered via Value Change)
[2] Write to Coils --> initiate movements
I would like case[1] to trigger on startup
I have trouble understanding "2. Use a timeout event with the initial timeout set to 0. After it executes set the timeout to -1." I dont understand what you mean by intial timeout set to 0 and change to -1. Little new to labview.
If you mind expanding,
Thanks,
Danny
06-18-2012 09:51 AM - edited 06-18-2012 09:51 AM
It won't work for you because you already have something designated for the timeout case, and you want a different event case than that to run on startup.
But, here is the explanation.
At the top left of the event structure is the timeout terminal. The number you wire in there tells how frequent the timeout case could execute. If you put a 0 constant outside of your loop and wire it into that terminal through a shift register, it will execute immediately or almost so. After the event structure, wire a -1 into the right hand shift register. Then after successive iteration, the timeout case will be disabled.
06-18-2012 10:13 AM
Thanks for the explanation.
I just decided to have another Write to Registers VI before my loop and event structure so it can take the initial values that the user wants for the motor.
It is an amateur way of doing it, but it works...
Thanks,
Danny
06-18-2012 10:16 AM
That is a perfectly acceptable way to do it. And I wouldn't consider it amateur. If you have your code wrapped up in a subVI, it is a good reuse of that subVI.
06-18-2012 10:19 AM
Here is another general point to remember about the timeout case. It is not related to what you are doing here but maybe some day you will use the timeout in such a way that this could be important. The timeout will only execute if no other events are received in the specified time. If you have your timeout set to 500mS and any other events occur every 200mS, your timeout will never execute. If you need an event to fire every 500mS it is best to use a separate loop that generates a user event or maybe a Val(Signaling) event.
06-18-2012 10:42 AM
See also my comments and links to old discussions here.