03-04-2008 04:52 PM
03-05-2008 04:01 PM
Hi CreviceDweller,
The smallest you can divide by is four when you use one counter. If dividing by four is not an option some other possibilities would be to use a lower pulse/rev encoder or a higher pulse/rev encoder and then divide by four. I understand that dividing by two is very easy using a hardware counter. However due to the architecture of NI cards which have to support using the counters for multiple functions it is just not possible to divide by two. I’d be happy to help you work out a solution if you can tell me a little more about your application.
1. How many ai channels are you acquiring? This will let us figure out your maximum sampling rate.
2. How many pulses/rev is your encoder and what is the rpm range of the shaft?
Let me know if you have any questions. Have a great week.
Thanks,
03-17-2008 12:55 PM
Thanks for the response Nathan. Sorry for the delay on my part, I've been out of the office since 3/5/08.
When I used Traditional DAQ, with E series cards, I could divide by 2 using the following code:
03-17-2008 12:55 PM
Thanks for the response Nathan. Sorry for the delay on my part, I've been out of the office since 3/5/08.
When I used Traditional DAQ, with E series cards, I could divide by 2 using the following code:
03-17-2008 01:08 PM
Thanks for the response Nathan. Sorry for the delay on my part, I've been out of the office since 3/5/08.
When I used Traditional DAQ, with E series cards, I could divide by 2 using the following code:
SCAN_Start (devnum, piBuffer, numPoints, -3, arg5, 0, 2);
where arg5 depended on the specific E series card.
It would seem that the equivalent should be possible with E series cards in DAQmx even if not with the USB-6251.
While my original post mentioned the USB-6251, many of our customers still use E series cards and would like to retain the divide by 2 capability.
03-18-2008 07:08 PM - edited 03-18-2008 07:09 PM
Hi CreviceDweller,
I believe I have a way to do what you want in DAQmx and it doesn’t even use a counter. You need to import your encoder signal as an AI sample clock timebase instead of as the AI sample clock. Then you can set the AI sample clock timebase divisor to 2. This will cause the card to generate one pulse on the AI sample clock for every two pulses of the AI sample clock timebase.
You can set the source of the time base using
the DAQmxSetSampClkTimebaseSrc function and the divisor can be set using DAQmxSetSampClkTimebaseDiv.
You can add these two functions after your call to DAQmxCfgSampClkTiming.
Here is an example of how I would set up the timing for a continuous acquisition that uses the signal at PFI0 divided by 2 for the sample clock.
DAQmxCfgSampClkTiming( taskHandle, NULL, MAX_expected_rate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, BufferSize);
Let me know if you have any more questions and have a great week.
Thanks,
03-19-2008 08:44 AM
Thanks Nathan, that works perfectly.
By using PFI0 for the sourceI can "divide" by 1 and by using your code I can divide by 2,4, 8, etc. with BOTH E series and the USB-6251. PLUS both counters are available to count frequency (RPM). I was never able to divide E series by 1 with traditional DAQ.
I guess I see how the code works. I had experimented with similar code but using the "onboard clock" seemed counter intuitive so I hadn't tried that. Obviously I don't fully understand the hardware - software interface. Is there a good document to help me understand this?
03-20-2008 02:45 PM
Hi CreviceDweller,