Design Ideas: October 26,, 1995
You can plug the circuit in Fig 1 into a PC's printer port to measure frequency. The circuit needs no external power supply, measures frequencies from 1 Hz to 5 MHz, and displays the results on screen. IC1 (CD4536) is a 16- or 24-bit programmable counter. In this application, you set the counter to 16 bits. IC2 is a 12-bit counter; you use only the first 4 bits. The combination of IC1 and IC2 yields a counter with a total length of 20 bits.
The PC's printer port has five input lines. You use four lines to read IC2's 4-bit parallel data. The last line serially reads IC1's 16-bit data. The PC sends a 4-bit counter-selection signal to IC1's A to D inputs to select one of the IC's 16-bit counters. The printer port powers the circuit through R7 and C1. Pin 8 resets IC1 and IC2.
For software, a C program uses the PC's internal timer to measure input frequency. (You can download the C source code from EDN BBS /DI_SIG #1771.) The timer generates a 0.989-sec interruption interval using the following steps: