Frequency Measurement Using PC
Frequency Measurement Using PC
Using PC
H
ere is a simple technique for along with its time-period and frequency given by UL=19xN5 Hz. Thus for MOD
measuring frequencies over components, its measurement precision 16 counters UL≈20 MHz, and for MOD
quite a wide frequency range and in percentage is also calculated and dis- 10 counters UL≈1.9 MHz. Care should
with acceptable accuracy limits using played. Number of data taken in 54.9 ms be taken to ensure that this upper limit
a PC. It follows the basic technique of is also displayed. is within the operating frequency range
measuring low frequencies, i.e. at low fre- As stated above, the lower starting of counter IC used. Precision of measure-
quency, period is measured for a complete range is about 19 Hz. Data is read for ment is a machine-dependent parameter.
wave and frequency is calculated from the approximately 54.9 ms. Thus, the lowest High-speed machines will have better
measured time-period. possible frequency that can be measured precision compared to others. Basi-
Cascaded binary counters are used is 1/.0549 Hz. Lower frequency range cally, precision depends directly upon
for converting the high-frequency signals depends only on the sampling time and the number of data read in a standard
into low-frequency signals. The parallel is practically fixed at 19 Hz (18.2 Hz, time. Precision of measurement varies
port of a computer is used for data input to be precise). Upper frequency range inversely as the value of MOD counter
from binary counters. This data is used depends on factors such as value of the used. Precision is high when MOD 10
for measuring time and calculating the MOD counter used and the operating counters are used in place of MOD 16
frequency of the signal. frequency range of the counter IC. If counters, but this will restrict the upper
The block diagram shows the basic MOD-N counter is used (where N is an limit of frequency measurement and
connections of the counters and parallel integer), upper limit (UL) of frequency is vice-versa.
port pin numbers on 25-pin ‘D’ connector
of a PC (control register 379 Hex is used
for input). External hardware is used
only for converting the higher frequency
signals into low frequency signals. Thus,
the major role in frequency-measurement
is played by the software.
The PC generates a time-interrupt at
a frequency of 18.21 Hz, i.e. after every
54.92 millisecond. Software uses this
time-interrupt as a time-reference. The
control register of the PC’s parallel port is
read and the data is stored continuously
in an array for approximately 54.9 ms
using a loop. This stored data is then ana-
lysed bit-wise. Initially, the higher-order
bit (MSB or the seventh-bit) of every ar-
ray element is scanned for the presence of
a complete square wave. If it is found, its
time period is measured and if not then
the second-highest order bit (sixth bit) is
scanned. This operation is performed till
the third bit and if no full square wave is
still found, an error message is generated
which indicates that either there is an
error in reading or the frequency signal
is lower than 19 Hz.
Lower three bits of the control regis-
ter are not used. When a wave is found,