Hi, I´ve got two major problems when trying to measure position with quadrature encoders in Labview 7.1 / windows XP SP1 / NI DAQmx 7.3
Some unknown computer/software compatibility error leaves me no choice but to use DAQmx instead of the traditional DAQ...
First : MAX tells me that "No DMA channels are available" when trying to aquire the position of multiple counters. (I know that something happens when using more than 3 counters simultaneously.) It also says "try to change your data transfer mechanism to interrupts" . How do I do that ?
Second : When tying to aquire from more than one channel, DAQmx says that "Read cannot be performed because this version of DAQmx Read only returns data from a single channel, and there are multiple channels in the task. Use the multichannel version of DAQmx Read." Could anybody please tell me how I can find the multichannel version of DAQmx Read !??
There are only three DMA channels on a 6602 device, so if you want to perform buffered operations on more than 3 counters at the same time, you need to change the data transfer mechanism for some to interrupts. This can be done using the DAQmx Channel Property Node and changing the property "Counter Input->General Properties->More->Advanced->Data Transfer and Memory->Data Transfer Mechanism".
Second, can you attach example code for the error message for the "multichannel version". The problem you are running into is that you cannot have multiple counter input channels in a single task. You should create separate tasks for each counter to eliminate this problem. There is no multichannel version of the DAQmx Read for counters. I am curious as to how this error was generated.
I have changed the data transfer mechanism to interrupts using the DAQmx channel property node, which produces a new requirement: I must use the DAQmx timing property node to change the sample timing type. I´ve changed this last property to almost every possible value, but still get errors. The last one is "external sample clock source must be specified for this application" ... Why cant I just use the internal clock ? Goddamnit, I just want to measure a few quadrature encoders! Why does this need to be so complicated? Do anybody have an example code that works with DAQmx ?
After looking at your code it looks like you're not using a buffered acquisition, so I'm not sure what the source of your first problem ("No DMA Channels" error with more than three counters). From the looks of it, you shouldn't have to change your transfer mechanism to interrupts at all. Sorry about that. Try it without that property node at all and let me know if you still see that "No DMA Channels" error.
I have received the same error message indicating that I cannot read more that one counter, but it was not obvious to me before reading this that it was not possible. It would be very nice to have that ability but there must be a reason for it. I was using ctr0 as a quadrature and want ctr1 as a low frequency AC line-cycle measurement, they both will be clocked by the same input which is a square wave representation of the line.
Regarding the 6602 and multiple DMA channels, I will be using that card in an upcoming project and am curious about this since now I realize they can't be read in the same task. My requirement is to read all 8 simultaneously and that will also force me to use interrupts - correct?