Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6525 6501 digital output to step motor driver

Solved!
Go to solution

Hey Aaron,

I used 'Measurement&Automation Explorer' to exam the USB-6501.  In the 'Test-pane -----Counter I/O---- mode'. there are two options one is 'pulse train gerneration' which is Grey (means no this function or deactived?) and another one is 'edge counter' which is black(active). Is this hardware problem? what should I do in this case?

I also have USB 6525.  I 'm not sure whether it works with my motor control board.

Please help!

 

Melody

0 Kudos
Message 21 of 41
(2,901 Views)

Hey Aaron,

I double checked the USB 6501 document. The counter is desciped as 'falling edge counting'. Does this mean it can not generate pulse train?  I want to back a little bit and try to control through 'enable', 'direction', 'recount' and 'clock'. Please double check the drive board information attached below and give some suggestion about hoe to control running steps and frequency.

Thank you!

 

Melody

0 Kudos
Message 22 of 41
(2,896 Views)

Melody,

 

Looking into the documentation more, it appears as though the USB-6501 can only perform Edge Counting as you indicated in an earlier post. Also looking into the USB-6525 that device is also unable to generate a pulse train. You will need another device to be able to successfully generate a pulse train. This is why you have been getting errors from the DAQmx create channel. Let me know what I can do to help from here. 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 23 of 41
(2,881 Views)

Hey Aaron,

I may buy a new hardware later, but now I try to add one more step to control how many steps the motor will run. Could you please help on that?  From my understanding , give a number to the RCT and monitor the OUTPUT from the motor drive board. Do you have such an example?

Thanks!

 

Melody

0 Kudos
Message 24 of 41
(2,878 Views)

Melody,

 

I have attached two examples. One of them I made custom which provides a software triggered digital pulse. The other is a standard shipping example that can be found by going under the Help Menu in LabVIEW >> Find Examples and searching for Digital Examples. Looking at the manual it looks as though you will have to send a digital pulse and then monitor the output to see if the motor is done. You will have to merge the programs together, but this should give you a good starting point. 

Aaron W.
National Instruments
CLA, CTA and CPI
Download All
0 Kudos
Message 25 of 41
(2,865 Views)

Hi Aaron,

Please recommend a digital I/O that can produce pulse train (for CLK) and static DI/O(for ENA) that fits my drive board. If you need more info about my drive board, please let me know.

 

Thanks!

 

Melody

 

0 Kudos
Message 26 of 41
(2,850 Views)

Melody,

 

There might be one option available for your project that we have not discussed yet. You can actually create a PWM signal on a digital port, the only problem is that it will be software timed and therefore at faster rates (~500 Hz or more) your PWM signal will not always be constant, due to the software timing. The datasheet for your step-motor indicated it can accept a signal of up to 10 kHz, and I am pretty sure that this program will not be accurate for a rate that high, but the datasheet also mentions rates as slow as 50 Hz which this program should be able to complete without too many problems. I would try this program out and see how it works before we recommend new hardware. I have attached the link to the KnowledgeBase article on our website, the example programs are attached at the bottom of the page. 

 

Software-Timed PWM Using a Digital Output Line

http://digital.ni.com/public.nsf/allkb/1561D31534F07D608625727900391114?OpenDocument

 

 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 27 of 41
(2,840 Views)

Hi Aaron,

I'm so excited that PWM works for my motor drive board. Really appreciate your help and consideration. Now I come to the last step of my VI program. And the problem is synchronization. I checked  some example like 'Muti-Device Synch-AI Start Trig-Change Detection'  VI and some online help http://zone.ni.com/devzone/cda/tut/p/id/3615#toc3.  It seems my case is both 'multi-device' and 'multi-function'. 

 

There are three parts in my VI: Part 1(on  the top; USB 6501) is the PWM, Part 2 ( in the middle;  USB-6501) is control 'ENA' and "DIR', part 3 is load cell data acquisition using NI cDAQ-9172 and NI 9237. All of these there works well separately.  The final goal is once I click the 'run' button, the ENA is turned on and the 'CLK' and load cell data acquisition should start together.  I list some of questions here and attached my VI (8.5):

 

1) I did the synchronization for the 'ENA' and 'CLK'. But when I clicked 'run' button, the 'CLK' begins and I have to manually click the 'ENA' button on the front panel to turn on 'ENA'. (Note: the ENA must be keep on to let the 'CLK' work)

 

2) From the examples for multi-device  , It seems I should connect all in series rather than in parallel.  Please give some suggestion to synchronize part 1,2 and part 3.

 

I'm not sure whether it's the right place to post this. But anyway, Please help.

 

Thanks!!!

 

Melody

0 Kudos
Message 28 of 41
(2,820 Views)

Melody,

 

If you want to the enable to be turned on once the clock has been enabled then you will need to make sure that you write a 'true' value to 'ENA' and 'DIR' after the clock has started. Right now it looks as though you are just taking in input from the front panel and not trying to pragmatically enable the 'ENA' and 'DIR' lines. If you are going to want those two lines on when your start your program, just create a boolean constant for the input to the DAQmx Read.VI and set the constants to true, this will pragmatically write out true values once the program runs. 

 

As far as the second question you had goes, you can run items in parallel with LabVIEW but there is no guarantee about which items will execute at what time, when comparing one thread of code to another. For instance if you are running the PWM and Load Cell data in parallel, the PWM might start first during one run of the program, and the next time the load cell may start first. This is because in the program you have not determined the data flow of the program and therefore are allowing Windows to have control over what will happen and when, which may not be the same every time. There is a good explanation of Data Flow here

 

If you do run your code in serial, it will control which items are executed when, because the next VI will have to wait for the input of the previous VI. I would recommend trying to get parts 1 and 2 of your code, the PWM and 'ENA' and 'DIR' to work together first, and then work on adding in the load cell data. Many times it is much easier to take it step by step instead of trying to integrate all the code together at once. 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 29 of 41
(2,804 Views)

Hi Aaron,

Thanks for your suggestion. So I will get the PWM, ENA and DIR work first. Here are some progress and questions.

1) I changed the  'data' to the 'DAQmx Write' to constant 'True' and enable the 'auto start'. So it works well now.

 

2)The 'DIR' doesn't work now. Once the PWM began to run, I click the control button of CLK on the front panel, but it doesn't change the direction.  Should I put the 'DIR' part into the ENA loop or what should I do?

 

3) I tried to change 'one channel for all lines' to ' one channel to each line' for all 'CLK', 'ENA' and 'DIR'. But it poped up an error

Error -200463 occurred at DAQmx Write (Digital 1D Bool 1Chan 1Samp).vi:4

Possible reason(s):

Measurements: Specified read or write operation failed, because the number of lines in the data for a channel does not match the number of lines in the channel.

If you are using the Digital Waveform datatype, make sure the number of lines in the digital waveform matches the number of lines in the channel. If you are using boolean data, make sure the array dimension for lines in the data matches the number of lines in the channel.

Number of Lines in Channel: 1
Number of Lines in Data: 8

Task Name: _unnamedTask<1C3>

 

My guess is that 6501 is not isolated channel to line output, so one channel must control 8 lines in the same port, say port0.0...7.  So in that case, I need to control ENA and DIR separately(ENA always in logical 1 and DIR varies in the middle). Should I just keep  'one channel for all lines' for all three part and connect ENA and CLK and DIR to different ports. So lucky  there are 3 ports in USB-6501.  Am I right?

 

4)How to control or input a number of cycle that the PWM will run ? better to have an control on the front panel. Everything will pause when finish the preset cycles and restart until I press a button.

 

Thanks!

 

Melody

 

0 Kudos
Message 30 of 41
(2,795 Views)