LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DC motor directional control

Attached is how you can take the 3 different types of signals and combine them to be the two outputs.

0 Kudos
Message 21 of 47
(1,948 Views)

Hi, thank you I appreciate the reply. Can you clarify, I'm not able to make this work. 

 

I'm getting error -200428: Value passed to the Task/Channels In control is invalid. The value must refer to a valid task or valid virtual channels. Can I swap the DAQmx Write function with an Express VI for DAQ Out? I'm more comfortable working with Express VI's as I've just began learning LabView this month.

 

I'm not clear what you've done inside the event structure in the center. Where does this incorporate the logic to determine the motor direction? The way I'm reading it, I am simply seeing it as mixing 2 of the 3 signals into one array and outputting that.

But the challenge is to make that output happen over a one pin or the other (based on whether you want fwd/rvs motion), which I'm not seeing here. Perhaps that's why you need the DAQmx? Am I getting warmer? 

0 Kudos
Message 22 of 47
(1,941 Views)

I didn't add all the code to create the task, just the basics of how to "select" the output waveforms.

 

You can switch it out for an Express VI.  But you really should learn how to use real LabVIEW.

 

Learn 10 Functions in NI-DAQmx and Handle 80% of Your Data Acquisition Applications

0 Kudos
Message 23 of 47
(1,938 Views)

Thanks for the helpful link. I intend on learning more as I become more familiar with the software, this is helpful.

 

I swapped for the Express DAQ output subvi. What I'm failing to see is how this will actually help reverse which lead of the motor gets the power? To me it just seems like we're controlling what information is sent to the motor, but not the lead it is sent to which is critical in deciding on the direction. 

 

thanks for your patience, this thread has been going on for awfully long.

I'm just really frustrated and out of ideas now as this is going over my head.

0 Kudos
Message 24 of 47
(1,936 Views)

Hi mm,

 

after reading the manual you should know by now you don't need to switch any "leads"!

All you need is to output the correct signals to your motor driver...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 25 of 47
(1,926 Views)

Hi,

 

Thanks, I realize that. Here is what I've done:

image.png

 

 

I'm using the logic here to get the rotation. 
 
I've set up my DAQ to supply PWM out of 1 analog output and a 0V DC out the other and am using a case structure to vary between swapping the PWM signal to one output card to the other and vice versa for the 0V DC. Case structure logic shown below (I've also attached the .vi file for more inspection):image.png

 

 

However, this gives me an error that 'The specified resource is reserved. The operation could not be completed as specified.' 
Upon research, it appears USB 6001 can not do simultaneous data read/write operations due to computational resource restrictions, thus this error.
 
Can you guide me through this error? Thank you.
0 Kudos
Message 26 of 47
(1,923 Views)

Hi mm,

 

Can you guide me through this error? Thank you.

Simple solution: use DAQmx functions instead of (excessively) ExpressVIs!

 

See this snippet:

check.png

To replace the DAQAssistent by DAQmx functions is quite easy after going through the example VIs coming with LabVIEW! For the WfSigGen functions I used the parameters of your ExpressVIs…

(The main point here is to create just ONE task including both ao0 and ao1 channels!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 27 of 47
(1,920 Views)

Can you please attach the .vi you've pictured? I can find the blocks you've used then with more ease.

0 Kudos
Message 28 of 47
(1,910 Views)

That image is a VI snippet.  Download the image and save it to your hard drive.  Then drag the image file to your block diagram.

0 Kudos
Message 29 of 47
(1,906 Views)

Is this for all Labview versions, because this is not working for me. It just puts it as an image inside Labview, does not recreate the code as it should. I attempted trouble shooting online and I think I'm doing it the right way.

 

Saving the snippet as a .png and then drag and dropping into my block diagram.

0 Kudos
Message 30 of 47
(1,903 Views)