Frequency Counter
( Using PIC16F84 )
Note: This site is best viewed with 1024 by 768 pixels screen resolution.
School: University Of Balamand - North Lebanon
Course: EE351 - Microprocessors
Instructor: Dr. Nicolas Haddad - Assistant Professor in Electrical Engineering (Ph.D)
Students: Karim Khoury (EE), Edgard Nasr (CE) & Ramzy Jreige (CE)
Description
The circuit above measures the frequency of a TTL waveform from 0 to 9999 Hz. The PIC16F84 microcontroller from Microchip is operating at 4MHz (crystal).
RB0 is used as input and the microcontroller counts the positive or negative going edges of the waveform on an interrupt basis every 1 second.
As it is shown, the display is multiplexed and controlled by the transistors connected to RA0-RA3. Each display is refreshed every 4ms.
The 1k resistors at the base insure the saturation mode operation of the transistor. 150 ohm resistors are used to limit the current for the seven segment displays.
The 7-seg is connected to the MCU via PORTB as follows: (RB7 - RB1) --> (a - g) respectively.
Hardware Components
PIC16F84 MCU (1)
4MHz crystal oscillator (1)
Push button (1)
Block of 4 multiplexed displays - common cathode (1)
Q2N3904 BJT transistors (4)
1k resistors (5)
150 Ohm resistors - 1/4 watts (7)
22pF capacitors (2)
1uF capacitor (1)
Assembly Code
Click Here for the program code
Note: This program was assembled using the original software from Microchip, MPLAB
Please send comments here if any.
You are visitor number...
This page was created by Karim Khoury
on February 11 - 2002