SlideShare a Scribd company logo
1 of 25
Download to read offline
1
FREQUENCY COUNTER/METER
SCHOOL OF ELECTRICAL AND ELECTRONIC ENGINEERING
DEPARTMENT OF SIGNAL AND INFORMATION PROCESSING
EMBEDDED SYSTEM DESIGN PROJECT
Eng DENNIS MWIGHUSA ((唐德宁 )
2
ABSTRACT
The object of this project is to determine and display the frequency of the input power.
This is done by using 8051 microcontroller. The circuit of our designed frequency
meter includes 8051 microcontroller, Liquid Crystal Display(LCD),Cathode Ray
Oscilloscope(CRO) and variable power supply unit.
The CRO is used to display the frequency waveform of the given input power. Based
on the source code given to the 8051 microcontroller it detects the frequency value and
displays that value with the help of the LCD employed. Depending on the power
supply the value of the frequency on the LCD changes.
Most frequency counters work by using a [counter] which accumulates the number of
events occurring within a specific period of time. After a preset period (1 second, for
example), the value in the counter is transferred to a display and the counter is reset to
zero. If the event being measured repeats itself with sufficient stability and the
frequency is considerably lower than that of the clock oscillator being used, the
resolution of the measurement can be greatly improved by measuring the time required
for an entire number of cycles, rather than counting the number of entire cycles
observed for a pre-set duration. Frequency counters are commonly used in laboratories,
factories, and field environments to provide direct frequency measurements of various
devices. The most common applications for frequency counters are measurement and
characterization of oscillator and transmitter frequencies.
3
CONTENTS
1. Introduction………………………………………………………………………..3
1.1 Types of frequency meter…………………………………………………….....3
1.2 Block Diagram……………………………………………………………...… 4
2. The Basic Theory of Frequency Counter…………………………………………....5
2.1 Basic Counter Circuits……………………………………………………....…6
3. Hardware……………………………………………………………………………7
3.1 Microcontroller…………………………………………………………..….…7
3.1.1 Features…………………………………………………………………..7
3.1.2 Pin diagram………………………………………………………………8
3.2 Counters………………………………………………………………………....8
3.3 IN-1 Prescaler…………………………………………………………………...9
3.4 IN-2 Pre-amplifier……………………………………………………………....9
3.5 By passing IN-2Amplifier……………………………………………………....9
3.6 IN-2 Polarity Selector…………………………………………………………...9
3.7 Communication Port…………………………………………………………….9
4. Software…………………………………………………………………………....10
4.1 Measuring Modes……………………………………………………………...10
5. Power Supply………………………………………………………………………12
5.1.1 Dual supplies……………………………………………………………...…12
6. Liquid Crystal Display……………………………………………………………..14
6.1 Pin diagram…………………………………………………………………….13
6.2 Pin Descriptions……………………………………………………………..…15
7. Overview of Keil cross C compiler………………………………………………..18
7.1 Simulator/Debugger……………………………………………………………18
8. Proteus……………………………………………………………………………..19
9. Frequency counter applications……………………………………………………19
10. Conclusion………………………………………………………………………..19
References………………………………………………………………………..20
Source code……………………………………………………………………….21
4
FREQUENCY COUNTER/METER
1. INTRODUCTION
A frequency counter is an electronic instrument, or component of one, that is used
for measuring frequency. Frequency is defined as the number of events of a particular
sort occurring in a set period of time. Most frequency counters work by using a
counter which accumulates the number of events occurring within a specific period of
time. After a preset period (1 second, for example), the value in the counter is
transferred to a display and the counter is reset to zero. If the event being measured
repeats itself with sufficient stability and the frequency is considerably lower than that
of the clock oscillator being used, the resolution of the measurement can be greatly
improved by measuring the time required for an entire number of cycles, rather than
counting the number of entire cycles observed for a pre-set duration (often referred to
as the reciprocal technique). The internal oscillator which provides the time signals is
called the timebase, and must be calibrated very accurately. If the thing to be counted
is already in electronic form, simple interfacing to the instrument is all that is required.
More complex signals may need some conditioning to make them suitable for
counting. Most general purpose frequency counters will include some form of
amplifier, filtering and shaping circuitry at the input. DSP technology, sensitivity
control and hysteresis are other techniques to improve performance. The accuracy of a
frequency counter is strongly dependent on the stability of its timebase. Highly
accurate circuits are used to generate this for instrumentation purposes, usually using
a quartz crystal oscillator within a sealed temperature-controlled chamber known as a
crystal oven or OCXO (oven controlled crystal oscillator). In this project the circuit of
our designed frequency meter includes microcontroller, Liquid Crystal Display (LCD),
Cathode Ray Oscilloscope(CRO) and variable power supply unit.
1.1 Types of frequency meter
Various types of frequency meters are used. Many are instruments of the deflection
type, ordinarily used for measuring low frequencies but capable of being used for
frequencies as high as 900 Hz. These operate by balancing two opposing forces.
Changes in the frequency to be measured cause a change in this balance that can be
measured by the deflection of a pointer on a scale.
Deflection-type meters are of two types, electrically resonant circuits and ratio
meters.
In one version, this device possesses two coils tuned to different frequencies and
connected at right angles to one another in such a way that the whole element, with
attached pointer, can move. Frequencies in the middle of the meter’s range cause the
currents in the two coils to be approximately equal and the pointer to indicate the
midpoint of a scale. Changes in frequency cause an imbalance in the currents in the two
coils, causing them and, in turn, the pointer to move.
Another type of frequency meter, not of the deflection type, is the resonant-reed type,
5
ordinarily used in ranges from 10 to 1,000 Hz, although special designs can operate at
lower or higher frequencies. These work by means of specially tuned steel reeds that
vibrate under the effect of electric current; only those reeds that are in resonance
vibrate visibly, however.
Frequency counters designed for radio frequencies (RF) are also common and
operate on the same principles as lower frequency counters. Often, they have more
range before they overflow. For very high (microwave) frequencies, many designs use
a high-speed prescaler to bring the signal frequency down to a point where normal
digital circuitry can operate. The displays on such instruments take this into account
so they still display the correct value. Microwave frequency counters can currently
measure frequencies up to almost 100 GHz. Above these frequencies the signal to be
measured is combined in a mixer with the signal from a local oscillator, producing a
signal at the difference frequency, which is low enough to be measured directly.
1.2 Block Diagram
Figure:1 Block diagram of a frequency meter
The block diagram consists of Microcontroller, LCD display, CRO, Power supply.
In the hardware the micro controller is connected with help of the serial port.
With the help of the microcontroller the number of pulses will be counted and
displayed on the LCD display.
The baud rate is set per the micro controller.
6
2. THE BASIC THEORY OF FREQUENCY COUNTER
A frequency measurement system which is especially realized in digital counting
circuit seems being called "Frequency Counter".
Direct Counting Method
When count number of cycles of the input signal for one second, the value of
frequency can be got in the counter. This can be realized by simple counter circuit so
that this was the conventional frequency measuring method. Many counter IC have
been released and many frequency counters that work in this method are being
shipped now. This is the simplest method but the measuring resolution is limited at
low frequency. To ensure more resolution, the gate time must be expanded: e.g. when
measure at resolution of 1 mHz, 1000 seconds is needed to measure one time.
Reciprocal Method
This is one of the frequency measuring methods that was thought out to make up the
defect of direct counting method, and it is prevailing now. This method measures the
period (T) of the input signal instead of number of cycles, and calculate its frequency
in the formula f = 1 / T with a microprocessor. Its frequency resolution depends on
only time resolution independent of the input frequency.
It can measure low frequency with high resolution quickly however any trigger gitter
due to noise decrease measuring resolution. To maintain sufficient time resolution, it
generally measures the period of several number of cycles. The reciprocal method
seems to also be implemented to cheap frequency counter because of price of
microcontrollers falls.
7
2.1 Basic Counter Circuits
Every measuring method needs to control any clock signal. However using an AND
gate that shown in the diagram of principle will occur an extra count. The error rate
depends on the duty ratio of the clock signal: e.g. symmetrical clock signal occurs
+0.5 counts average. This cannot be ignored according to circumstance. At high
frequency of several MHz, this will not affect measuring accuracy, however input
signal of 99.7Hz results 100 or 101 Hz is not good.
This problem can be avoided by using a synchronous counter instead. In this circuit,
the rate of an extra count depends on only fractional number of less than 1, the clock
duty ratio doesn't affect to the extra count. However the synchronous counter can
occure any abnormal operation due to asynchronous input that is not
guaranteed ts and th. To avoid this problem, any care, such as separating counter
stages to insurate most synchronous block or synchronizing control signals with clock
to avoid that error, should be taken on this point.
8
3. HARDWARE
3.1 Microcontroller
There are different types of microcontrollers that can be used in frequency counter, in
this project the AT89C51 will be used .The AT89C51 is a low-power,
high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable
and erasable read only memory (PEROM). The device is manufactured using Atmel’s
high-density nonvolatile memory technology and is compatible with industry-standard
MCS-51 instruction set and pin out. The on-chip Flash allows the program memory to
be reprogrammed in-system or by a conventional nonvolatile memory programmer.
By combining a versatile 8-bit CPU with Flash on a monolithic chip, the AT89C51 is
a powerful microcomputer which provides a highly-flexible and cost-effective
solution to many embedded control applications.
3.1.1 Features
Compatible with MCS-51 Products
4K Bytes of In-System Reprogrammable Flash Memory – Endurance: 1000
Write/Erase Cycles.
Fully Static Operation: 0Hz to 24MHz
Three-level Program Memory Lock
128 x 8- bit Internal RAM
32 Programmable I/O Lines
Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes
9
3.1.2 Pin diagram:
Pin diagram of 8051
Figure 2: Pin diagram of 8051
3.2 Counters
The main counter that is the most important block in this universal counter is divided
into PLD (U1) and MCU (U2). The PLD part is a 12 bit counter. It can count up to
4096 and its most significant bit is connected to an external interrupt pin of the MCU,
the carry outs are counted by MCU. Therefore total counter length can be expanded
easy. In this system, a 36 bit counter of 12+24 bit is implemented. The frequency of
the carry out from PLD becomes approx 30 kHz at 120 MHz of input signal, this can
be counted with interrupt process easy. The operating frequency of the PLD is 84
MHz minimum, but it worked at over 140 MHz.
To read the counter value in the PLD, a reading mode is used. In this mode, the gate
signal from the MCU is routed as a counting clock and the counter gate is opened.
Then clock the gate signal until a carry out occurs, the counter value can be calculated
with: Counter value = 4096 - number of clocks. Any additional circuit to read the
counter is not required, however there is a problem that software loop of up to 4096
times (4.5 msec in AVR) is required. When a shift register to read the counter is
implemented, it can be read quickly. But there was not enough left logic cells for the
shift register.
10
3.3 IN-1 Prescaler
An prescaler IC (MB506) is used as a front end of IN-1. The input frequency is
divided by 64 and then input to the PLD. The MB506 can accept from 10 MHz to 2.4
GHz of input frequency. Since this block works at very high frequency, special care
should be taken on the significant point at UHF circuit band.
3.4 IN-2 Pre-amplifier
The front end of the IN-2 is a high input impedance and wide band amplifier realized
with an FET and a transistor. Because it handles small analog signals, decoupling
from power supply noise is important for the stability. When there is a dynamic driven
LED display, large or small ripple voltage will reside on to power line so that taking
care of the ripple voltage is very important.
The input sensitivity - frequency response is shown in the technical data. This will
nice performance considering it is a simple circuit. To ensure stabled triggering
operation, an input attenuator for proper input level is needed. But this was omitted
because many lead relays and its mounting space are required. This can be done by
using a probe with built-in attenuator. And a termination resister with switch is also
needed. But this was also omitted. This can be done by using a coupler with built-in
terminator.
3.5 Bypassing IN-2 Amplifier
Basically, the input coupling method of frequency counter is AC coupled. However
some problems will appear when measure on digital signals: e.g. very large duty ratio,
single pulse.
Most universal counters have a DC coupling mode with adjustable trigger level. This
universal counter can select a TTL coupling mode instead of the DC coupling mode.
In this mode, the input signal is bypassed pre-amplifier with a lead relay (RY1) and is
connected to the PLD directly. This is suitable for most 5V or 3V logics.
3.6 IN-2 Polarity Selector
Inverting trigger polarity of an input signal will not effective for frequency measuring
operation, however it is an important function when measure a pulse period or width.
This function is a part of the PLD, no additional component is required.
3.7 Communication Port
A communication interface is available to collect measured value and apply any
process with a PC. Since this universal counter is a measurement instrument, the
communication interface must be isolated from its system ground. The interface is an
EIA-574 compatible serial port that is isolated with optical isolators.
11
4. SOFTWARE
4.1 Measuring Modes
This universal counter have two basic operating modes. One is frequency counting
mode that counts incoming signal, other is interval measuring mode that counts
reference clock gated by incoming signal.
In the Frequency Mode, selected input signal is routed as a counter clock. The gate
signal is generated with a timer unit in the MCU and applied to the PLD externally.
This can generate variable gate time easy. The operation is a sequential loop that reset
counter, open gate for a reference time and then display counter value as a frequency.
The gate lamp is lit during gate is opened, and wait for 30 msec before each
measuring operation to blink gate lamp to indicate refresh timing.
In the Time Interval Mode, the reference clock is routed as a counter clock. The gate
signal is generated by input signal. The operation is a sequential loop that reset
counter and gating block, wait for end of one gate time by monitoring PLD status
(CEN and EOC), read counter value and adjust it with scaling factor and then display
it. This mode is also used at reciprocal frequency measuring mode.
 Selecting Operation Mode ([Mode] button)
Mode button changes operation mode. The setting of operation mode and IN-2 input
mode are saved into EEPROM at 3 seconds after changes occurred, it will be restored
next start.
Mode 0 (Frequency [MHz])
This mode selects IN-1 that divided by 64 with a prescaler. The gate time is 640
msec, so that the total scaling is 1/100. The display format is 0000.0000 MHz, it
can display up to 10GHz in resolution of 100 Hz (input range is 10MHz to
2.4GHz).
Mode 1 (Frequency [Hz])
This mode and folios use IN-2 as its input channel that can select coupling mode
and triggering polarity. In this mode, frequency is measured in direct counting
method in gate time of 1 second. The display format is 00000000 Hz, it can
display up to 100 MHz in resolution of 1 Hz.
Mode 2 (Frequency [Hz])
This mode measures frequency in reciprocal method. The display format
is 0000.0000 Hz, it can display up to 10 kHz in resolution of 100 µHz. However
there is a problem that the time measuring block can measure only one cycle time,
time resolution will inversely proportionate to input frequency. Because the block
is for only time interval measurement, not designed for reciprocal method. This
mode is an additional measure ring mode with the time internal modes. It would
be able to implemented full functional logic if a higher density PLD is used
instead. Therefore this mode is suitable for only low input frequency, as for high
frequency, direct counting method will do.
12
The top image of this page shows that measuring 400 Hz test signal and last digit
is not steady. It seems that is 6 digits resolution because of repeating the time
measuring operation for one second and calculating frequency from its average.
Mode 3 (Cycle Time [ms])
This mode measures cycle period of rising edges (falling edges at IN-2 inverting
mode). The display format is 0000.0000 ms, it can display up to 10 seconds in
resolution of 100 nsec. Since the reference clock is 12.8 MHz, actual time
resolution is approx. 78 nsec, the counter value is divided by 1.28 and scaled in to
100 nsec resolution.
Mode 4 (Pulse Width Time [ms])
This mode measures pulse width of high levels (low levels at IN-2 inverting
mode). Any other funcitons are same as mode 3.
 Selecting Coupling Mode and Trigger Polarity (([Cupl],[Pol] button)
These buttons change coupling mode and trigger polarity of IN-2.
 Hold Display ([Hold] button)
This button stops and restarts measureing operateion. In hold mode, display will blink
to indicate that it is in the hold mode. When no result is displayed after mode change
or hold release, wait for a new result and then enter hold mode.
 Expanding Gate Time ([Hold]+[Mode] button)
This function changes gate time at mode 0 and 1. The gate time is expanded 10 times
and frequency resolution is magnified 10 times. However the most decimal points of 7
segment LEDs are used for other status, so that the display format is not changed. Of
course output value to the communication port is scaled.
 Serial Communication
The serial data format is N81, 2400bps. Measured values are sent as a line each at the
time of the display is updated. It can be saved as a CSV file. Especially the Microsoft
Excel can directly read results into the cells with VBA. When collect any time
intervals, it is a simple time interval analyzer.
The universal counter can also be controlled by serial commands form host. The
command character is not echo-backed, and each functions are as follows:
MODE<n><CR>
Select operation mode. <n> determines requested mode number which can be 0 to
4.
CPL<n><CR>
Select IN-2 coupling mode. 0 selects AC coupled, 1 selects TTL coupled.
POL<n><CR>
Select IN-2 trigger polarity 0 selects rising edge (high level), 1 selects falling
edge (low level).
GATE<n><CR>
Select gate time in mode 0 and 1. 0 selects normal, 1 selects expand to 10 times.
13
5. POWER SUPPLY
A power supply (sometimes called a power supply unit or PSU) is a device or
system that supplies electrical or other types of energy to an output load or group of
loads. The term is most commonly applied to electrical energy supplies, less often to
mechanical ones, and rarely to others.
5.1 Types of Power Supply
There are many types of power supply. Most are designed to convert high voltage AC
mains electricity to a suitable low voltage supply for electronics circuits and other
devices. A power supply can by broken down into a series of blocks, each of which
performs a particular function.
For example a 5V regulated supply:
Each of the blocks is described in more detail below:
Transformer - steps down high voltage AC mains to low voltage AC.
Rectifier - converts AC to DC, but the DC output is varying.
Smoothing - smoothes the DC from varying greatly to a small ripple.
Regulator - eliminates ripple by setting DC output to a fixed voltage.
Power supplies made from these blocks are described below with a circuit diagram and a
graph of their output:
Transformer only
Transformer + Rectifier
Transformer + Rectifier + Smoothing
Transformer + Rectifier + Smoothing + Regulator
5.1.1 Dual Supplies
Some electronic circuits require a power supply with positive and negative outputs as
well as zero volts (0V). This is called a 'dual supply' because it is like two ordinary
supplies connected together as shown in the diagram.
14
Dual supplies have three outputs, for example a ±9V supply has +9V, 0V and -9V
outputs.
 Transformer only
The low voltage AC output is suitable for lamps, heaters and special AC motors. It is
not suitable for electronic circuits unless they include a rectifier and a smoothing
capacitor.
 Transformer + Rectifier
The varying DC output is suitable for lamps, heaters and standard motors. It is not
suitable for electronic circuits unless they include a smoothing capacitor.
 Transformer + Rectifier + Smoothing
15
The smooth DC output has a small ripple. It is suitable for most electronic circuits.
 Transformer + Rectifier + Smoothing + Regulator
The regulated DC output is very smooth with no ripple. It is suitable for all electronic
circuits.
6. LIQUID CRYSTAL DISPLAY
LCD is a type of display used in digital watches and many portable computers. LCD
displays utilize to sheets of polarizing material with a liquid crystal solution between
them. An electric current passed through the liquid causes the crystals to align so that
light cannot pass through them. LCD technology has advanced very rapidly since its
initial inception over a decade ago for use in laptop computers. Technical
achievement has resulted in brighter displace, higher resolutions, reduce response
times and cheaper manufacturing process. The liquid crystals can be manipulated
through an applied electric voltage so that light is allowed to pass or is blocked. By
carefully controlling where and what wavelength (color) of light is allowed to pass,
the LCD monitor is able to display images. A back light provides LCD monitor’s
brightness. Just as there are many varieties of solids and liquids, there is also a variety
of liquid crystal substances. Depending on the temperature and particular nature of a
substance, liquid crystals can be in one of several distinct phases. Over the years many
improvements have been made to LCD to help enhance resolution, image, sharpness
and response times. One of the latest such advancements is TFT or Thin Film
Transistor. TFT-LCD’s make use of a very thin transistor that is applied to glass
during acts as switch allowing control of light at the pixel level, greatly enhancing
image sharpness and resolution. This has been particularly important for improving
LCD’s ability to display small-sized fonts and image clearly. LCD interfacing with
8051 is a real-world application. In recent years the LCD is finding widespread use
replacing LEDs (seven segment LEDs or other multi segment LEDs). This is due to
following reasons:
1. The declining prices of LCDs.
16
2. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU
to keep displaying the data.
3. Ease of programming for characters and graphics.
6.1 Pin Diagram
Most of the LCD modules conform to a standard interface specification. A 14pin
access is provided having eight data lines, three control lines and three power lines.
The connections are laid out in one of the two common configurations, either two
rows of seven pins, or a single row of 14 pins. One of the, pins are numbered on the
LCD’s print circuit board (PCB), but if not, it is quite easy to locate pin1. Since this
pin is connected to ground, it often has a thicker PCB track, connected to it, and it is
generally connected to metalwork at same point.
Figure 3: Pin diagram of LCD display
6.2 Pin Descriptions
Vcc, Vss and Vee
While Vcc and Vss provide +5V and ground respectively, Vee is used for controlling
LCD contrast.
RS, register select
There are two very important registers inside the LCD. The RS pin is used for their
selection as follows.
17
a) If RS=0, the instruction command code register is selected, allowing the user to
send a command such as clear display, cursor at home, etc.,
b) If RS=1 the data register is selected, allowing the user to send data to be displayed
on the LCD.
R/W, read/write
R/W input allows the user to write information to the LCD or read information from it.
R/W=1 when reading; R/W=0 when writing.
EN, Enable
The enable pin is used by the LCD to latch information presented to its data pins.
When data is supplied to data pins, a high-to-low pulse must be applied to this pin in
order for the LCD to latch in the data present at the data pins. This pulse must be a
minimum of 450ns wide.
D0-D7
The 8-bit data pins, D0-D7, are used to send information to the LCD or read the
contents of the LCD’s internal registers. To display letters and numbers, we send
ASCII codes for the letters A-Z, a-z, and numbers 0-9 to these pins while making
RS=1.
We also use RS=0 to check the busy flag bit to see if the LCD is ready to receive
information. The busy flag is D7 and can be read when R/W=1 and RS=0, as follows:
if R/W=1, RS=0. When D7=1 (busy flag=1), the LCD is busy taking care of internal
operations and will not accept any information.
18
The pin descriptions are given in table below:
Table1: The pin descriptions
Instruction set of LCD
Table2: Instruction set of LCD
19
7. OVERVIEW OF KEIL CROSS C COMPILER
It is possible to create the source files in a text editor such as Notepad, run the
Compiler on each C source file, specifying a list of controls, run the Assembler on
each Assembler source file, specifying another list of controls, run either the Library
Manager or Linker (again specifying a list of controls) and finally running the
Object-HEX Converter to convert the Linker output file to an Intel Hex File. Once
that has been completed the Hex File can be downloaded to the target hardware and
debugged. Alternatively KEIL can be used to create source files; automatically
compile, link and covert using options set with an easy to use user interface and
finally simulate or perform debugging on the hardware with access to C variables and
memory. Unless you have to use the tolls on the command line, the choice is clear.
KEIL Greatly simplifies the process of creating and testing an embedded application.
7.1 Simulator/Debugger
The simulator/ debugger in KEIL can perform a very detailed simulation of a micro
controller along with external signals. It is possible to view the precise execution time
of a single assembly instruction, or a single line of C code, all the way up to the entire
application, simply by entering the crystal frequency. A window can be opened for
each peripheral on the device, showing the state of the peripheral. This enables quick
trouble shooting of mis-configured peripherals. Breakpoints may be set on either
assembly instructions or lines of C code, and execution may be stepped through one
instruction or C line at a time. The contents of all the memory areas may be viewed
along with ability to find specific variables. In addition the registers may be viewed
allowing a detailed view of what the microcontroller is doing at any point in time.
The Keil Software 8051 development tools listed below are the programs you use to
compile your C code, assemble your assembler source files, link your program
together, create HEX files, and debug your target program. μVision2 for Windows™
Integrated Development Environment: combines Project Management, Source Code
Editing, and Program Debugging in one powerful environment.
C51 ANSI Optimizing C Cross Compiler: creates relocatable object modules
from your C source code,
A51 Macro Assembler: creates relocatable object modules from your 8051
assembler source code,
BL51 Linker/Locator: combines relocatable object modules created by the
compiler and assembler into the final absolute object module,
LIB51 Library Manager: combines object modules into a library, which may be
used by the linker,
OH51 Object-HEX Converter: creates Intel HEX files from absolute object
modules.
20
8. PROTEUS
In Greek mythology, Proteus (Πρωτεύς) is an early sea-god, one of several deities
whom Homer calls the "Old Man of the Sea", whose name suggests the "first" (from
Greek "πρ_τος" - protos, "first"), as protogonos (πρωτόγονος) is the "primordial" or
the "firstborn". He became the son of Poseidon in the Olympian theology (Odyssey iv.
432), or of Nereus and Doris, or of Oceanus and a Naiad, and was made the herdsman
of Poseidon's seals, the great bull seal at the center of the harem. He can foretell the
future, but, in am theme familiar from several cultures, will change his shape to avoid
having to; he will answer only to someone who is capable of capturing him. From this
feature of Proteus comes the adjective protean, with the general meaning of
"versatile", "mutable", "capable of assuming many forms". "Protean" has positive
connotations of flexibility, versatility and adaptability. The earliest attested form of the
name is the Mycenaean Greek po-ro-te-u, written in Linear B syllabic script.
9. FREQUENCY COUNTER APPLICATIONS
A good use of the frequency meter is to calibrate other equipment. For example a
signal generator that doesn't have its own digital display. The meter will show the
exact frequency being produced by the signal generator. Texas Instruments
manufacture a series of light sensors (e.g. TSL220) which produce an output
frequency dependent on light intensity. They are very easy to use requiring just one
external capacitor. A light meter combining one of these sensors with the frequency
meter could accurately measure irradiance over a 3 decade range.
10. CONCLUSION
The frequency meter using 8051 displays the value of frequency of the waveforms
given to the CRO from the power supply on the LCD. Depending on the input value
given to the CRO the value of the frequency changes.
In total, the complete system (including all the hardware components and software
routines) is working as per the initial specifications and requirements of our project.
So certain aspects of the system can be modified as operational experience is gained
with it. As the users work with the system, they develop various new ideas for the
development and enhancement of the project.
21
References
1. http://grietinfo.in/projects/MINI/EEE/DOC-A.12-frequencymeter.pdf -
2. http://www.radio-electronics.com/info/t_and_m/
3. http://elm-chan.org/works/uctr/report.html
4. http://www.apogeekits.com/counter_article.htm
5. http://en.wikipedia.org/wiki/Frequency_counter
6. http://grietinfo.in/projects/MINI/EEE/DOC-A.12-frequencymeter.pdf
22
SOURCE CODE
#include<reg51.h>
sbit intr=P3^4;
sfr ldata=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
void lcdcmd(char );
void delay(int);
void lcddata(int);
void lcddata1(char *value);
void main()
{
int i,l,H,k;
//char n;
while(1)
{
TMOD=0x15;
intr=1;
TL0=0x00;
TH0=0x00;
TR0=1;
for(i=0;i<28;i++)
{
TL1=0x00;
TH1=0x00;
TR1=1;
23
while(TF1==0);
TR1=0;
TF1=0;
}
P0=TL0;
l=TL0;
H=TH0;
k=l+H;
//H=H*0xf0;
lcdcmd(0x0E);
delay(250);
lcdcmd(0x01);
delay(250);
//lcdcmd(0x06);
//delay(250);
//lcdcmd(0x86);
//delay(250);
lcddata1("Frequecy=");
delay(100);
lcddata(k);
//lcddata(H);
delay(250);
}
}
void lcdcmd(char value)
{
ldata = value;
rs=0;
24
rw=0;
en=1;
delay(2);
en=0;
}
/*void lcddata(int value)
{
ldata=value;
rs=1;
rw=0;
en=1;
delay(2);
en=0;
}*/
void delay(int time)
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<125;j++);
}
void lcddata(int value)
{
int a[4],i,send=0,n=0;
for(i=0;value!=0;i++)
{
send=value%10;
value=value;
25
a[i]=send;
n++;
}
for(i=n-1;i>=0;i--)
{
ldata=a[i]+0x30;
rs=1;
en=1;
delay(1);
en=0;
}
return;
}
void lcddata1(char *name)
{
int i;
for(i=0;name[i]!='0';i++)
{
P1=name[i];
rs=1;
rw=0;
en=1;
delay(1);
en=0;
}
return;
7.

More Related Content

What's hot

What's hot (20)

Digital electronics logic families
Digital electronics logic familiesDigital electronics logic families
Digital electronics logic families
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
 
Phase Shift Keying & π/4 -Quadrature Phase Shift Keying
Phase Shift Keying & π/4 -Quadrature Phase Shift KeyingPhase Shift Keying & π/4 -Quadrature Phase Shift Keying
Phase Shift Keying & π/4 -Quadrature Phase Shift Keying
 
Microwave linear beam 31
Microwave linear beam 31Microwave linear beam 31
Microwave linear beam 31
 
Sampling Theorem
Sampling TheoremSampling Theorem
Sampling Theorem
 
Sampling theorem
Sampling theoremSampling theorem
Sampling theorem
 
VLSI Testing Techniques
VLSI Testing TechniquesVLSI Testing Techniques
VLSI Testing Techniques
 
Shifters
ShiftersShifters
Shifters
 
Digital modulation techniques...
Digital modulation techniques...Digital modulation techniques...
Digital modulation techniques...
 
Chap 5
Chap 5Chap 5
Chap 5
 
Low power VLSI design
Low power VLSI designLow power VLSI design
Low power VLSI design
 
PLDs
PLDsPLDs
PLDs
 
Pulse width modulation (PWM)
Pulse width modulation (PWM)Pulse width modulation (PWM)
Pulse width modulation (PWM)
 
Sweep Frequency Generator
Sweep Frequency GeneratorSweep Frequency Generator
Sweep Frequency Generator
 
Basics of amplifier
Basics of amplifierBasics of amplifier
Basics of amplifier
 
Signals & Systems PPT
Signals & Systems PPTSignals & Systems PPT
Signals & Systems PPT
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulation
 
LOW POWER DESIGN VLSI
LOW POWER DESIGN VLSILOW POWER DESIGN VLSI
LOW POWER DESIGN VLSI
 
Amplitude shift keying
Amplitude shift keyingAmplitude shift keying
Amplitude shift keying
 
Windowing techniques of fir filter design
Windowing techniques of fir filter designWindowing techniques of fir filter design
Windowing techniques of fir filter design
 

Similar to Frequency counter

Tugas Getaran Mekanis (Vibration Sensors)
Tugas Getaran Mekanis (Vibration Sensors)Tugas Getaran Mekanis (Vibration Sensors)
Tugas Getaran Mekanis (Vibration Sensors)Rizki Dewantoro Raharjo
 
Free Ebooks Download
Free Ebooks DownloadFree Ebooks Download
Free Ebooks DownloadEdhole.com
 
Ultrasonic level meter
Ultrasonic level meterUltrasonic level meter
Ultrasonic level meterhandson28
 
Sensors-and-Actuators-working principle and types of sensors
Sensors-and-Actuators-working principle and types of sensorsSensors-and-Actuators-working principle and types of sensors
Sensors-and-Actuators-working principle and types of sensorsRameshBabu920476
 
Tutorial 8 frequency counter
Tutorial 8   frequency counterTutorial 8   frequency counter
Tutorial 8 frequency counterBrit4
 
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50Ruthvik Vaila
 
Sensors and transducers 1.ppt
Sensors and transducers 1.pptSensors and transducers 1.ppt
Sensors and transducers 1.pptMdJunaid20
 
Automatic room light contoller without microcontroller
Automatic room light contoller without microcontrollerAutomatic room light contoller without microcontroller
Automatic room light contoller without microcontrollerDeepak Yadav
 
1.Oscilloscope. 2.Block diagram of Oscilloscope. 3.Types of Oscilloscope. 4.A...
1.Oscilloscope. 2.Block diagram of Oscilloscope. 3.Types of Oscilloscope. 4.A...1.Oscilloscope. 2.Block diagram of Oscilloscope. 3.Types of Oscilloscope. 4.A...
1.Oscilloscope. 2.Block diagram of Oscilloscope. 3.Types of Oscilloscope. 4.A...AL- AMIN
 
data-acquisition-system-ppt
data-acquisition-system-pptdata-acquisition-system-ppt
data-acquisition-system-pptRavi Anand
 
Design of Microcontroller Based Multi-Frequency Ultrasonic Pulser Receiver
Design of Microcontroller Based Multi-Frequency Ultrasonic Pulser ReceiverDesign of Microcontroller Based Multi-Frequency Ultrasonic Pulser Receiver
Design of Microcontroller Based Multi-Frequency Ultrasonic Pulser ReceiverIJERA Editor
 
Mechatronics study material-Question Bank.pdf
Mechatronics study material-Question Bank.pdfMechatronics study material-Question Bank.pdf
Mechatronics study material-Question Bank.pdfRajaSekaran923497
 

Similar to Frequency counter (20)

Tugas Getaran Mekanis (Vibration Sensors)
Tugas Getaran Mekanis (Vibration Sensors)Tugas Getaran Mekanis (Vibration Sensors)
Tugas Getaran Mekanis (Vibration Sensors)
 
Free Ebooks Download
Free Ebooks DownloadFree Ebooks Download
Free Ebooks Download
 
Ultrasonic level meter
Ultrasonic level meterUltrasonic level meter
Ultrasonic level meter
 
Vishal project1
Vishal project1Vishal project1
Vishal project1
 
Sensors-and-Actuators-working principle and types of sensors
Sensors-and-Actuators-working principle and types of sensorsSensors-and-Actuators-working principle and types of sensors
Sensors-and-Actuators-working principle and types of sensors
 
Oscilloscope tutorial
Oscilloscope tutorialOscilloscope tutorial
Oscilloscope tutorial
 
Freq counter
Freq counterFreq counter
Freq counter
 
Tutorial 8 frequency counter
Tutorial 8   frequency counterTutorial 8   frequency counter
Tutorial 8 frequency counter
 
Amit mahto final
Amit mahto finalAmit mahto final
Amit mahto final
 
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
 
Unit 3 betl 305
Unit 3 betl 305Unit 3 betl 305
Unit 3 betl 305
 
Unit 3 betl 305
Unit 3 betl 305Unit 3 betl 305
Unit 3 betl 305
 
JamesEndl
JamesEndlJamesEndl
JamesEndl
 
Sensors and transducers 1.ppt
Sensors and transducers 1.pptSensors and transducers 1.ppt
Sensors and transducers 1.ppt
 
Electromagnetic flowmeter battery power
Electromagnetic flowmeter battery powerElectromagnetic flowmeter battery power
Electromagnetic flowmeter battery power
 
Automatic room light contoller without microcontroller
Automatic room light contoller without microcontrollerAutomatic room light contoller without microcontroller
Automatic room light contoller without microcontroller
 
1.Oscilloscope. 2.Block diagram of Oscilloscope. 3.Types of Oscilloscope. 4.A...
1.Oscilloscope. 2.Block diagram of Oscilloscope. 3.Types of Oscilloscope. 4.A...1.Oscilloscope. 2.Block diagram of Oscilloscope. 3.Types of Oscilloscope. 4.A...
1.Oscilloscope. 2.Block diagram of Oscilloscope. 3.Types of Oscilloscope. 4.A...
 
data-acquisition-system-ppt
data-acquisition-system-pptdata-acquisition-system-ppt
data-acquisition-system-ppt
 
Design of Microcontroller Based Multi-Frequency Ultrasonic Pulser Receiver
Design of Microcontroller Based Multi-Frequency Ultrasonic Pulser ReceiverDesign of Microcontroller Based Multi-Frequency Ultrasonic Pulser Receiver
Design of Microcontroller Based Multi-Frequency Ultrasonic Pulser Receiver
 
Mechatronics study material-Question Bank.pdf
Mechatronics study material-Question Bank.pdfMechatronics study material-Question Bank.pdf
Mechatronics study material-Question Bank.pdf
 

Recently uploaded

Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 

Recently uploaded (20)

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 

Frequency counter

  • 1. 1 FREQUENCY COUNTER/METER SCHOOL OF ELECTRICAL AND ELECTRONIC ENGINEERING DEPARTMENT OF SIGNAL AND INFORMATION PROCESSING EMBEDDED SYSTEM DESIGN PROJECT Eng DENNIS MWIGHUSA ((唐德宁 )
  • 2. 2 ABSTRACT The object of this project is to determine and display the frequency of the input power. This is done by using 8051 microcontroller. The circuit of our designed frequency meter includes 8051 microcontroller, Liquid Crystal Display(LCD),Cathode Ray Oscilloscope(CRO) and variable power supply unit. The CRO is used to display the frequency waveform of the given input power. Based on the source code given to the 8051 microcontroller it detects the frequency value and displays that value with the help of the LCD employed. Depending on the power supply the value of the frequency on the LCD changes. Most frequency counters work by using a [counter] which accumulates the number of events occurring within a specific period of time. After a preset period (1 second, for example), the value in the counter is transferred to a display and the counter is reset to zero. If the event being measured repeats itself with sufficient stability and the frequency is considerably lower than that of the clock oscillator being used, the resolution of the measurement can be greatly improved by measuring the time required for an entire number of cycles, rather than counting the number of entire cycles observed for a pre-set duration. Frequency counters are commonly used in laboratories, factories, and field environments to provide direct frequency measurements of various devices. The most common applications for frequency counters are measurement and characterization of oscillator and transmitter frequencies.
  • 3. 3 CONTENTS 1. Introduction………………………………………………………………………..3 1.1 Types of frequency meter…………………………………………………….....3 1.2 Block Diagram……………………………………………………………...… 4 2. The Basic Theory of Frequency Counter…………………………………………....5 2.1 Basic Counter Circuits……………………………………………………....…6 3. Hardware……………………………………………………………………………7 3.1 Microcontroller…………………………………………………………..….…7 3.1.1 Features…………………………………………………………………..7 3.1.2 Pin diagram………………………………………………………………8 3.2 Counters………………………………………………………………………....8 3.3 IN-1 Prescaler…………………………………………………………………...9 3.4 IN-2 Pre-amplifier……………………………………………………………....9 3.5 By passing IN-2Amplifier……………………………………………………....9 3.6 IN-2 Polarity Selector…………………………………………………………...9 3.7 Communication Port…………………………………………………………….9 4. Software…………………………………………………………………………....10 4.1 Measuring Modes……………………………………………………………...10 5. Power Supply………………………………………………………………………12 5.1.1 Dual supplies……………………………………………………………...…12 6. Liquid Crystal Display……………………………………………………………..14 6.1 Pin diagram…………………………………………………………………….13 6.2 Pin Descriptions……………………………………………………………..…15 7. Overview of Keil cross C compiler………………………………………………..18 7.1 Simulator/Debugger……………………………………………………………18 8. Proteus……………………………………………………………………………..19 9. Frequency counter applications……………………………………………………19 10. Conclusion………………………………………………………………………..19 References………………………………………………………………………..20 Source code……………………………………………………………………….21
  • 4. 4 FREQUENCY COUNTER/METER 1. INTRODUCTION A frequency counter is an electronic instrument, or component of one, that is used for measuring frequency. Frequency is defined as the number of events of a particular sort occurring in a set period of time. Most frequency counters work by using a counter which accumulates the number of events occurring within a specific period of time. After a preset period (1 second, for example), the value in the counter is transferred to a display and the counter is reset to zero. If the event being measured repeats itself with sufficient stability and the frequency is considerably lower than that of the clock oscillator being used, the resolution of the measurement can be greatly improved by measuring the time required for an entire number of cycles, rather than counting the number of entire cycles observed for a pre-set duration (often referred to as the reciprocal technique). The internal oscillator which provides the time signals is called the timebase, and must be calibrated very accurately. If the thing to be counted is already in electronic form, simple interfacing to the instrument is all that is required. More complex signals may need some conditioning to make them suitable for counting. Most general purpose frequency counters will include some form of amplifier, filtering and shaping circuitry at the input. DSP technology, sensitivity control and hysteresis are other techniques to improve performance. The accuracy of a frequency counter is strongly dependent on the stability of its timebase. Highly accurate circuits are used to generate this for instrumentation purposes, usually using a quartz crystal oscillator within a sealed temperature-controlled chamber known as a crystal oven or OCXO (oven controlled crystal oscillator). In this project the circuit of our designed frequency meter includes microcontroller, Liquid Crystal Display (LCD), Cathode Ray Oscilloscope(CRO) and variable power supply unit. 1.1 Types of frequency meter Various types of frequency meters are used. Many are instruments of the deflection type, ordinarily used for measuring low frequencies but capable of being used for frequencies as high as 900 Hz. These operate by balancing two opposing forces. Changes in the frequency to be measured cause a change in this balance that can be measured by the deflection of a pointer on a scale. Deflection-type meters are of two types, electrically resonant circuits and ratio meters. In one version, this device possesses two coils tuned to different frequencies and connected at right angles to one another in such a way that the whole element, with attached pointer, can move. Frequencies in the middle of the meter’s range cause the currents in the two coils to be approximately equal and the pointer to indicate the midpoint of a scale. Changes in frequency cause an imbalance in the currents in the two coils, causing them and, in turn, the pointer to move. Another type of frequency meter, not of the deflection type, is the resonant-reed type,
  • 5. 5 ordinarily used in ranges from 10 to 1,000 Hz, although special designs can operate at lower or higher frequencies. These work by means of specially tuned steel reeds that vibrate under the effect of electric current; only those reeds that are in resonance vibrate visibly, however. Frequency counters designed for radio frequencies (RF) are also common and operate on the same principles as lower frequency counters. Often, they have more range before they overflow. For very high (microwave) frequencies, many designs use a high-speed prescaler to bring the signal frequency down to a point where normal digital circuitry can operate. The displays on such instruments take this into account so they still display the correct value. Microwave frequency counters can currently measure frequencies up to almost 100 GHz. Above these frequencies the signal to be measured is combined in a mixer with the signal from a local oscillator, producing a signal at the difference frequency, which is low enough to be measured directly. 1.2 Block Diagram Figure:1 Block diagram of a frequency meter The block diagram consists of Microcontroller, LCD display, CRO, Power supply. In the hardware the micro controller is connected with help of the serial port. With the help of the microcontroller the number of pulses will be counted and displayed on the LCD display. The baud rate is set per the micro controller.
  • 6. 6 2. THE BASIC THEORY OF FREQUENCY COUNTER A frequency measurement system which is especially realized in digital counting circuit seems being called "Frequency Counter". Direct Counting Method When count number of cycles of the input signal for one second, the value of frequency can be got in the counter. This can be realized by simple counter circuit so that this was the conventional frequency measuring method. Many counter IC have been released and many frequency counters that work in this method are being shipped now. This is the simplest method but the measuring resolution is limited at low frequency. To ensure more resolution, the gate time must be expanded: e.g. when measure at resolution of 1 mHz, 1000 seconds is needed to measure one time. Reciprocal Method This is one of the frequency measuring methods that was thought out to make up the defect of direct counting method, and it is prevailing now. This method measures the period (T) of the input signal instead of number of cycles, and calculate its frequency in the formula f = 1 / T with a microprocessor. Its frequency resolution depends on only time resolution independent of the input frequency. It can measure low frequency with high resolution quickly however any trigger gitter due to noise decrease measuring resolution. To maintain sufficient time resolution, it generally measures the period of several number of cycles. The reciprocal method seems to also be implemented to cheap frequency counter because of price of microcontrollers falls.
  • 7. 7 2.1 Basic Counter Circuits Every measuring method needs to control any clock signal. However using an AND gate that shown in the diagram of principle will occur an extra count. The error rate depends on the duty ratio of the clock signal: e.g. symmetrical clock signal occurs +0.5 counts average. This cannot be ignored according to circumstance. At high frequency of several MHz, this will not affect measuring accuracy, however input signal of 99.7Hz results 100 or 101 Hz is not good. This problem can be avoided by using a synchronous counter instead. In this circuit, the rate of an extra count depends on only fractional number of less than 1, the clock duty ratio doesn't affect to the extra count. However the synchronous counter can occure any abnormal operation due to asynchronous input that is not guaranteed ts and th. To avoid this problem, any care, such as separating counter stages to insurate most synchronous block or synchronizing control signals with clock to avoid that error, should be taken on this point.
  • 8. 8 3. HARDWARE 3.1 Microcontroller There are different types of microcontrollers that can be used in frequency counter, in this project the AT89C51 will be used .The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with industry-standard MCS-51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. 3.1.1 Features Compatible with MCS-51 Products 4K Bytes of In-System Reprogrammable Flash Memory – Endurance: 1000 Write/Erase Cycles. Fully Static Operation: 0Hz to 24MHz Three-level Program Memory Lock 128 x 8- bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Programmable Serial Channel Low-power Idle and Power-down Modes
  • 9. 9 3.1.2 Pin diagram: Pin diagram of 8051 Figure 2: Pin diagram of 8051 3.2 Counters The main counter that is the most important block in this universal counter is divided into PLD (U1) and MCU (U2). The PLD part is a 12 bit counter. It can count up to 4096 and its most significant bit is connected to an external interrupt pin of the MCU, the carry outs are counted by MCU. Therefore total counter length can be expanded easy. In this system, a 36 bit counter of 12+24 bit is implemented. The frequency of the carry out from PLD becomes approx 30 kHz at 120 MHz of input signal, this can be counted with interrupt process easy. The operating frequency of the PLD is 84 MHz minimum, but it worked at over 140 MHz. To read the counter value in the PLD, a reading mode is used. In this mode, the gate signal from the MCU is routed as a counting clock and the counter gate is opened. Then clock the gate signal until a carry out occurs, the counter value can be calculated with: Counter value = 4096 - number of clocks. Any additional circuit to read the counter is not required, however there is a problem that software loop of up to 4096 times (4.5 msec in AVR) is required. When a shift register to read the counter is implemented, it can be read quickly. But there was not enough left logic cells for the shift register.
  • 10. 10 3.3 IN-1 Prescaler An prescaler IC (MB506) is used as a front end of IN-1. The input frequency is divided by 64 and then input to the PLD. The MB506 can accept from 10 MHz to 2.4 GHz of input frequency. Since this block works at very high frequency, special care should be taken on the significant point at UHF circuit band. 3.4 IN-2 Pre-amplifier The front end of the IN-2 is a high input impedance and wide band amplifier realized with an FET and a transistor. Because it handles small analog signals, decoupling from power supply noise is important for the stability. When there is a dynamic driven LED display, large or small ripple voltage will reside on to power line so that taking care of the ripple voltage is very important. The input sensitivity - frequency response is shown in the technical data. This will nice performance considering it is a simple circuit. To ensure stabled triggering operation, an input attenuator for proper input level is needed. But this was omitted because many lead relays and its mounting space are required. This can be done by using a probe with built-in attenuator. And a termination resister with switch is also needed. But this was also omitted. This can be done by using a coupler with built-in terminator. 3.5 Bypassing IN-2 Amplifier Basically, the input coupling method of frequency counter is AC coupled. However some problems will appear when measure on digital signals: e.g. very large duty ratio, single pulse. Most universal counters have a DC coupling mode with adjustable trigger level. This universal counter can select a TTL coupling mode instead of the DC coupling mode. In this mode, the input signal is bypassed pre-amplifier with a lead relay (RY1) and is connected to the PLD directly. This is suitable for most 5V or 3V logics. 3.6 IN-2 Polarity Selector Inverting trigger polarity of an input signal will not effective for frequency measuring operation, however it is an important function when measure a pulse period or width. This function is a part of the PLD, no additional component is required. 3.7 Communication Port A communication interface is available to collect measured value and apply any process with a PC. Since this universal counter is a measurement instrument, the communication interface must be isolated from its system ground. The interface is an EIA-574 compatible serial port that is isolated with optical isolators.
  • 11. 11 4. SOFTWARE 4.1 Measuring Modes This universal counter have two basic operating modes. One is frequency counting mode that counts incoming signal, other is interval measuring mode that counts reference clock gated by incoming signal. In the Frequency Mode, selected input signal is routed as a counter clock. The gate signal is generated with a timer unit in the MCU and applied to the PLD externally. This can generate variable gate time easy. The operation is a sequential loop that reset counter, open gate for a reference time and then display counter value as a frequency. The gate lamp is lit during gate is opened, and wait for 30 msec before each measuring operation to blink gate lamp to indicate refresh timing. In the Time Interval Mode, the reference clock is routed as a counter clock. The gate signal is generated by input signal. The operation is a sequential loop that reset counter and gating block, wait for end of one gate time by monitoring PLD status (CEN and EOC), read counter value and adjust it with scaling factor and then display it. This mode is also used at reciprocal frequency measuring mode.  Selecting Operation Mode ([Mode] button) Mode button changes operation mode. The setting of operation mode and IN-2 input mode are saved into EEPROM at 3 seconds after changes occurred, it will be restored next start. Mode 0 (Frequency [MHz]) This mode selects IN-1 that divided by 64 with a prescaler. The gate time is 640 msec, so that the total scaling is 1/100. The display format is 0000.0000 MHz, it can display up to 10GHz in resolution of 100 Hz (input range is 10MHz to 2.4GHz). Mode 1 (Frequency [Hz]) This mode and folios use IN-2 as its input channel that can select coupling mode and triggering polarity. In this mode, frequency is measured in direct counting method in gate time of 1 second. The display format is 00000000 Hz, it can display up to 100 MHz in resolution of 1 Hz. Mode 2 (Frequency [Hz]) This mode measures frequency in reciprocal method. The display format is 0000.0000 Hz, it can display up to 10 kHz in resolution of 100 µHz. However there is a problem that the time measuring block can measure only one cycle time, time resolution will inversely proportionate to input frequency. Because the block is for only time interval measurement, not designed for reciprocal method. This mode is an additional measure ring mode with the time internal modes. It would be able to implemented full functional logic if a higher density PLD is used instead. Therefore this mode is suitable for only low input frequency, as for high frequency, direct counting method will do.
  • 12. 12 The top image of this page shows that measuring 400 Hz test signal and last digit is not steady. It seems that is 6 digits resolution because of repeating the time measuring operation for one second and calculating frequency from its average. Mode 3 (Cycle Time [ms]) This mode measures cycle period of rising edges (falling edges at IN-2 inverting mode). The display format is 0000.0000 ms, it can display up to 10 seconds in resolution of 100 nsec. Since the reference clock is 12.8 MHz, actual time resolution is approx. 78 nsec, the counter value is divided by 1.28 and scaled in to 100 nsec resolution. Mode 4 (Pulse Width Time [ms]) This mode measures pulse width of high levels (low levels at IN-2 inverting mode). Any other funcitons are same as mode 3.  Selecting Coupling Mode and Trigger Polarity (([Cupl],[Pol] button) These buttons change coupling mode and trigger polarity of IN-2.  Hold Display ([Hold] button) This button stops and restarts measureing operateion. In hold mode, display will blink to indicate that it is in the hold mode. When no result is displayed after mode change or hold release, wait for a new result and then enter hold mode.  Expanding Gate Time ([Hold]+[Mode] button) This function changes gate time at mode 0 and 1. The gate time is expanded 10 times and frequency resolution is magnified 10 times. However the most decimal points of 7 segment LEDs are used for other status, so that the display format is not changed. Of course output value to the communication port is scaled.  Serial Communication The serial data format is N81, 2400bps. Measured values are sent as a line each at the time of the display is updated. It can be saved as a CSV file. Especially the Microsoft Excel can directly read results into the cells with VBA. When collect any time intervals, it is a simple time interval analyzer. The universal counter can also be controlled by serial commands form host. The command character is not echo-backed, and each functions are as follows: MODE<n><CR> Select operation mode. <n> determines requested mode number which can be 0 to 4. CPL<n><CR> Select IN-2 coupling mode. 0 selects AC coupled, 1 selects TTL coupled. POL<n><CR> Select IN-2 trigger polarity 0 selects rising edge (high level), 1 selects falling edge (low level). GATE<n><CR> Select gate time in mode 0 and 1. 0 selects normal, 1 selects expand to 10 times.
  • 13. 13 5. POWER SUPPLY A power supply (sometimes called a power supply unit or PSU) is a device or system that supplies electrical or other types of energy to an output load or group of loads. The term is most commonly applied to electrical energy supplies, less often to mechanical ones, and rarely to others. 5.1 Types of Power Supply There are many types of power supply. Most are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. For example a 5V regulated supply: Each of the blocks is described in more detail below: Transformer - steps down high voltage AC mains to low voltage AC. Rectifier - converts AC to DC, but the DC output is varying. Smoothing - smoothes the DC from varying greatly to a small ripple. Regulator - eliminates ripple by setting DC output to a fixed voltage. Power supplies made from these blocks are described below with a circuit diagram and a graph of their output: Transformer only Transformer + Rectifier Transformer + Rectifier + Smoothing Transformer + Rectifier + Smoothing + Regulator 5.1.1 Dual Supplies Some electronic circuits require a power supply with positive and negative outputs as well as zero volts (0V). This is called a 'dual supply' because it is like two ordinary supplies connected together as shown in the diagram.
  • 14. 14 Dual supplies have three outputs, for example a ±9V supply has +9V, 0V and -9V outputs.  Transformer only The low voltage AC output is suitable for lamps, heaters and special AC motors. It is not suitable for electronic circuits unless they include a rectifier and a smoothing capacitor.  Transformer + Rectifier The varying DC output is suitable for lamps, heaters and standard motors. It is not suitable for electronic circuits unless they include a smoothing capacitor.  Transformer + Rectifier + Smoothing
  • 15. 15 The smooth DC output has a small ripple. It is suitable for most electronic circuits.  Transformer + Rectifier + Smoothing + Regulator The regulated DC output is very smooth with no ripple. It is suitable for all electronic circuits. 6. LIQUID CRYSTAL DISPLAY LCD is a type of display used in digital watches and many portable computers. LCD displays utilize to sheets of polarizing material with a liquid crystal solution between them. An electric current passed through the liquid causes the crystals to align so that light cannot pass through them. LCD technology has advanced very rapidly since its initial inception over a decade ago for use in laptop computers. Technical achievement has resulted in brighter displace, higher resolutions, reduce response times and cheaper manufacturing process. The liquid crystals can be manipulated through an applied electric voltage so that light is allowed to pass or is blocked. By carefully controlling where and what wavelength (color) of light is allowed to pass, the LCD monitor is able to display images. A back light provides LCD monitor’s brightness. Just as there are many varieties of solids and liquids, there is also a variety of liquid crystal substances. Depending on the temperature and particular nature of a substance, liquid crystals can be in one of several distinct phases. Over the years many improvements have been made to LCD to help enhance resolution, image, sharpness and response times. One of the latest such advancements is TFT or Thin Film Transistor. TFT-LCD’s make use of a very thin transistor that is applied to glass during acts as switch allowing control of light at the pixel level, greatly enhancing image sharpness and resolution. This has been particularly important for improving LCD’s ability to display small-sized fonts and image clearly. LCD interfacing with 8051 is a real-world application. In recent years the LCD is finding widespread use replacing LEDs (seven segment LEDs or other multi segment LEDs). This is due to following reasons: 1. The declining prices of LCDs.
  • 16. 16 2. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU to keep displaying the data. 3. Ease of programming for characters and graphics. 6.1 Pin Diagram Most of the LCD modules conform to a standard interface specification. A 14pin access is provided having eight data lines, three control lines and three power lines. The connections are laid out in one of the two common configurations, either two rows of seven pins, or a single row of 14 pins. One of the, pins are numbered on the LCD’s print circuit board (PCB), but if not, it is quite easy to locate pin1. Since this pin is connected to ground, it often has a thicker PCB track, connected to it, and it is generally connected to metalwork at same point. Figure 3: Pin diagram of LCD display 6.2 Pin Descriptions Vcc, Vss and Vee While Vcc and Vss provide +5V and ground respectively, Vee is used for controlling LCD contrast. RS, register select There are two very important registers inside the LCD. The RS pin is used for their selection as follows.
  • 17. 17 a) If RS=0, the instruction command code register is selected, allowing the user to send a command such as clear display, cursor at home, etc., b) If RS=1 the data register is selected, allowing the user to send data to be displayed on the LCD. R/W, read/write R/W input allows the user to write information to the LCD or read information from it. R/W=1 when reading; R/W=0 when writing. EN, Enable The enable pin is used by the LCD to latch information presented to its data pins. When data is supplied to data pins, a high-to-low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450ns wide. D0-D7 The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents of the LCD’s internal registers. To display letters and numbers, we send ASCII codes for the letters A-Z, a-z, and numbers 0-9 to these pins while making RS=1. We also use RS=0 to check the busy flag bit to see if the LCD is ready to receive information. The busy flag is D7 and can be read when R/W=1 and RS=0, as follows: if R/W=1, RS=0. When D7=1 (busy flag=1), the LCD is busy taking care of internal operations and will not accept any information.
  • 18. 18 The pin descriptions are given in table below: Table1: The pin descriptions Instruction set of LCD Table2: Instruction set of LCD
  • 19. 19 7. OVERVIEW OF KEIL CROSS C COMPILER It is possible to create the source files in a text editor such as Notepad, run the Compiler on each C source file, specifying a list of controls, run the Assembler on each Assembler source file, specifying another list of controls, run either the Library Manager or Linker (again specifying a list of controls) and finally running the Object-HEX Converter to convert the Linker output file to an Intel Hex File. Once that has been completed the Hex File can be downloaded to the target hardware and debugged. Alternatively KEIL can be used to create source files; automatically compile, link and covert using options set with an easy to use user interface and finally simulate or perform debugging on the hardware with access to C variables and memory. Unless you have to use the tolls on the command line, the choice is clear. KEIL Greatly simplifies the process of creating and testing an embedded application. 7.1 Simulator/Debugger The simulator/ debugger in KEIL can perform a very detailed simulation of a micro controller along with external signals. It is possible to view the precise execution time of a single assembly instruction, or a single line of C code, all the way up to the entire application, simply by entering the crystal frequency. A window can be opened for each peripheral on the device, showing the state of the peripheral. This enables quick trouble shooting of mis-configured peripherals. Breakpoints may be set on either assembly instructions or lines of C code, and execution may be stepped through one instruction or C line at a time. The contents of all the memory areas may be viewed along with ability to find specific variables. In addition the registers may be viewed allowing a detailed view of what the microcontroller is doing at any point in time. The Keil Software 8051 development tools listed below are the programs you use to compile your C code, assemble your assembler source files, link your program together, create HEX files, and debug your target program. μVision2 for Windows™ Integrated Development Environment: combines Project Management, Source Code Editing, and Program Debugging in one powerful environment. C51 ANSI Optimizing C Cross Compiler: creates relocatable object modules from your C source code, A51 Macro Assembler: creates relocatable object modules from your 8051 assembler source code, BL51 Linker/Locator: combines relocatable object modules created by the compiler and assembler into the final absolute object module, LIB51 Library Manager: combines object modules into a library, which may be used by the linker, OH51 Object-HEX Converter: creates Intel HEX files from absolute object modules.
  • 20. 20 8. PROTEUS In Greek mythology, Proteus (Πρωτεύς) is an early sea-god, one of several deities whom Homer calls the "Old Man of the Sea", whose name suggests the "first" (from Greek "πρ_τος" - protos, "first"), as protogonos (πρωτόγονος) is the "primordial" or the "firstborn". He became the son of Poseidon in the Olympian theology (Odyssey iv. 432), or of Nereus and Doris, or of Oceanus and a Naiad, and was made the herdsman of Poseidon's seals, the great bull seal at the center of the harem. He can foretell the future, but, in am theme familiar from several cultures, will change his shape to avoid having to; he will answer only to someone who is capable of capturing him. From this feature of Proteus comes the adjective protean, with the general meaning of "versatile", "mutable", "capable of assuming many forms". "Protean" has positive connotations of flexibility, versatility and adaptability. The earliest attested form of the name is the Mycenaean Greek po-ro-te-u, written in Linear B syllabic script. 9. FREQUENCY COUNTER APPLICATIONS A good use of the frequency meter is to calibrate other equipment. For example a signal generator that doesn't have its own digital display. The meter will show the exact frequency being produced by the signal generator. Texas Instruments manufacture a series of light sensors (e.g. TSL220) which produce an output frequency dependent on light intensity. They are very easy to use requiring just one external capacitor. A light meter combining one of these sensors with the frequency meter could accurately measure irradiance over a 3 decade range. 10. CONCLUSION The frequency meter using 8051 displays the value of frequency of the waveforms given to the CRO from the power supply on the LCD. Depending on the input value given to the CRO the value of the frequency changes. In total, the complete system (including all the hardware components and software routines) is working as per the initial specifications and requirements of our project. So certain aspects of the system can be modified as operational experience is gained with it. As the users work with the system, they develop various new ideas for the development and enhancement of the project.
  • 21. 21 References 1. http://grietinfo.in/projects/MINI/EEE/DOC-A.12-frequencymeter.pdf - 2. http://www.radio-electronics.com/info/t_and_m/ 3. http://elm-chan.org/works/uctr/report.html 4. http://www.apogeekits.com/counter_article.htm 5. http://en.wikipedia.org/wiki/Frequency_counter 6. http://grietinfo.in/projects/MINI/EEE/DOC-A.12-frequencymeter.pdf
  • 22. 22 SOURCE CODE #include<reg51.h> sbit intr=P3^4; sfr ldata=0x90; sbit rs=P2^0; sbit rw=P2^1; sbit en=P2^2; void lcdcmd(char ); void delay(int); void lcddata(int); void lcddata1(char *value); void main() { int i,l,H,k; //char n; while(1) { TMOD=0x15; intr=1; TL0=0x00; TH0=0x00; TR0=1; for(i=0;i<28;i++) { TL1=0x00; TH1=0x00; TR1=1;
  • 24. 24 rw=0; en=1; delay(2); en=0; } /*void lcddata(int value) { ldata=value; rs=1; rw=0; en=1; delay(2); en=0; }*/ void delay(int time) { int i,j; for(i=0;i<time;i++) for(j=0;j<125;j++); } void lcddata(int value) { int a[4],i,send=0,n=0; for(i=0;value!=0;i++) { send=value%10; value=value;
  • 25. 25 a[i]=send; n++; } for(i=n-1;i>=0;i--) { ldata=a[i]+0x30; rs=1; en=1; delay(1); en=0; } return; } void lcddata1(char *name) { int i; for(i=0;name[i]!='0';i++) { P1=name[i]; rs=1; rw=0; en=1; delay(1); en=0; } return; 7.