Why Do I Get Erroneous Values on the Semi-Period Counter Input Measurement? Hardware: Multifunction DAQ (MIO)>>E Series, Multifunction DAQ (MIO)>>M Series, Counter/Timers (TIO)
Problem: I am using the "Meas Buffered Semi-Period-Finite.vi" example program and I have an M Series or E Series DAQ board. I noticed that the first measurement returned is wrong. Why? Solution: The "Meas Buffered Semi-Period-Finite.vi" does not use triggering. Therefore, the first value returned is the measurement from the time the task started until the first transition to latch data (i.e. the first low-to-high) resulting in an inaccurate measurement. This is the same for E and M Series, regardless of the driver version. With E Series, there is no method of triggering counter input operations. With M Series, however, you can use the ArmStart trigger to cause the counter to wait for a trigger signal before performing measurements. After the counter is armed, it will latch data on every transition of the source. You can set the ArmStart trigger's input terminal to the same terminal you are counting (CI Input Semi-period Terminal must also be set explicitly, even if using the default counter terminal). You can also set when to start latching data, either on first rising or the first falling edge, by using the DAQmx Channel Property, Counter Input>>Measurement Type>>Starting Edge. Regardless of this value, every transition thereafter (low-to-high OR high-to-low) will cause data to be latched.However, if you are using the signal source to also trigger the semi-period measurement and you set the Counter Input >> Semi-Period >> Starting Edge channel property to Rising, the first value you latch will be erroneous (most likely 0 or 1 in ticks if using the internal 80 or 20 Mhz timebases, respectively). This is because the Start Edge (the edge that initiates data latching) and the ArmStart Edge (the edge that initiates counting) happen almost simultaneously. Therefore, 0 counts are latched into the buffer. If your pulse signal has an idle state of Low and you set your ArmStart to Rising and Starting Edge to Falling, then your first measurement will be the first High portion of your pulse width. If your signal source has a High idle state you will need to the reverse the edges (ArmStart set to Falling and Starting Edge set to Rising). On M Series, Falling is not a valid value for ArmStart (only supported on TIO Series) so for pulses that have High idle states you WILL lose the first semi-period measurement (i.e. the first low semi-period). For Low idle state signals, however, you can just ignore the first value (0 or 1 ticks) and keep the ArmStart = Rising and Starting Edge = Rising settings. But if you decide to ignore or delete the first value recieved, you will also need to remember that you have to acquire N+1 samples to capture the same amount of data as with the Starting Edge set to Falling. This is because of the intial erroneous measurement. Likewise, for a Duty Cycle measurement you will need 2 * N + 1 and 2 * N to measure N periods with the Starting Edge set to Rising and Falling, respectively.Related Links: Attachments:
Report Date: 10/05/2005 Last Updated: 11/13/2005 Document ID: 3Q4G7VTJ |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
