Sie sind auf Seite 1von 23





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.

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. Hardware7
3.1 Microcontroller...7
3.1.1 Features..7
3.1.2 Pin diagram8
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 Supply12
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/Debugger18
8. Proteus..19
9. Frequency counter applications19

10. Conclusion..19
Source code.21

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
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 meters 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, 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.


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.

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.


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, highperformance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and
erasable read only memory (PEROM). The device is manufactured using Atmels
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

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.

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

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.

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.
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
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.
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
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.
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.
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:
Select operation mode. <n> determines requested mode number which can be 0 to

Select IN-2 coupling mode. 0 selects AC coupled, 1 selects TTL coupled.
Select IN-2 trigger polarity 0 selects rising edge (high level), 1 selects falling
edge (low level).
Select gate time in mode 0 and 1. 0 selects normal, 1 selects expand to 10 times.

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.

Dual supplies have three outputs, for example a 9V supply has +9V, 0V and -9V
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
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

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


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 monitors 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-LCDs 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
LCDs 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:

The declining prices of LCDs.


Incorporation of a refreshing controller into the LCD, thereby relieving the CPU
to keep displaying the data.


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
LCDs 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.
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.
The 8-bit data pins, D0-D7, are used to send information to the LCD or read the
contents of the LCDs 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
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.

The pin descriptions are given in table below:


Table1: The pin descriptions

Instruction set of LCD

Table2: Instruction set of LCD


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 ObjectHEX 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

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.


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.

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.



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;

void lcdcmd(char value)
ldata = value;

/*void lcddata(int value)
void delay(int time)
int i,j;
void lcddata(int value)
int a[4],i,send=0,n=0;

void lcddata1(char *name)
int i;