PIC Projects
WiFi, Ethernet
Doorbell with SD / EEPROM
SD FAT16/32 for .bmp
LCD TFT Egg Timer
LCD TFT Oscilloscope
SD Talking Clock
SD Sound Recorder,
    FAT32 wav Player
LED Thermometer
LED Egg Timer
LCD Egg Timer

Frequency Counters
100KHz For PC
1MHz For PC
8 Digits LED 50 MHz
Scope Screen Display
LCD Module 10MHz
6MHz for Android
USB PIC18F2550
USB TFT display BMP
USB DS18B20 Sensor
USB Thermometer
USB Counter
USB Meter
USB Oscilloscope
USB Input-Output
USB 16x2 LCD

COM & LPT Ports
MCP3201 on LPT
Serial TFT Text
Serial Inputs Outputs
Serial Port LCD
Analogue Signal to LPT
MCP3201 on Serial Port
Serial Thermometer
Analogue Signal to Serial
LCD Display on LPT
Serial Thermostat

Water Softener
HP Stream 7 docking
3.7V to 5V
Solar Charger

Infrared Decoder
PIC Music

Code Lock
Code Lock with LCD
HOME MOBILE Technical Tips


Counter based on PIC16F628A . Included C code and circuit diagram. Input is a TTL type. The counting repeats every about 5 sec. The 32K crystal is for generating accurate time base for counting the input frequency. The MCU uses the 4 MHz internal oscillator.
PIC16F628A TMR0 input can count frequency up to 50 MHz if the signal is 50% duty cycle. If the duty cycle is 10% then the max frequency is 10 MHz. TMR0 can count up to 2 MHz , the prescaler is used to increase the input frequency range to 64 MHz. Frequencies up to 1 MHz are counted with resolution of 1 Hz, frequencies above 1MHz are counted at resolution of 32 Hz.
I tested the counter up to 2 MHz only, I don't have the means to do better tests.
The 7 segment LED is common cathode, cc8 is the common cathode of the digit on the left. 100 ohm resistor for the segments is for a current of 20mA, the max output current of the pic is 25mA, so if you change the resistors make sure you don't exceed this current.
To drive 8 digits from 5 outputs I used a system of 2 out of 5 that gives up to 10 outputs by AND gating to outputs. I used one output to drive the base of the transistor and the other a diode. the emitter of the transistors are elevated by 0.7V by a diode, this to make sure they are switched off when the diode at the base is low. It is possible to reduce the number of digits by deleting them and by deleting the lines in the code that drives the digits.

Software includes PIC code. You are free to use the circuit diagram and the software with no limitations.

Circuit Description
See also Technical Tips

All transistors are BC337 or equivalent.
Total 5V supply current can reach145mA.
The 8 digits display is common cathode, for red LEDs the 7 resistors of 100 ohms enable current of 20 mA total, average of 2.5 mA through each segment which is on for eighth of the time. To increase the brightness the resistors can be decreased to max current of 25 mA. The seven segments, a to g, of one digit are linked to the corresponding seven segments in the other digits. cc8 is the common cathode of the digit on the left.
The 8 digits are multiplexed by 5 pic's outputs, for each group of 2 out of 5 a digit is switched on. The diode to ground from the emitters is to insure full switch off when the gating diode at the base is low.