Top Banner

of 58

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

54

CHAPTER-1

(INTRODUCTION)

1.1.Introduction

Avending machineis a machine which dispenses items such as snacks, beverages, alcohol, cigarettes, lottery tickets, cologne, consumer products and even gold and gems to customers automatically, after the customer inserts currency orcreditinto the machine. The earliest known reference to a vending machine is in the work ofHero of Alexandria, a first-century engineer and mathematician.The earliest known reference to a vending machine is in the work ofHero of Alexandria, a first-century engineer and mathematician. His machine accepted a coin and then dispensedholy water.When the coin was deposited, it fell upon a pan attached to a lever. The lever opened a valve which let some water flow out. The pan continued to tilt with the weight of the coin until it fell off, at which point a counterweight snapped the lever up and turned off the valve.Coin-operated machines that dispensedtobaccowere being operated as early as 1615 in thetavernsof England. The machines were portable and made ofbrass. An English bookseller, Richard Carlile, devised a newspaper dispensing machine for the dissemination of banned works in 1822. Simeon Denham was awarded British Patent no. 706 for his stamp dispensing machine in 1867, the first fully automatic vending machine.The first modern coin-operated vending machines were introduced inLondonin theUnited Kingdomin the early 1880s, dispensing post cards. The machine was invented by Percival Everitt in 1883. The Sweetmeat Automatic Delivery Company was founded in 1887 in England as the first company to deal primarily with the installation and maintenance of vending machines.The first vending machine in the U.S. was built in 1888 by theThomas Adams Gum Company, selling gum onNew York Citytrain platforms. The idea of adding games to these machines as a further incentive to buy came in 1897 when the Pulver Manufacturing Company added small figures, which would move around whenever somebody bought some gum from their machines. This idea spawned a whole new type of mechanical device known as the "trade stimulators". The birth ofslot machinesand pinball is ultimately rooted in these early devices.In December 1970, Ussery Industries of Dallas, Texas at its Dallas convention displayed its "talking" vending machine, the Venda Talker. With insertion of a coin, the machine said "thank you" and added a one-liner voiced by comic Henny Youngman.After paying, a product may become available by: the machine releasing it, so that it falls in an open compartment at the bottom, or into a cup, either released first, or put in by the customer, or the unlocking of a door, drawer, or turning of a knob.Some products need to be prepared to become available. For example, tickets are printed or magnetized on the spot, and coffee is freshly concocted. One of the most common form of vending machine, the snack machine, often uses a metal coil which when ordered rotates to release the product.

1.2.Block Diagram

Figure-1.1. Block diagram of Project

1.2.1. Description:

Our Endeavour behind the project is to develop a compact vending machine for small scale selling purposes using M/C 8051 and screen display 16 into 12 to run the system efficiently. We also had developed the programming for enhancing system efficiency and accountability. The system is capable to dispense three liquids with proper controlling and accountability so that manual vending could be replaced by automated vending and anthropological mistakes could be overcome.

1.3. Components description

There are many types of power supply. Most are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronic 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:

1.3.1. Power Supply:

Figure-1.2. Block diagram of power supplyEach 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 + RegulatorSome electronic circuits require a power supply with positive and negative outputs Figure-1.3.Dual Suppliesas 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 outputs.Transformer only

Figure-1.4 Step down transformer workingThelow voltage ACoutput is suitable for lamps, heaters and special AC motors. It isnotsuitable for electronic circuits unless they include a rectifier and a smoothing capacitor.

Transformer + Rectifier Figure-1.5.Transformer with rectifierThevarying DCoutput is suitable for lamps, heaters and standard motors. It isnotsuitable for electronic circuits unless they include a smoothing capacitor.

Transformer + Rectifier + SmoothingFigure-1.6 Transformer with rectifier and capacitor

Thesmooth DCoutput has a small ripple. It is suitable for most electronic circuits.

Transformer + Rectifier + Smoothing + Regulator

Figure-1.7. Transformer with rectifier, capacitor and regulatorTheregulated DCoutput is very smooth with no ripple. It is suitable for all electronic circuits.Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is Accosted-up transformers increase voltage, step-down transformers reduce voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in UK) to a safer low voltage.The input coil is called theprimaryand the output coil is called thesecondary. There is no electrical connection between the two coils, instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core.Transformers waste very little power so the power out is almost equal to the power in. Note that as voltage is stepped down current is stepped up.The ratio of the number of turns on each coil, called theturns ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage.turnsratio=Up=Npandpowerout=powerin

VsNsVsIs=VpIp

Vp = primary (input) voltageNp = number of turns on primary coilIp = primary (input) currentVs = secondary (output) voltageNs = number of turns on secondary coilIs = secondary (output) current

Rectifier

There are several ways of connecting diodes to make a rectifier to convert AC to DC. Thebridgerectifieris the most important and it producesfull-wavevarying DC. A full-wave rectifier can also be made from just two diodes if a centre-tap transformer is used, but this method is rarely used now that diodes are cheaper. Asinglediodecan be used as a rectifier but it only uses the positive (+) parts of the AC wave to producehalf-wavevarying DC.

1.3.1.1 Bridge Rectifier

A bridge rectifier can be made using four individual diodes, but it is also available in special packages containing the four diodes required. It is called a full-wave rectifier because it uses all the AC wave (both positive and negative sections). 1.4V is used up in the bridge rectifier because each diode uses 0.7V when conducting and there are always two diodes conducting, as shown in the diagram below. Bridge rectifiers are rated by the maximum current they can pass and the maximum reverse voltage they can withstand (this must be at least three times the supplyRMS voltage so the rectifier can withstand the peak voltages). Please see theDiodespage for more details, including pictures of bridge rectifiers.

Figure-1.8 Bridge rectifier & waveform

1.3.1.2 Single diode rectifier

A single diode can be used as a rectifier but this produceshalf-wavevarying DC which has gaps when the AC is negative. It is hard to smooth this sufficiently well to supply electronic circuits unless they require a very small current so the smoothing capacitor does not significantly discharge during the gaps.

Figure-1.9 Half wave rectifier & waveform.

1.3.1.3 Smoothing:

Smoothing is performed by a large valueelectrolytic capacitorconnected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The diagram shows the unsmoothed varying DC (dotted line) and the smoothed DC (solid line). The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output.

Figure-1.10. Simple capacitor waveform

Note that smoothing significantly increases the average DC voltage to almost the peak value (1.4RMSvalue). For example 6V RMS AC is rectified to full wave DC of about 4.6V RMS (1.4V is lost in the bridge rectifier), with smoothing this increases to almost the peak value giving 1.44.6=6.4V smooth DC.Smoothing is not perfect due to the capacitor voltage falling a little as it discharges, giving a smallripple voltage. For many circuits a ripple which is 10% of the supply voltage is satisfactory and the equation below gives the required value for the smoothing capacitor. A larger capacitor will give less ripple. The capacitor value must be doubled when smoothing half-wave DC.

Smoothing capacitor for 10% ripple, C =5 Io

Vs f

C=smoothing capacitance in farads (F), Io = output current from the supply in amps (A)Vs = supply voltage in volts (V), this is the peak value of the unsmoothed DCf = frequency of the AC supply in hertz (Hz), 50Hz in the UK

1.3.2 Regulator

Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variable output voltages. They are also rated by the maximum current they can pass. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection').Many of the fixed voltage regulator ICs have 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. They include a hole for attaching aheat sinkif necessary. Figure-1.11. Regulator

1.3.3 Capacitor:

A capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric (insulator). When a potential difference (voltage) exists across the conductors, an electric field is present in the dielectric. This field stores energy and produces a mechanical force between the conductors. The effect is greatest when there is a narrow separation between large areas of conductor, hence capacitor conductors are often called plates.An ideal capacitor is characterized by a single constant value, capacitance, which is measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. In practice, the dielectric between the plates passes a small amount of leakage current. The conductors and leads introduce an equivalent series resistance and the dielectric has an electric field strength limit resulting in a breakdown voltage.Capacitors are widely used in electronic circuits to block the flow of direct current while allowing alternating current to pass, to filter out interference, to smooth the output of power supplies, and for many other purposes. They are used in resonant circuits in radio frequency equipment to select particular frequencies from a signal with many frequencies.

Figure-1.12.Capacitors

Theory of operation of capacitor:

Fig-1.13.Plate capacitor

Charge separation in a parallel-plate capacitor causes an internal electric field. A dielectric (orange) reduces the field and increases the capacitance.A capacitor consists of two conductors separated by a non-conductive region. The non-conductive substance is called the dielectric medium, although this may also mean a vacuum or a semiconductor depletion region chemically identical to the conductors. A capacitor is assumed to be self-contained and isolated, with no net electric charge and no influence from an external electric field. The conductors thus contain equal and opposite charges on their facing surfaces, and the dielectric contains an electric field. The capacitor is a reasonably general model for electric fields within electric circuits.An ideal capacitor is wholly characterized by a constant capacitance C, defined as the ratio of charge Q on each conductor to the voltage V between them

Sometimes charge build-up affects the mechanics of the capacitor, causing the capacitance to vary. In this case, capacitance is defined in terms of incremental changes:

In SI units, a capacitance of one farad means that one coulomb of charge on each conductor causes a voltage of one volt across the device. Energy storage work must be done by an external influence to move charge between the conductors in a capacitor. When the external influence is removed, the charge separation persists and energy is stored in the electric field. If charge is later allowed to return to its equilibrium position, the energy is released. The work done in establishing the electric field, and hence the amount of energy stored, is given by:

The current i(t) through a component in an electric circuit is defined as the rate of change of the charge q(t) that has passed through it. Physical charges cannot pass through the dielectric layer of a capacitor, but rather build up in equal and opposite quantities on the electrodes: as each electron accumulates on the negative plate, one leaves the positive plate. Thus the accumulated charge on the electrodes is equal to the integral of the current, as well as being proportional to the voltage. As with any ant derivative, a constant of integration is added to represent the initial voltage v (t0). This is the integral form of the capacitor equation,.Taking the derivative of this, and multiplying by C, yields the derivative form..The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than the electric field. Its current-voltage relation is obtained by exchanging current and voltage in the capacitor equations and replacing C with the inductance L.

1.3.4 Resistor:

Resistors are used to limit the value of current in a circuit. Resistors offer opposition to the flow of current. They are expressed in ohms for which the symbol is . Resistors are broadly classified as (1) Fixed Resistors(2) Variable Resistors

1.3.4.1 Fixed Resistors:

The most common of low wattage, fixed type resistors is the molded-carbon composition resistor. The resistive material is of carbon clay composition. The leads are made of tinned copper. Resistors of this type are readily available in value ranging from few ohms to about 20M, having a tolerance range of 5 to 20%. They are quite inexpensive. The relative size of all fixed resistors changes with the wattage rating. Another variety of carbon composition resistors is the metalized type. It is made by deposition a homogeneous film of pure carbon over a glass, ceramic or other insulating core. This type of film-resistor is sometimes called the precision type, since it can be obtained with an accuracy of 1%. LeadTinned Copper Material

Colour Coding Molded Carbon Clay Composition Fig-1.14. Fixed Resistor

Coding Of Resistor :

Some resistors are large enough in size to have their resistance printed on the body. However there are some resistors that are too small in size to have numbers printed on them. Therefore, a system of colour coding is used to indicate their values. For fixed, moulded composition resistor four colour bands are printed on one end of the outer casing. The colour bands are always read left to right from the end that has the bands closest to it. The first and second band represents the first and second significant digits, of the resistance value. The third band is for the number of zeros that follow the second digit. In case the third band is gold or silver, it represents a multiplying factor of 0.1to 0.01. The fourth band represents the manufactures tolerance.Resistor color coding chart:

5 green0 black1 brown2 red3 orange4 yellow6 blue7 purple8 silver9 white5 green0 black1 brown2 red3 orange4 yellow6 blue7 purple8 silver9 white0 black1 brown2 red3 orange4 yellow6 blue7 purple8 silver9 white5 green0 black1 brown2 red3 orange4 yellow6 blue7 purple8 silver9 white

5 green

Figure1.15. Color coding of resistorFor example, if a resistor has a colour band sequence: yellow, violet, orange and gold Then its range will be-Yellow=4, violet=7, orange=10, gold=5% =47K 5% =2.35K

Most resistors have 4 bands: The first band gives the first digit. The second band gives the second digit. The third band indicates the number of zeros. The fourth band is used to show the tolerance (precision) of the resistor.

Figure-1.16. resistorThis resistor has red (2), violet (7), yellow (4 zeros) and gold bands. So its value is 270000 = 270 k. The standard colour code cannot show values of less than 10. To show these small values two special colours are used for the third band: gold, which means 0.1 and silver which means 0.01. The first and second bands represent the digits as normal.For example:red, violet, gold bands represent 270.1=2.7blue, green, silver bands represent 560.01=0.56The fourth band of the colour code shows the tolerance of a resistor. Tolerance is the precision of the resistor and it is given as a percentage. For example a 390 resistor with a tolerance of 10% will have a value within 10% of 390, between 390 - 39 = 351 and 390 + 39 = 429 (39 is 10% of 390).A special colour code is used for the fourth band tolerance:silver 10%, gold 5%, red 2%, brown 1%. If no fourth band is shown the tolerance is 20%.

1.3.4.2 Variable resistor

In electronic circuits, sometimes it becomes necessary to adjust the values of currents and voltages. For n example it is often desired to change the volume of sound, the brightness of a television picture etc. Such adjustments can be done by using variable resistors.Although the variable resistors are usually called rheostats in other applications, the smaller variable resistors commonly used in electronic circuits are called potentiometers. Variable resistors consist of a resistancetrackwith connections at both ends and awiperwhich moves along the track as you turn the spindle. The track may be made from carbon, cermet (ceramic and metal mixture) or a coil of wire (for low resistances). The track is usually rotary but straight track versions, usually called sliders, are also available.Variable resistors may be used as the track) or as apotentiometerwith allthreeconnections in

Standard Variable ResistorFigure-1.17 Variable resistor

use. Miniature versions calledpresetsare made for setting up circuits which will not require further adjustment.Variable resistors are often calledpotentiometersin books and catalogues. They are specified by their maximum resistance, linear or logarithmic track, and their physical size. The standard spindle diameter is 6mm.The resistance and type of track are marked on the body: 4K7 LINmeans 4.7 klinear track. 1M LOGmeans 1 Mlogarithmic track.Some variable resistors are designed to be mounted directly on the circuit board, but most are for mounting through a hole drilled in the case containing the circuit with stranded wire connecting their terminals to the circuit board.

Electrical energy is converted to heat when current flows through a resistor. Usually the effect is negligible, but if the resistance is low (or the voltage across the resistor high) a large current may pass making the resistor become noticeably warm. The resistor must be able to high power resistor withstand the heating effect and resistors have power ratings to show this.Power ratings of resistors are rarely quoted in parts lists because for most circuits the standard power ratings of 0.25W or 0.5W are suitable. For the rare cases where a higher power is required it should be clearly specified in the parts list, these will be circuits using low value resistors (less than about 300) or high voltages (more than 15V).The power, P, developed in a resistor is given by: P =IR or P=V/ R

where:P = power developed in the resistor in watts (W) I = current through the resistor in amps (A) R = resistance of the resistor in ohms () V = voltage across the resistor in volts (V)

Examples: A 470 resistor with 10V across it, needs a power rating P = V/R = 10/470 = 0.21W. In this case a standard 0.25W resistor would be suitable. A 27 resistor with 10V across it, needs a power rating P = V/R = 10/27 = 3.7W. A high power resistor with a rating of 5W would be suitable.

1.3.5 Diode

A PN junction is known as a semiconductor or crystal diode. A crystal diode has two terminal when it is connected in a circuit one thing is decide is weather a diode is forward or reversed biased. There is a easy rule to ascertain it. If the external CKT is trying to push the conventional current in the direction of error, the diode is forward biased. One the other hand if the conventional current is trying is trying to flow opposite the error head, the diode is reversed biased putting in simple words.

Figure-1.18 Symbol of diode

If arrowhead of diode symbol is positive W.R.T Bar of the symbol, the diode is forward biased. The arrowhead of diode symbol is negative W.R.T bar , the diode is the reverse bias.When we used crystal diode it is often necessary to know that which end is arrowhead and which end is bar. So following method are available. 3.Some manufactures actually point the symbol on the body of the diode. 4.Sometimes red and blue marks are on the body of the crystal diode. Red mark do not arrow wheres blue mark indicates bar

1.3.6 Transistor

A transistor is an active device. It consists of two PN junctions formed by sandwiching either p-type or n-type semiconductor between a pair of opposite types.

There are two types of transistor:1. n-p-n transistor 2. p-n-p transistor

Figure1.19. Transistor symbol

An n-p-n transistor is composed of two n-type semiconductors separated by a thin section of p-type. However a p-n-p type semiconductor is formed by two p-sections separated by a thin section of n-type.Transistor has two pn junctions one junction is forward biased and other is reversed biased. The forward junction has a low resistance path whereas a reverse biased junction has a high resistance path. The weak signal is introduced in the low resistance circuit and output is taken from the high resistance circuit. Therefore a transistor transfers a signal from a low resistance to high resistance.Transistor has three sections of doped semiconductors. The section on one side is emitter and section on the opposite side is collector. The middle section is base.Emitter : The section on one side that supplies charge carriers is called emitter. The emitter is always forward biased w.r.t. base.

Figure-1.20 Configuration of transistor

Collector : The section on the other side that collects the charge is called collector. The collector is always reversed biased.Base : The middle section which forms two pn-junctions between the emitter and collector is called base. A transistor raises the strength of a weak signal and thus acts as an amplifier. The weak signal is applied between emitter-base junction and output is taken across the load Rc connected in the collector circuit. The collector current flowing through a high load resistance Rc produces a large voltage across it. Thus a weak signal applied in the input appears in the amplified form in the collector circuit.

1.3.7 Connectors:

Connectors are basically used for interface between two. Here we use connectors for having interface between PCB and 8051 Microprocessor Kit.There are two types of connectors they are male and female. The one, which is with pins inside, is female and other is male.These connectors are having bus wires with them for connection.For high frequency operation the average circumference of a coaxial cable must be limited to about one wavelength, in order to reduce multimodal propagation and eliminate erratic reflection coefficients, power losses, and signal distortion. The standardization of coaxial connectors during World War II was mandatory for microwave operation to maintain a low reflection coefficient or a low voltage standing wave ratio.Seven types of microwave coaxial connectors are as follows:1. APC-3.52. APC-73. BNC4. SMA5. SMC6. TNC7.Type

1.3.8 AT89C51:

AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. AT89C51 has 4KB of Flash programmable and erasable read only memory (PEROM) and 128 bytes of RAM. It can be erased and program to a maximum of 1000 times.In 40 pin AT89C51, there are four ports designated as P1, P2, P3 and P0. All these ports are 8-bit bi-directional ports, i.e., they can be used as both input and output ports.

Figure 1.21 .microcontroller 8051ups and can be used as inputs. These ports are also bit addressable and so their bits can also be accessed individually. Port P0 and P2 are also used to provide low byte and high byte addresses, respectively, when connected to an external memory. Port 3 has multiplexed pins for special functions like serial communication, hardware interrupts, timer inputs and read/write operation from external memory. AT89C51 has an inbuilt UART for serial communication. It can be programmed to operate at different baud rates. Including two timers & hardware interrupts, it has a total of six interrupts.

PIN DESCRIPTION: VCC Supply voltage. GND Ground. Port 0 Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 may also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode P0 has internal pullups. Port 0 also receives the code bytes during Flash programming, and outputs the code bytes during program verification. External pullups are required during program verification. Port 1 Port 1 is an 8-bit bi-directional I/O port with internal pullups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pullups. Port 1 also receives the low-order address bytes during Flash programming and verification. Port 2 Port 2 is an 8-bit bi-directional I/O port with internal pullups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pullups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, it uses strong internal pullups when emitting 1s. During access to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit bi-directional I/O port with internal pullups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups. Port 3 also serves the functions of various special features of the AT89C51 as listed below:Port Pin Alternate Functions P3.0 RXD (serial input port) P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input) P3.6 WR (external data memory write strobe) P3.7 RD (external data memory read strobe) Port 3 also receives some control signals for Flash programming and verification.RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. PSEN Program Store Enable is the read strobe to external program memory. When the AT89C51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming, for parts that require 12-volt VPP. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier

.1.3.9 Oscillator Characteristics

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

Idle Mode In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. It should be noted that when idle is terminated by a hard ware reset, the device normally resumes program execution, from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory. Power-down Mode In the power-down mode, the oscillator is stopped, and the instruction that invokes power-down is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the power-down mode is terminated. The only exit from power-down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.

1.3.10 Solenoid Valve

A solenoid valve is an electromechanically operated valve. The valve is controlled by an electric current through a solenoid: in the case of a two-port valve the flow is switched on or off; in the case of a three-port valve, the outflow is switched between the two outlet ports. Multiple solenoid valves can be placed together on a manifold.Solenoid valves are the most frequently used control elements in fluidics. Their tasks are to shut off, release, dose, distribute or mix fluids. They are found in many application areas. Solenoids offer fast and safe switching, high reliability, long service life, good medium compatibility of the materials used, low control power and compact design.Besides the plunger-type actuator which is used most frequently, pivoted-armature actuators and rocker actuators are also used.There are many valve design variations. Ordinary valves can have many ports and fluid paths. A 2-way valve, for example, has 2 ports; if the valve is open, then the two ports are connected and fluid may flow between the ports; if the valve is closed, then ports are isolated. If the valve is open when the solenoid is not energized, then the valve is termed normally open (N.O.). Similarly, if the valve is closed when the solenoid is not energized, then the valve is termed normally closed. There are also 3-way and more complicated designs. A 3-way valve has 3 ports; it connects one port to either of the two other ports (typically a supply port and an exhaust port).Solenoid valves are also characterized by how they operate. A small solenoid can generate a limited force. If that force is sufficient to open and close the valve, then a direct acting solenoid valve is possible. An approximate relationship between the required solenoid force Fs, the fluid pressure P, and the orifice area A for a direct acting solenoid value is:

Where d is the orifice diameter. A typical solenoid force might be 15N (3.4lbf). An application might be a low pressure (e.g., 10 pounds per square inch (69kPa)) gas with a small orifice diameter (e.g., 38in (9.5mm) for an orifice area of 0.11sqin (7.1105m2) and approximate force of 1.1lbf (4.9N)).When high pressures and large orifices are encountered, then high forces are required. To generate those forces, an internally piloted solenoid valve design may be possible. In such a design, the line pressure is used to generate the high valve forces; a small solenoid controls how the line pressure is used. Internally piloted valves are used in dishwashers and irrigation systems where the fluid is water, the pressure might be 80 pounds per square inch (550kPa) and the orifice diameter might be 34in (19mm).In some solenoid valves the solenoid acts directly on the main valve. Others use a small, complete solenoid valve, known as a pilot, to actuate a larger valve. While the second type is actually a solenoid valve combined with a pneumatically actuated valve, they are sold and packaged as a single unit referred to as a solenoid valve. Piloted valves require much less power to control, but they are noticeably slower. Piloted solenoids usually need full power at all times to open and stay open, where a direct acting solenoid may only need full power for a short period of time to open it, and only low power to hold it.A direct acting solenoid valve typically operates in 5 to 10 milliseconds. The operation time of a piloted valve depends on its size; typical values are 15 to 150 milliseconds.

Fig.1.22 Solenoid valveWhile there are multiple design variants, the following is a detailed breakdown of a typical solenoid valve design.A solenoid valve has two main parts: the solenoid and the valve. The solenoid converts electrical energy into mechanical energy which, in turn, opens or closes the valve mechanically. A direct acting valve has only a small flow circuit, shown within section E of this diagram (this section is mentioned below as a pilot valve). In this example, a diaphragm piloted valve multiplies this small pilot flow, by using it to control the flow through a much larger orifice.Solenoid valves may use metal seals or rubber seals, and may also have electrical interfaces to allow for easy control. A spring may be used to hold the valve opened (normally open) or closed (normally closed) while the valve is not activated.

The diagram to the right shows the design of a basic valve, controlling the flow of water in this example. At the top figure is the valve in its closed state. The water under pressure enters at A. B is an elastic diaphragm and above it is a weak spring pushing it down. The diaphragm has a pinhole through its center which allows a very small amount of water to flow through it. This water fills the cavity C on the other side of the diaphragm so that pressure is equal on both sides of the diaphragm, however the compressed spring supplies a net downward force. The spring is weak and is only able to close the inlet because water pressure is equalized on both sides of the diaphragm.Once the diaphragm closes the valve, the pressure on the outlet side of its bottom is reduced, and the greater pressure above holds it even more firmly closed. Thus, the spring is irrelevant to holding the valve closed.The above all works because the small drain passage D was blocked by a pin which is the armature of the solenoid E and which is pushed down by a spring. If current is passed through the solenoid, the pin is withdrawn via magnetic force, and the water in chamber C drains out the passage D faster than the pinhole can refill it. The pressure in chamber C drops and the incoming pressure lifts the diaphragm, thus opening the main valve. Water now flows directly from A to F.When the solenoid is again deactivated and the passage D is closed again, the spring needs very little force to push the diaphragm down again and the main valve closes. In practice there is often no separate spring; the elastomer diaphragm is molded so that it functions as its own spring, preferring to be in the closed shape.From this explanation it can be seen that this type of valve relies on a differential of pressure between input and output as the pressure at the input must always be greater than the pressure at the output for it to work. Should the pressure at the output, for any reason, rise above that of the input then the valve would open regardless of the state of the solenoid and pilot valve. Common components of a solenoid valve: Solenoid subassembly Retaining clip (a.k.a. coil clip) Solenoid coil (with magnetic return path) Core tube (a.k.a. armature tube, plunger tube, solenoid valve tube, sleeve, guide assembly) Plugnut (a.k.a. fixed core) Shading coil (a.k.a. shading ring) Core spring (a.k.a. counter spring) Core (a.k.a. plunger, armature) Core tubebonnet seal Bonnet (a.k.a. cover) Bonnetdiaphrambody seal Hanger spring Backup washer Diaphram Bleed hole Disk Valve body SeatThe core or plunger is the magnetic component that moves when the solenoid is energized. The core is coaxial with the solenoid. The core's movement will make or break the seals that control the movement of the fluid. When the coil is not energized, springs will hold the core in its normal position.The plugnut is also coaxial.The core tube contains and guides the core. It also retains the plugnut and may seal the fluid. To optimize the movement of the core, the core tube needs to be nonmagnetic. If the core tube were magnetic, then it would offer a shunt path for the field lines. In some designs, the core tube is an enclosed metal shell produced by deep drawing. Such a design simplifies the sealing problems because the fluid cannot escape from the enclosure, but the design also increases the magnetic path resistance because the magnetic path must traverse the thickness of the core tube twice: once near the plugnut and once near the core. In some other designs, the core tube is not closed but rather an open tube that slips over one end of the plugnut. To retain the plugnut, the tube might be crimped to the plugnut. An O-ring seal between the tube and the plugnut will prevent the fluid from escaping.The solenoid coil consists of many turns of copper wire that surround the core tube and induce the movement of the core. The coil is often encapsulated in epoxy. The coil also has an iron frame that provides a low magnetic path resistance.

1.3.11 LIQUID CRYSTAL DISPLAY (LCD):

A liquid crystal display (LCD) is a thin, flat panel used for electronically displaying information such as text, images, and moving pictures. Its uses include monitors for computers, televisions, instrument panels, and other devices ranging from aircraft cockpit displays, to every-day consumer devices such as video players, gaming devices, calculators, and telephones. Among its major features are its lightweight construction, its portability, and its ability to be produced in much larger screen sizes than are practical for the construction of cathode ray tube (CRT) display technology. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. It is an electronically-modulated optical device made up of any number of pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in colour or monochrome. The earliest discovery leading to the development of LCD technology, the discovery of liquid crystals, dates from 1888

PIN DESCRIPTION:

Table number.1 PIN description of LCDPIN DESCRIPTION: PIN SYMBOL I/O DESCRIPTION

1 VSS -- Ground

2 VCC -- +5V power supply

3 VEE -- Power supply to control contrast

4 RS I RS=0 to select command register RS=1 to select data register

5 R/W I R/W=0 for write R/W=1 for read

6 EN I/O Enable

7 DB0 I/O The 8-bit data bus

8 DB1 I/O The 8-bit data bus

9 DB2 I/O The 8-bit data bus

10 DB3 I/O The 8-bit data bus

11 DB4 I/O The 8-bit data bus

12 DB5 I/O The 8-bit data bus

13 DB6 I/O The 8-bit data bus

14 DB7 I/O The 8-bit data bus

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 important registers inside the LCD. When RS is low (0), the data is to be treated as a command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data that is sent is a text data which should be displayed on the screen. For example, to display the letter "T" on the screen you would set RS high.

RW (READ/WRITE): The RW line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are write commands, so RW will almost be low.EN (ENABLE): The EN line is called "Enable". This control line is used to tell the LCD that you are sending it data. To send data to the LCD, your program should first set this line high (1) and then set the other two control lines and/or put data on the data bus. When the other lines are completely ready, bring EN low (0) again. The 1-0 transition tells the 44780 to take the data currently found on the other control lines and on the data bus and to treat it as a command. D0-D7 (DATA LINES).The 8-bit data pins, D0-D7 are used to send information to the LCD or read the content 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 RS=1. There are also instruction command codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor. We also use RS=0 to check the busy flag bit to see if the LCD is ready to receive the 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 new information. When D7 = 0, the LCD is ready to receive new information.

Table -1.2.LCD Common CodesLCD COMMAND CODES: CODE (HEX) COMMAND TO LCD INSTRUCTION REGISTER

01 CLEAR DISPLAY SCREEN

02 RETURN HOME

04 DECREMENT CURSOR(SHIFT CURSOR TO LEFT)

06 INCREMENT CURSOR(SHIFT CURSOR TO RIGHT)

05 SHIFT DISPLAY RIGHT

07 SHIFT DISPLAY LEFT

08 DISPLAY OFF,CURSOR OFF

A DISPLAY OFF,CURSOR ON

C DISPLAY ON,CURSOR OFF

E DISPLAY ON CURSOR BLINKING

F DISPLAY ON CURSOR BLINKING

10 SHIFT CURSOR POSITION TO LEFT

14 SHIFT CURSOR POSITION TO RIGHT

ADVANTAGES:

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. The ability to display numbers, characters and graphics. This is in contrast to LEDs, which are limited to numbers and a few characters. An intelligent LCD displays two lines, 20 characters per line, which is interfaced to the 8051. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU to keep displaying the data. Ease of programming for characters and graphics.

1.3.12 KEIL SOFTWARE:

Many companies provide the 8051 assembler, some of them provide shareware version of their product on the Web, Kiel is one of them. We can download them from their Websites. However, the size of code for these shareware versions is limited and we have to consider which assembler is suitable for our application.

Keil Uvision2: This is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components: A project manager A make facility Tool configuration Editor A powerful debugger

To get start here are some several example programs

Building an Application in Uvision2: To build (compile, assemble, and link) an application in uVision2, we must: Select ProjectOpen Project

(For example, \C166\EXAMPLES\HELLO\HELLO.UV2) elect Project - Rebuild all target files or Build target. UVision2 compiles, assembles, and links the files in your project. To create a new project in uVision2, we must: Select Project - New Project. Select a directory and enter the name of the project file. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device Database Create source files to add to the project. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and add the source files to the project. Select Project - Options and set the tool options. Note when you select the target device from the Device Database all-special options are set automatically. You only need to configure the memory map of your target hardware. Default memory model settings are optimal for most. To debug an application created using uVision2, you must: Select Debug - Start/Stop Debug Session. Use the Step toolbar buttons to single-step through your program.

You may enter G, main in the Output Window to execute to the main C function. Open the Serial Window using the Serial #1 button on the toolbar. Debug your program using standard options like Step, Go, Break, and So on.

1.3.13 PROTEUS

Proteus is the embedded system simulation and developing platform developed by Britain Lab center Company, this software has the following characteristics:Can carry on the intellectual principle Butut; The ones that paid software debugging and one-chip computer and peripheral circuit of the one-chip computer, in coordination with emulation; Meet the standard of the one-chip computer software simulation system.Support common one-chip computer type and PHILIPS Co. ARM7 (series LPC) Processor and common peripheral device, like 8255, ADC0809.Can with 3 Keil Version, ADSl two integrated development environment combine, until and after the program compiling that language C write with collect, carry on the system simulation that the software and hardware combines.

CHAPTER-2

(OBJECTIVE AND PROBLEM FORMULATION)

2.1 Objective

The objective of the project is to dispense Liquids such as water ,Tea, Coffee, Cold drinks and different types of Juices automatically, after the customer presses the button according to his/her need.

2.2 Design & architecture:

2.2.1 Steps for making PCB:

Prepare the layout of the circuit (positive).

Cut the photo film (slightly bigger) of the size of the layout.

Place the layout in the photo printer machine with the photo film above it. Make sure that the bromide (dark) side of the film is in contact with the layout.

Switch on the machine by pressing the push button for 5 sec.

Dip the film in the solution prepared (developer) by mixing the chemicals A & B in equal quantities in water.

Now clean the film by placing it in the tray containing water for 1 min.

After this, dip the film in the fixer solution for 1 min. now the negative of the Circuit is ready.

Now wash it under the flowing water.

Dry the negative in the photocurrent machine.

Take the PCB board of the size of the layout and clean it with steel wool to make the surface smooth.

Now dip the PCB in the liquid photoresist, with the help of dip coat machine.

Now clip the PCB next to the negative in the photo cure machine, drying for approximate 10-12 minute. Now place the negative on the top of the PCB in the UV machine, set the timer for about 2.5 minute and switch on the UV light at the top.

Take the LPR developer in a container and rigorously move the PCB in it.

After this, wash it with water very gently.

Then apply LPR dye on it with the help of a dropper so that it is completely covered by it.

Now clamp the PCB in the etching machine that contains ferric chloride solution for about 10 minutes.

After etching, wash the PCB with water, wipe it a dry cloth softly.

Finally rub the PCB with a steel wool, and the PCB is ready.

2.2.2 PCB Layout:

Figure-2.1. PCB LayoutCHAPTER-3

(METHODOLOGY AND PLANNING OF WORK)

3.1. Circuit description

The circuit diagram consists of the following sections:I. Power supply unitII. Microcontroller unitIII. Relay sectionIV. LCD display section

3.1.1 Power supply unit

The power supply unit consists of the following subunits:

A transformer of 9-0-9V rating. It provides a 18 volt supply to the RLMT 03(M) connector. The connector is followed by a bridge rectifier to produce a pulsating DC. This rectifier if followed by a filter to smooth out the ripples present in the voltage. A fixed positive voltage regulator IC LM7805H follows the filter. It outputs +5 volt DC supply to two parallel capacitors.

The first capacitor acts as a low pass filter to remove low frequency ripples and the second capacitor acts as a high pass filter to remove high frequency spikes from the incoming signal. Thus, this section supplies a +5 volt DC supply to the entire circuit, wherever required.

3.1.2 Microcontroller unit

We are using AT89C51 microcontroller, which has been programmed in Assembly Language for controlling power supply voltage, machine temperature & fluid level. Pin 1 is Master Clear (MCLR); it is reset at 5V input. Vcc is delayed at the microcontroller input by the time constant provided by R-C network at this pin. RA0 to RA3 inputs are connected to pins 2 to 5, respectively. Pins 9 and 10 are reserved for a crystal oscillator of 4 MHz frequency. This crystal oscillator provides the clock pulses to the microcontroller. Pins 12 and 13 receive inputs from RC1 and RC2, respectively. The three transistors operating the relays are base connected at pins 14 to 16. Pin 17 is meant for reset (RS) while pin 18 is reserved for enable (EN) input. Pins 21 to 28 provide data and command signals to the LCD display unit.3.1.3 Relay section

A relay is an electrical switch that opens & closes under the control of another electrical circuit. In the original form, the switch is operated by an electromagnetic to open or close one or many sets of contacts. A relay will switch one or more poles, each of whose contacts can be thrown by energizing the coil in one of three ways: Normally-open (NO) contacts connect the circuit when the relay is activated; the circuit is disconnected when the relay is inactive. It is also called a Form A contact or "make" contact. Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the circuit is connected when the relay is inactive. It is also called a Form B contact or a "break" contact.

Change-over, or double-throw, contacts control two circuits: one normally-open contact and one normally-closed contact with a common terminal. It is also called a Form C contact or "transfer" contact. If this type of contact utilizes a "make before break functionality, then it is called a Form D contact. We employ three Common-Emitter npn transistors. The transistors form a connection with three relays and the motor (fan) at their collector terminals. When both the voltage and temperature conditions are optimum in the controlled device, a current flows through the relays.

3.1.4 LCD display section

A 16-pin 2x16 LCD display, RLMT 16(M) is used to display four parameters, namely, Operating voltage, cut-set voltage, Operating temperature, cut-set temperature. Pins 1, 5 and 16 are permanently grounded while pins 2 and 5 are at +5V potential. Pin 4 receives the EN input and pin 6 has RS as its input. Pins 7 to 14 receive inputs from port B (D0 to D7) of the microcontroller in the form of data and command signals. If the RS input is low, then D0 to D7 signals are treated as command signals. If the RS input is high, these are treated as data signals.

Figure- 3.1 circuit diagram

CHAPTER-4

(CONCLUSION & FUTURE SCOPE)

4.1 ADVANTAGE

Drinks of all kinds can now be dispensed through this technology making the world a more convenient place in terms of item purchasing. Vending machines give the clients a free choice to purchase products at any time of the day. One can shop for his or her intended product on a 24 hour, throughout the year. Most vending machines are stationed at strategic points which make it convenient and time saving because of the surety of getting what you want.

4.2 APPLICATIONCoffee Machine:The range of desire cafe trio we manufacture is one of the most popular coffee vending machine amongst clients. We have successfully installed these machines in cafeterias, canteens, government and private organizations.Mini Single Selection Machine

Feather Touch with Digital Display/LCD Features: Coffee Tea Hot WaterMulti Selection Machine

We offer multi selection (four selection) vending machines to our customers. These machines come with four different types of vending options.

Instant Machine

We offer desire cafe trio machine, a type of instant coffee machine that has got a high demand in the global markets. These machines are capable of making delicious and hot coffee within few seconds. Our machine also comes with digital displays that help the user to work with an ease.

Digital coffee machineWe offer a range of desire cafe digital coffee machines, which are used in corporate houses as well as industrial units. These machines have digital and highly friendly operation process that helps the users to handle the machine easily. We make sure that the range of automatic vending machine is made by using quality raw material such as plastic, mild steel and more.

Hot Beverage Machines

We have been offering a wide range of four selection hot beverage vending machines which is used for vending any four beverages from a choice of blends and flavour at a single time. These hot beverage vending machines are perfect for commercial establishments and offices and are customized as per the specifications of our clients.

4.3 Conclusion

Vending machines have come a long way since the first holy water dispensing machine. They now offer a variety of products as well as many different types of payment options. Vending machines are accessible, affordable and convenient to use. With the many advantages vending machines bring, it definitely compensates for any disadvantages. They have been here for a long time, and will certainly advance for many years to come.

4.4 Future scope

We are engaged in offering a range of automatic beverage machines that includes beverage machine, mini single selection beverage machine, multi selection machine, coffee machine, digital bubble top coffee machine etc.Coffee Machine:The range of desire cafe trio we manufacture is one of the most popular coffee vending machine amongst clients. We have successfully installed these machines in cafeterias, canteens, government and private organizations.

Feather Touch with Digital Display/LCD Features: Coffee Tea Hot WaterMulti Selection Machine

We offer multi selection (four selection) vending machines to our customers. These machines come with four different types of vending options.

Instant Machine

We offer desire cafe trio machine, a type of instant coffee machine that has got a high demand in the global markets. These machines are capable of making delicious and hot coffee within few seconds. Our machine also comes with digital displays that help the user to work with an ease.

Digital coffee machine

We offer a range of desire cafe digital coffee machines, which are used in corporate houses as well as industrial units. These machines have digital and highly friendly operation process that helps the users to handle the machine easily. We make sure that the range of automatic vending machine is made by using quality raw material such as plastic, mild steel and more.

Hot Beverage Machines

We have been offering a wide range of four selection hot beverage vending machines which is used for vending any four beverages from a choice of blends and flavour at a single time. These hot beverage vending machines are perfect for commercial establishments and offices and are customized as per the specifications of our clients.

REFERENECE

[1] Jogesh K. Muppala, HKUST COMP355 Embedded System Software Lecture Notes and Course Materials, http://www.cs.ust.hk/%7Emuppala/comp355/[2] David E. Simon, An Embedded Software Primer, Addison-Wesley, 1999. [3] Raj Kamal, Embedded Systems: Architecture, Programming and Design, McGraw-Hill, 2003. [4] Dreamtech Software Team, Programming for Embedded Systems: Cracking the Code, Wiley, 2002. [5] Atmel Corporation: Manuals of AT89S52 chip [6] Tim K. T. WOO, HKUST ELEC 254 Course Materials,http://course.ee.ust.hk/elec254/[7] Keil Software Corporation: Users Guide of Cx51Compiler,

APPENDIX

CODING FOR BEVERAGE VENDING MACHINE

// Program to make a beverage vending machine#include#includevoid delay(void);sbitback=P3^0;sbitRS=P3^1;sbitRW=P3^2;sbitE=P3^3;void lcd_cw();void lcd_dw();void lcd_x();void lcd_y();void lcd_z();void delay(unsigned int);unsigned char ch,ds1;void display(unsigned char,unsigned char);sbit first = P2^0; // First switch for Xsbit second = P2^1; // Second switch for Ysbit third = P2^2; // third switch for Zsbit coffee = P1^0;//pin for output of Xsbit tea = P1^1; //pin for output of Ysbit sprite = P1^2; //pin for output of Z

void main() // main body {{ ch=0x38;lcd_cw();delay(100);ch=0x0e;lcd_cw();delay(100);

ch=0x01;lcd_cw();delay(1); ch=0x06;lcd_cw();delay(1);ch=0x84;lcd_cw();delay(100);

ch='Y';lcd_dw();delay(100); ch=0x01;lcd_cw();delay(1);

ch='E';lcd_dw();delay(100);

ch=0x01;lcd_cw();delay(1);

ch='A';lcd_dw();delay(100);

ch=0x01;lcd_cw();delay(1);

ch='R';lcd_dw();delay(100);

ch=0x01;lcd_cw();delay(1);

ch=' ';lcd_dw();delay(1000);

ch=0x01;lcd_cw();delay(1);ch='2';lcd_dw();delay(1000);

ch=0x01;lcd_cw();delay(1);ch='0';lcd_dw();delay(1000);

ch=0x01;lcd_cw();delay(1);ch='1';lcd_dw();delay(1000);

ch=0x01;lcd_cw();delay(1);ch='4';lcd_dw();delay(1000);

}again:P1=0x00; // initialise the port 1 if(first==0) // scanning the first switch{ lcd_x();X = 1; delay(); // delay callX = 0;goto next1;

}

next1: // next subroutine if(second==0) // scanning of second switch { Lcd_y(); Y = 1; delay(); Y = 0; goto next2; } next2: if(third==0) { Lcd_z(); Z = 1; delay(); Z = 0; goto again;

} }

//---------------------------------------- //----------------------------------------

void delay() // delay subrutine{ int i,j; for(i=0;i