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

Melody,

 

I have attached a shipping example that uses a counter like you have on your 6501 to output a digital pulse train that you will be able to vary the frequency of the pulse train. It also allows you to set the duty cycle for the program, but I would recommend keeping the duty cycle at 50%. If I understood the motor control instructions correctly this VI should work for your application. You will just need to connect the output of the counter on your 6501 to your CLK source on your motor drive. 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 11 of 41
(4,242 Views)

Hey Aaron,

I tried this example, but it seems something wrong here. I attached the revised VI file and the error here. Any help would be appreciated!

Here are the errors: one for the RCT (step number, line 2 in VI) and another for the CLK( frequency line 3 in VI)

 

Error -200430 occurred at DAQmx Create Channel (CO-Pulse Generation-Frequency).vi:2

Possible reason(s):

Measurements: I/O type of the physical channel does not match the I/O type required for the virtual channel you are creating.

Physical Channel Name: port1/line1
Virtual Channel Name: Dev2/port1/line1
I/O Type Required for Virtual Channel: Counter Output

Task Name: _unnamedTask<24>

 

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

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<26>

 

Thanks so much!

Melody

0 Kudos
Message 12 of 41
(4,213 Views)

Melody,

 

Your first error is because the counter has to be output on a specific line to work properly. For the USB-6501, according to the Spec sheet for the device you need to use Port 2 line 7 or P2.7. On the device that is Terminal 9. 

 

You can find that information here: 

http://www.ni.com/pdf/products/us/20054920301101dlr.pdf

 

As far as the second error goes, I believe it is because of the array you are inputting into the DAQmx write function. Are you trying to input an array of 2000 elements? You currently have the array constant indexed to 2000, but it appears from the picture that your data is not initialized. If you want to write 2000 elements, let me know, I will help you with that. 

 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 13 of 41
(4,199 Views)

Hey Aaron,

About the second error, I just want to output a logic number to the motor drive to control how many steps it will run.  Is this can be done by the third line of the program through the COUNTER control? I'm not quite understand what's the duty  cycle mean.

Thank you!

 

Melody

0 Kudos
Message 14 of 41
(4,197 Views)
I seem to remember that the motor drive was going to be controlled by the Counter control. Duty Cycle is basically just a percentage of On/Off time for the digital waveform. For instance a duty cycle of 50% would have equal On/Off time.
Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 15 of 41
(4,193 Views)

Hi Aaron,

1) I connected the P2.7 to the CLK, but still got this error

 

Error -200430 occurred at DAQmx Create Channel (CO-Pulse Generation-Frequency).vi:1

Possible reason(s):

Measurements: I/O type of the physical channel does not match the I/O type required for the virtual channel you are creating.

Physical Channel Name: port2/line7
Virtual Channel Name: Dev2/port2/line7
I/O Type Required for Virtual Channel: Counter Output

Task Name: _unnamedTask<19>

 

2) If I  only use COUNTER control the steeping motor , How can I control how many steps it will run?

 

Melody

0 Kudos
Message 16 of 41
(4,191 Views)

Melody,

 

Can you run the Generate Pulse example by itself and get it to work properly? If you could give that a try and let me know how that works. Also the example is currently set up to generate pulses continuously. You can set the Timing VI to Finite Generation and then give it a number of points that you want it to generate. 

 

Aaron W. 

Applications Engineer

Message Edited by awiseman on 02-02-2009 09:20 AM
0 Kudos
Message 17 of 41
(4,157 Views)

Aaron,

I ran  the Generate Pulse example by itself, but stii got the same error

 

Error -200430 occurred at DAQmx Create Channel (CO-Pulse Generation-Frequency).vi:1

Possible reason(s):

Measurements: I/O type of the physical channel does not match the I/O type required for the virtual channel you are creating.

Physical Channel Name: port2/line7
Virtual Channel Name: Dev2/port2/line7
I/O Type Required for Virtual Channel: Counter Output

Task Name: _unnamedTask<3>

 

Is there any possible reason? I need to get this done including another load cell control and save data parts by this week, as I have a presentation in 2 weeks. Please help.

Thanks

Melody

0 Kudos
Message 18 of 41
(4,144 Views)

Melody,

 

On your front panel, the drop-down control for the Counter name are you able to see a "ctr0" or anything that is "ctr" and use that as your input. This should allow you to use your counter. Let me know how that works.

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 19 of 41
(4,120 Views)

Aaron,

 

Actually in the front panel, there is nothing in the dropdown menu. I have to manually input the 'Dev2\port2\line7'. I also tried to input 'Dev2\ctr0', but got the same error below,

 

Error -200430 occurred at DAQmx Create Channel (CO-Pulse Generation-Frequency).vi:2
Possible reason(s):

Measurements: I/O type of the physical channel does not match the I/O type required for the virtual channel you are creating.

Physical Channel Name: ctr0
Virtual Channel Name: Dev2/ctr0
I/O Type Required for Virtual Channel: Counter Output

Task Name: _unnamedTask<0>

 

But others 'Digital output' similar VI can see all the channels in the drop-down menu.

 

Thank you!

Melody

 

0 Kudos
Message 20 of 41
(4,118 Views)