03-11-2007 07:50 PM
DAQmxCreateCOPulseChanFreq(taskHandle,
"Dev2/ctr3","",DAQmx_Val_Hz,DAQmx_Val_Low,0.0,rate,0.50);DAQmxCfgImplicitTiming(taskHandle,DAQmx_Val_ContSamps,1000));
DAQmxCreateCIAngEncoderChan(taskHandle1,
"Dev2/ctr0","",DAQmx_Val_X4,FALSE,0.0,DAQmx_Val_ALowBLow,DAQmx_Val_Radians,4000,0.0,"");DAQmxCfgSampClkTiming(taskHandle1,
"/Dev2/PFI24",rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,NULL);DAQmxCreateCIAngEncoderChan(taskHandle2,
"Dev2/ctr1","",DAQmx_Val_X4,FALSE,0.0,DAQmx_Val_ALowBLow,DAQmx_Val_Radians,2000,0.0,"");DAQmxCfgSampClkTiming (taskHandle2,
"/Dev2/PFI24",rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,NULL);DAQmxCreateCILinEncoderChan (taskHandle3,
"Dev2/ctr2","",DAQmx_Val_X4,FALSE,0.0,DAQmx_Val_ALowBLow,DAQmx_Val_Inches,0.00096,20.5,""); DAQmxCfgSampClkTiming (taskHandle3,"/Dev2/PFI24",rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,NULL);This works if I only use one encoder, but if I use all three I get an error: "No DMA channels are available. Either shut down other tasks that might be using these channels or consider changing your data transfer mechanism to interrupts."
Do I need a seperate clock for each encoder? What am I doing wrong? I have two other DAQ boards in my computer, a 6071E and a 6229. They have extra counters but I don't know how to route their signals to the 6601.
Also, when I go to calculate my velocity and acceleration I'm having a hard time finding a good buffer size/sampling rate to yield a smooth-ish acceleration with quick response. Any tips?
Any advice on this would be great. Thank you!
03-11-2007 08:19 PM
Ok. I realized if I set this:
DAQmxSetCIDataXferMech(taskHandle1,
"Dev2/ctr0",DAQmx_Val_Interrupts);for each counter then I can read everything just fine. I don't know what type of hit I'll take in terms of speed using IRQ instead of DMA (seems slower). Is there anyways to do this using DMA? I can read from three counters just fine without this timing issue...
Also I don't have the clock "physically" wired into the counter.
I still don't know how to get the acceleration with fast response and high accuracy.
warmest regards to anyone who can help.
03-11-2007 09:00 PM
03-11-2007 11:45 PM - edited 03-11-2007 11:45 PM
Alright, more progress. Instead of using the buffered input I'm now using seperate counters to get the frequency of my encoder inputs. I then use that freq (pulse/s) times the resoultion (rad/pulse) of my encoder to get Velocity. I set the directionality by looking at the current and last positions.
Anyone know how to get acceleration from the frequency measurement?
Message Edited by Ixstala on 03-11-2007 11:46 PM
03-12-2007 04:08 AM
03-12-2007 11:13 AM