LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run the two events at the same time by using event structure

In my project, I have to run two stepper motor which can run both forward and reverse direction by changing the control in front panel so I am using event structure. In front panel I gave two separate controls for both stepper motor such as forward,reverse and stop. I would like to do motor1 will rotate alone, motor2 will rotate alone and both motor will rotate at the same time when user click the control in front panel. My doubt is how to run a motor2 while motor1 is running at the same time please tell me the suggestion for this problem

 

 

0 Kudos
Message 1 of 7
(4,246 Views)

How do you control your motors?

Most motion control systems do supply two modes:

a) position based motion: The motion axis has a positioning system (most often some kind of encoder system) which enables the motion control to know where the axis is currently located. Passing the target location to the controller will result in the axis to move to that location. This is, for most applications, the recommended approach. It does require some sort of motion controller device.

b) direction based motion: This essentially tells the periphery device for the motor to move at a certain speed into a certain direction. As it does not stop at a dedicated location, it induces great risks for many applications if there are no kill- and/or end-switches. Depending on the setup, this can be either done with motion controllers or pure by software control (e.g. "controlling" the voltage level for the motor).

 

If you go for a), there is not much preventing parallelism as you request.

Option b) depends on the setup. If you have a control loop in the software itself, you have to move to an architecture like the producer/consumer. Please note that this does not incorporate any security measures for the external devices.

 

hope this helps,

Norbert

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

I am using stepper motor it is not continuous motor. Motor having four coils that is stator and rotor is a permanent magnet. When I energies the one coil it will become electromagnet magnet so rotor will try to attract it that is movement of motor I will suppose to give single pulse(voltage) to motor through the driver circuit and then it will move only one step. If I give continuous pulse(voltage) motor will rotate continously us assume ABCD are four coils if i give pulse to ABCD continuously motor will rotate in clockwise direction and if I give pulse to DCBA, the motor will rotate in anticlockwise direction.

 

Two motors having separate driver circuit. Shall I use two event structure in single vi ? Is it correct or wrong ? That is motor1 controls are used in one event structure and motor2 controls are used in another event structure.  Both event structure are run in parallel

0 Kudos
Message 3 of 7
(4,199 Views)

My question regarding "how do you control the motors" refers to the hardware you are using to connect to the motors.

Do you really use an AO device to connect directly to the motor?

Or are you using motion control boxes like the AKD drives (ok, these are for servo motors...)?

 

Refer to this document for a better overview on motion options.

 

Norbert

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

I am using AO device Labjack U12 http://labjack.com/u12 i am not using control boxes like AKD devices

0 Kudos
Message 5 of 7
(4,184 Views)

Wow, talk about making life difficult for yourself! Your'e actually writing the motion controller in the PC as opposed to using one of the ones that already exist out there....

 

Best bet is probably to have a few parallel loops run in producer/consumer mode. So in loop one have your event case, in loop two have a state machine controlling motor one, and in loop three have a state machine controlling motor two. If you drive the state machines using queueus (as per producer/consumer loops) then all you need to do is queue an element from the event case to get the motors to respond.

 

Two event cases on one VI isn't usually a good idea...

0 Kudos
Message 6 of 7
(4,160 Views)

One possibility is to create an event for single steps (one event for each motor).  Then, you can alternate between the two event states until both have reached their destination (take care when they have different number of steps; which should be both times).  While they aren't technically moving simultaneously, it will appear so to the end user (alternations are faster than human perception).

 

http://forums.ni.com/t5/LabVIEW/event-structure-have-one-event-trigger-another-event/m-p/1895739/hig...

 

In the event where the number of steps are different, you can use logic to determine whether to repeat motor 1 or go to motor 2.

 

Even number of steps:  M1, M2, M1, M2, M1, M2, M1, M2, M1, M2, M1, M2.......

 

Uneven number: M1, M1, M2, M1, M1, M2, M1, M1, M2......

0 Kudos
Message 7 of 7
(4,131 Views)