LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Conditional/Case/Sequence for Controlling Motor Direction

Hello,

 

I am trying to control a motor's direction of turn by sending a high (CW) and low (CCW) signal using LabVIEW. I am reading the encoder values from this motor and I thought of using either a case structure or sequence to control when the direction signal will be activated. 

 

To provide some background, this is how I plan on operating the motor:

 

  1. An upper and lower angle will be specified, which would limit the number of degrees that the motor turns.
  2. When the VI is run, the motor starts at 0° and begins to turn CCW.
  3. When the angle is equal or greater than the upper limit, a digital output line will send out a high signal, which would cause the motor to turn CW. This signal should stay on until the angle reaches the lower angle limit.
  4. This operation will go on until the number of cycles have been reached.

I run into an issue at item 3. I'm unable to come up with a method of keeping that digital signal at high until the lower angle has been reached. The signal returns to low once the angle from the encoder reading is back under the upper limit.

 

I tried using case structures and sequences, but I wasn't very successful. Unfortunately, when I started over I did not save my most recent iteration of my VI, but I've attached what I have now. If there are other methods besides case structures or sequences, I'm open to exploring those as well.

 

Any assistance would be greatly appreciated. Please let me know if I have to provide more details, and I apologize if this is in the wrong section.

 

Device: USB-6212 with Screw Terminals

Software: LabVIEW 2015 SP1 (32-bit)

0 Kudos
Message 1 of 2
(2,286 Views)

I assume you have not taken any of the "Learn LabVIEW" Tutorials mentioned on the first page of this Forum.  Please do so.  Pay attention when they discuss loops (like the While Loop).  Learn about Shift Registers.  Something that they might not say is that you should almost never (need to) use a Sequence Structure (there are some rare cases, but you are not there, yet).

 

Write yourself a description, similar to what you posted, but with a few more details, like how often you want to run the check (you probably do not want to run at maximum speed, i.e. "as fast as I can" -- possibly 100 times per second is adequate).  If you write the description well enough, you should be able to code directly from it (once you learn and understand the concepts in the LabVIEW Basics 1 tutorials).

 

Bob Schor

0 Kudos
Message 2 of 2
(2,251 Views)