Measuring Frequency With the FP-CTR-500/502Primary Software: Driver Software>>NI-FieldPointPrimary Software Version: 4.0.1 Primary Software Fixed Version: N/A Secondary Software: N/A Hardware: FieldPoint>>Discrete I/O Modules>>FP-CTR-502, FieldPoint>>Discrete I/O Modules>>FP-CTR-500
Problem: How can I Measure Frequency with the FP-CTR-500/502? Solution: There are two methods that can be used to measure frequency with the FP-CTR-500. The first method provides a general overview of the techniques used for frequency measurement. The second provides a shortcut that can be used in LabVIEW & LabWindows/CVI when using a FP-10xx serial controller or when using LabVIEW RealTime when using a FP/cFP-20xx network controller running embedded code. Both methods give the same accuracy because the accuracy is dependent upon the period of the gate or time between count resets. Also, the maximum frequency either method can measure is 50 kHz. Method 1: Theory
To measure frequency with the CTR-500, use one counter channel to generate a fixed-width positive gating pulse and another to count the number of pulses (of the signal being measured) which occur during that time. Each different pulse width used requires a separate counter channel and output. Since there are four outputs, up to four different gating pulses may be generated simultaneously. Each gating pulse can be used to control as many counter channels as desired, so up to seven signals may be measured using the same gating pulse, or up to four if separate gating pulses are used for each. Set up the gating pulse The gating pulse is a one shot pulse which is set up as described in the CTR-500 manual. Pick a counter channel, output channel, and gate channel, and then connect them as described. When this is set up correctly, you will be able to generate a new pulse (and take a new frequency measurement) each time you either (a) send a reset command to the gating pulse counter channel or (b) read the gating pulse counter channel (if you have set the channel to reset on read). Because of the polling mechanism used by Lookout, you should NOT use the reset on read mode with Lookout (or if you are using the FP-1600 network module). Set up the frequency counter When generation of the gating pulses is working correctly, you can set up counter channels to use this gating pulse for measuring input signal frequency. Set up each counter channel to use its external count input and the same gate input as the gating pulse counter channel. In this way, the frequency counter will indicate the number of periods of the input signal which occur during the gating pulse. Performing a measurement To perform a measurement, start by resetting the gating pulse channel. This will start the gating pulse. Wait until the gating pulse is over (either by polling the state of the output or by inserting a fixed-length wait), and then read the frequency counter channel. Divide this count by the length of the gating pulse (in seconds) to generate a frequency. You can then reset the frequency counter channel or just subtract off its current value from the next measurement. Method 2: Shortcut
The shortcut method takes advantage of the Read Reset Mode and timestamps. By setting a counter to have a Read Reset Mode of Reset On Read, every time that a reading is made, the counter is reset back to 0. This gives the number of counts that occurred in between the current reading and the last one. By subtracting the timestamp of the last read from the current timestamp (easiest to do in LabVIEW & LabWindows/CVI), you have the number of counts that occurred during a specific period of time. You can then divide the count by the elapsed time to get the frequency. Other Considerations
Related Links: Developer ZoneTutorial: Configuring an FP-CTR-500/502 Module Using FieldPoint Explorer KnowledgeBase 2I0I6I5F:How Can I Create a 32-bit Counter Using the FP-CTR-500/502? KnowledgeBase 3ARE14GP: How Does the FieldPoint Frequency Measurement Shipping Example Work? Developer Zone Example: Measure Frequency with LabVIEW and FieldPoint Using FP-CTR-500/502 Developer Zone Example: Creating a 32-bit Counter Using the FP-CTR-500/502 Developer Zone Example: Measuring Low Frequencies with LabVIEW and FieldPoint Using [c]FP-CTR-500/502 Developer Zone Example: Using the FP-CTR-500/502 to Measure Three Different Frequencies in LabVIEW 6.0 Product Reference: FP-CTR-500 and cFP-CTR-500 Operating Instructions Product Reference: FP-CTR-502 and cFP-CTR-502 Operating Instructions Attachments:
Report Date: 01/12/2000 Last Updated: 07/20/2007 Document ID: 1TB63SUS |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


