01-23-2009 09:59 AM
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.
01-29-2009 09:51 PM
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
01-30-2009 11:42 AM
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.
01-30-2009 12:11 PM
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
01-30-2009 12:58 PM
01-30-2009 02:01 PM
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
02-02-2009 09:20 AM - edited 02-02-2009 09:20 AM
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
02-02-2009 11:51 AM
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
02-03-2009 12:28 PM
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.
02-03-2009 12:49 PM
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