11-02-2016 05:53 AM
I'm relatively new to LabVIEW so pardon my ignorance. I have a motor that moves when a 'Jog' button is clicked. The mechanical action of the button is set to Latch when Pressed.
I need to synchronize the motor movement with a data logging operation. I use a 'Save' button to start logging, which is set to Switch when Pressed. I want to start the motor movement x seconds after the logging starts. The flow I want is Run VI -> click Save -> wait for 2 seconds -> Jog automatically clicked -> Stop VI
How do I go about programming the click action for the 'Jog' button?
11-02-2016 05:55 AM
It sounds like you are looking for Producer/Consumer architecture.
Note that you could add an additional timing loop taking care about automizing the 'real consumer'.
Norbert
11-02-2016 06:09 AM
The 'Jog' button is part of a cluster which is an input to a SubVI that executes the motor movement. I'm not sure how to add a timing loop in this case.
11-02-2016 07:08 AM
As you've probably discovered, Boolean Controls set to Latch (usually Latch when Released, but probably also Latch when Pressed) can't be programmatically "Clicked" (via a Property Node). So a few questions:
Bob Schor
11-02-2016 07:17 AM
If you could supply some code to us, we could likely give a lot better advice. From what I am hearing, we are talking about a rearchitecture simply because we do not know the point at which your code is at.
11-02-2016 08:44 AM
Hi Bob,
I'm working with two separate devices, an NI DAQ and a motion controller. I need some sort of a trigger for the Jog. Currently, it's a separate button ("Jog To") which starts the motor movement when pushed. Pushing Save starts the data logging from DAQ but not the Jog. There are Jog indicators which I use for status check.
I didn't understand Norbert's comment earlier. I will check out Producer/Consumer Design Pattern.
Hi crossrulz,
I have attached my code here. The subVIs require an instrument driver which I've uploaded here: https://www.dropbox.com/s/d83fhhgxa8xs15b/PMACPanelPro2.iso?dl=0
In this code, the DAQ starts saving data when a certain motor status is true. The status is sent by the controller as soon as it receives any command - Jog or Home in this case when "Jog To" or "Home" is pushed.
What I want to do is to start logging the data and then Jog the motor after a few seconds.
11-02-2016 08:48 AM - edited 11-02-2016 08:49 AM
@s.vignesh wrote:
[...]I didn't understand Norbert's comment earlier. I will check out Producer/Consumer Design Pattern.
[...]
The idea is to have a consumer which performs the motion control and one for DAQ. Your producer tells these consumer what/when to do. Your producer does this by pressing the button(s).
However, you could add another process which sends the very same commands to the consumers but does this in an automized and timed manner.
Norbert
11-02-2016 01:20 PM
Is it something to do with state machine?
I tried the attached code but can't seem to get it working. The 2 second delay seems to generate a DAQ buffer error. I've never worked with state machine before, so again, pardon my ignorance.
11-03-2016 02:46 AM
Without looking into the code in detail, i can tell you that you did NOT implement a state machine.
In a state machine, most of the functional code is INSIDE of the states aka. cases, not outside.
Producer/Consumer consists of at least two loops running in parallel. You require this in order to split ongoing tasks (DAQ IO) with controlling tasks (UI interaction, automization).
Norbert