04-05-2008 10:18 PM
04-06-2008 12:50 AM
04-06-2008 01:09 AM
04-08-2008 11:13 AM
Hello,
I attached some code that will run a post process analysis on the data to calculate the duty cycle. Please note that the constant for Wait Until Next ms Multiple is set to 1. Thus, the loop will run every 1 msec. (On Demand timing), which equates to a sample rate of 1,000 Hz. Since your period is 10 ms in duration, this should hopefully allow for enough samples during one period to compute an accurate duty cycle.
This code is used for monitoring one line/channel. I saw that the original code was setup to acquire across several lines in a port. Do you need to monitor more than one channel in order to measure several channels duty cycle? Please also note that I used DAQmx function calls instead of the DAQ Assistant. Let me know if and where you need flexibility and I can make some suggestions.
04-15-2008 12:48 PM
04-17-2008 03:06 PM
Hello,
If you are looking for more accuracy, I would highly recommend getting a Multifuctional DAQ 62XX or Counter 66xx device with a counter so you can run a Counter Input Task for semi period. There is actually a shipping example in the Example Finder titled Measured Duty Cycle - Buffered - Finite.vi that used this type of task with a counter to measure duty cycle. The USB 6009 that you currently have only does event counting. It is recommended to use a counter input task for duty cycle measurements.
You can set the constant input of Wait Until Next ms Multiple.vi to a number lower that 1. For example .5 or .2, however this type of software timing (vi posted above) is system dependent. The loop it set to run every 1 ms if the processor allows it. In addition if the DAQmx Read.vi or code for building the array makes the loop take longer than 1 ms, than you are not actually achieving this rate. Thus, the constant can be set to a value less than 1, however you may not get that timing. The same is true for the 1 ms, since it is system dependent.