06-25-2009 02:13 PM
06-25-2009 02:42 PM
Using a NI PCI 6601 as an example...
You can either set up the channel and task in DAQmx or you can set it up programmatically in your code; lets look at programmatically in the code.
This is a quick and dirty pic to explain what I am saying below.
Placing something like this in a loop will allow the user to change the duty cycle and frequency of the counter output, thereby changing the speed of the stepper. You may need to use a signal conditioning device in between the DAQ device and the motor, but you will know better as it is your application. If you do need to use a signal conditioning device, be careful that it can handle the range of frequencies you may need to output.
06-26-2009 07:11 AM
I added the above function and I got this error:
200459 "No output channels in this task to which data can be written". I used a global daqmx channel. what am I doing wrong? Thanks.
06-26-2009 08:50 AM
I am not familiar with the product you are using (6216 USB); I assume that the counter/timers on the device are input/output.
If they are not input/output and only input, that would be the problem.
If they are input/output, then the DAQmx channel/task is set as acquire signal when it should be generate signal.
06-26-2009 09:53 AM
Ok, I was able to semi-solve the problem. All I had to do was create a tax and use the physical counter output as the source. I was then able to control the pulse width with Duty Cycle and Frequency. Now I just need to find the best way to keep the memory from running out on me. I may ditch the counter output and go to a simple digital output. At least now I know I can create a virtual wave, control it, and physically output it from the DAQ.
Thanks to those for there advice and help.
06-29-2009 07:38 PM
z2830than,
I hope it's not too late for you, but here's a great developer zone that allows you to do pulse width modulation on just DO lines. You might not need to worry about memory leaks with this code. I hope it helps.