LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically click latched button

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?

0 Kudos
Message 1 of 9
(4,257 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 9
(4,253 Views)

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.

0 Kudos
Message 3 of 9
(4,241 Views)

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:

  • Do you want/need a Button to do the Jog, or will it start "automatically" after you push Save?
  • If "Save" runs the Jog, then you do not want a Jog "Button" (note -- a Jog indicator to show when Jog is running would be fine, and no problem).
  • Did you understand Norbert's comment?  To see the Producer/Consumer Design Pattern he described, open LabVIEW, click File, New ... (the dots are important), look for From Templates, Design Patterns (Events) and study what gets generated.

Bob Schor

0 Kudos
Message 4 of 9
(4,224 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 9
(4,219 Views)

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.

 

0 Kudos
Message 6 of 9
(4,193 Views)

@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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 9
(4,186 Views)

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.

Download All
0 Kudos
Message 8 of 9
(4,151 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 9
(4,116 Views)