06-04-2008 08:59 AM
06-04-2008 04:31 PM
I don't know a simple way to do exactly what you describe with hardware. Here are a couple things you *can* do using 1 or 2 counters (most multifunction boards have 2). Not exactly what you're after, but maybe one or the other will work good enough?
1. You can use 1 counter to divide down a TTL signal by any integer >= 4. You would define your pulse train using units of "Ticks" and then specify the integer #'s of ticks for high time and low time. (The minimum allowed value of ticks is 2.) You would also have to specify the external encoder signal as the counter's "timebase source" signal.
2. You can achieve nearly any fractional division factor by using 2 counters. One will measure the incoming encoder freq, the other will generate an output that is some arbitrary fraction of the other. However, the output won't change instantaneously with the input, nor can it be expected to track every nuance of the input variation. You have to perform software calls to sample, then calculate, and finally update the output freq. Note that the output pulse train can have its freq changed on-the-fly without stopping.
Another tip for option #2: measure your input frequency with continuous sampling. Then you can setup DAQmx Read properties to request that you read the most recent N samples. That way each time you request data, the call will return immediately with the freshest available data. You can then do any needed filtering or averaging on these samples to determine the most representative input freq.
Don't have time to explain all details of terminology above. Search the forums and you'll probably find quite a bit of help. You can include my signature ("Kevin P") in the search because I've been involved in past threads using many of these terms such as "timebase source", "units of Ticks", "on the fly", "most recent samples".
-Kevin P.
06-05-2008 07:55 AM
06-05-2008 01:46 PM
Hello kwijibo28,
If you are trying to generate a pulse train with a frequency that is 1/7.37 the frequency of the pulse train generated by your encoder,
as a simple solution, I would recommend performing a digital frequency counter measurement with the encoder as the counter input.
Next, I would perform a digital pulse train generation, with the frequency input of the CO Pulse Freq. DAQmx Create Virtual Channel being
the fequency output from the digital frequency counter measurement divided by 7.37. You can find VIs for digital frequency counter
measurement and digital pulse train in NI Example Finder.
Best wishes,
Wallace F.