LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger Event Structure Case on Startup

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

 

 

0 Kudos
Message 1 of 9
(5,357 Views)

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.

0 Kudos
Message 2 of 9
(5,354 Views)

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

0 Kudos
Message 3 of 9
(5,346 Views)

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

 

 

 

0 Kudos
Message 4 of 9
(5,340 Views)

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.

 

 

Message 5 of 9
(5,337 Views)

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

 

 

0 Kudos
Message 6 of 9
(5,327 Views)

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.

0 Kudos
Message 7 of 9
(5,325 Views)

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.

=====================
LabVIEW 2012


Message 8 of 9
(5,322 Views)

See also my comments and links to old discussions here.

0 Kudos
Message 9 of 9
(5,315 Views)