Você está na página 1de 80

Project Report Wireless remote control switch

Circuit diagram

Component list

Component placement

Pcb layout

Program

#include<reg51.h>

void delay(int time) { int i,j; for(i=0;i<time;i++) for(j=0;j<1275;j++); } MOV P0,#00H MOV P1,#0FFH XXX: JNB P1.0,XXX1 CPL P0.0 XX: JB P1.0,XX XXX1:

//This function produces a delay in msec.

JNB P1.1,XXX

CPL P0.1 XX1: JB P1.1,XX1 JMP XXX void main() { while(1)

{ P0=0x00; delay(50); P0=0xff; delay(50); } }

Component description Resistor

A Typical Resistor

Resistors are "Passive Devices", that is they contain no source of power or amplification but only attenuate or reduce the voltage or current signal passing through them. This attenuation results in electrical energy being lost in the form of heat as the resistor resists the flow of electrons through it. Then a potential difference is required between the two terminals of a resistor for current to flow. This potential difference balances out the energy lost. When used in DC circuits the potential difference, also known as a resistors voltage drop, is measured across the terminals as the circuit current flows through the resistor. Most resistors are linear devices that produce a voltage drop across themselves when an electrical current flows through them because they obey Ohm's Law, and different values of resistance produces different values of current or voltage. This can be very useful in Electronic circuits by controlling or reducing either the current flow or voltage produced across them. There are many thousands of different Types of Resistors and are produced in a variety of forms because their particular characteristics and accuracy suit certain areas of application, such as High Stability, High Voltage, High Current etc, or are used as general purpose resistors where their characteristics are less of a problem. Some of the common characteristics associated with the humble resistor are; Temperature Coefficient, Voltage Coefficient, Noise, Frequency Response, Power as well as Temperature Rating, Physical Size and Reliability. In all Electrical and Electronic circuit diagrams and schematics, the most commonly used symbol for a fixed value resistor is that of a "zig-zag" type line with the value of its resistance given in Ohms, . Resistors have fixed resistance values from less than one ohm, ( <1 ) to well over tens of millions of ohms, ( >10M ) in value. Fixed resistors have only one single value of resistance, for example 100'sbut variable resistors (potentiometers) can provide an infinite number of resistance values between zero and their maximum value. Standard Resistor Symbols

The symbol used in schematic and electrical drawings for a Resistor can either be a "zig-zag" type line or a rectangular box.

All modern fixed value resistors can be classified into four broad groups;

Carbon Composition Resistor - Made of carbon dust or graphite paste, low wattage values Film or Cermet Resistor - Made from conductive metal oxide paste, very low wattage values Wire-wound Resistor - Metallic bodies for heatsink mounting, very high wattage ratings Semiconductor Resistor - High frequency/precision surface mount thin film technology There are a large variety of fixed and variable resistor types with different construction styles available for each group, with each one having its own particular characteristics, advantages and disadvantages compared to the others. To include all types would make this section very large so I shall limit it to the most commonly used, and readily available general purpose types of resistors.

Resistor Colour Code


We saw in the previous tutorial that there are many different types of Resistors available and that they can be used in both electrical and electronic circuits to control the flow of current or voltage in many different ways. But in order to do this the actual resistor needs to have some form of "resistive" or "resistance" value. Resistors are available in a range of different resistance values from fractions of an Ohm ( ) to millions of Ohms. Obviously, it would be impractical to have available resistors of every possible value for example, 1,2, 3, 4 etc, because literally hundreds of thousands, if not millions of different resistors would need to exist to cover all the possible values. Instead, resistors are manufactured in what are called "preferred values" with their resistance value printed onto their body in coloured ink.

4 Coloured Bands

The resistance value, tolerance, and wattage rating are generally printed onto the body of the resistor as numbers or letters when the resistors body is big enough to read the print, such as large power resistors. But when the resistor is small such as a 1/4W carbon or film type, these specifications must be shown in some other manner as the print would be too small to read. So to overcome this, small resistors use coloured painted bands to indicate both their resistive value and their tolerance with the physical size of the resistor indicating its wattage rating. These coloured painted bands produce a system of identification generally known as a Resistors Colour Code. An international and universally accepted resistor colour coding scheme was developed many years ago as a simple and quick way of identifying a resistors ohmic value no matter what its size or condition. It consists of a set of individual coloured rings or bands in spectral order representing each digit of the resistors value. A resistors colour code markings are always read one band at a time starting from the left to the right, with the larger width tolerance band oriented to the right side indicating its tolerance. By matching the colour of the first band with its associated number in the digit column of the colour chart below the first digit is identified and this represents the first digit of the resistance value. Again, by matching the colour of the second band with its associated number in the digit column of the colour chart we get the second digit of the resistance value and so on as illustrated below:

The Standard Resistor Colour Code Chart.

The Resistor Colour Code Table.


Colour
Black Brown Red Orange Yellow Green Blue Violet Grey White Gold Silver None

Digit 0 1 2 3 4 5 6 7 8 9

Multiplier 1 10 100 1,000 10,000 100,000 1,000,000 10,000,000

Tolerance

1% 2%

0.5% 0.25% 0.1%

0.1 0.01

5% 10% 20%

Calculating Resistor Values


The Resistor Colour Code system is all well and good but we need to understand how to apply it in order to get the correct value of the resistor. The "left-hand" or the most significant coloured band is the band which is nearest to a connecting lead with the colour coded bands being read from left-to-right as follows; Digit, Digit, Multiplier = Colour, Colour x 10 colour in Ohm's ('s) For example, a resistor has the following coloured markings; Yellow Violet Red = 4 7 2 = 4 7 x 102 = 4700 or 4k7.

The fourth and fifth bands are used to determine the percentage tolerance of the resistor. Resistor tolerance is a measure of the resistors variation from the specified resistive value and is a consequence of the manufacturing process and is expressed as a percentage of its "nominal" or preferred value. Typical resistor tolerances for film resistors range from 1% to 10% while carbon resistors have tolerances up to 20%. Resistors with tolerances lower than 2% are called precision resistors with the or lower tolerance resistors being more expensive. Most five band resistors are precision resistors with tolerances of either 1% or 2% while most of the four band resistors have tolerances of 5%, 10% and 20%. The colour code used to denote the tolerance rating of a resistor is given as; Brown = 1%, Red = 2%, Gold = 5%, Silver = 10 % If resistor has no fourth tolerance band then the default tolerance would be at 20%.

Capacitor
Just like the Resistor, the Capacitor, sometimes referred to as a Condenser, is a simple passive device. The capacitor is a component which has the ability or "capacity" to store energy in the form of an electrical charge producing a potential difference (Static Voltage) across its plates, much like a small rechargable battery. In its basic form, a capacitor consists of two or more parallel conductive (metal) plates which are not connected or touching each other, but are electrically separated either by air or by some form of insulating material such as paper, mica, ceramic or plastic and which is commonly called the capacitors Dielectric.

A Typical Capacitor The conductive metal plates of a capacitor can be either square, circular or rectangular, or they can be of a cylindrical or spherical shape with the general shape, size and construction of a parallel plate capacitor depending on its application and voltage rating.

When used in a direct current or DC circuit, a capacitor charges up to its supply voltage but blocks the flow of current through it because the dielectric of a capacitor is non-conductive and basically an insulator. However, when a capacitor is connected to an alternating current or AC circuit, the flow of the current appears to pass straight through the capacitor with little or no resistance. If a DC voltage is applied to the capacitors conductive plates, a current is unable to flow through the capacitor itself due to the dielectric insulation and an electrical charge builds up on the capacitors plates with electrons producing a positive charge on one and an equal and opposite negative charge on the other plate. This flow of electrons to the plates is known as the capacitors Charging Current which continues to flow until the voltage across both plates (and hence the capacitor) is equal to the applied voltage Vc. At this point the capacitor is said to be "fully charged" with electrons. The strength or rate of this charging current is at its maximum value when the plates are fully discharged (initial condition) and slowly reduces in value to zero as the plates charge up to a potential difference across the capacitors plates equal to the applied supply voltage and this is illustrated below.

Capacitor Construction

The parallel plate capacitor is the simplest form of capacitor. It can be constructed using two metal or metallised foil plates at a distance parallel to each other, with its capacitance value in Farads, being fixed by the surface area of the conductive plates and the distance of separation between them. Altering any two of these

values alters the the value of its capacitance and this forms the basis of operation of the variable capacitors. Also, because capacitors store the energy of the electrons in the form of an electrical charge on the plates the larger the plates and/or smaller their separation the greater will be the charge that the capacitor holds for any given voltage across its plates. In other words, larger plates, smaller distance, more capacitance. By applying a voltage to a capacitor and measuring the charge on the plates, the ratio of the charge Q to the voltage V will give the capacitance value of the capacitor and is therefore given as: C = Q/V this equation can also be re-arranged to give the more familiar formula for the quantity of charge on the plates as: Q = C xV Although we have said that the charge is stored on the plates of a capacitor, it is more correct to say that the energy within the charge is stored in an "electrostatic field" between the two plates. When an electric current flows into the capacitor, charging it up, the electrostatic field becomes more stronger as it stores more energy. Likewise, as the current flows out of the capacitor, discharging it, the potential difference between the two plates decreases and the electrostatic field decreases as the energy moves out of the plates. The property of a capacitor to store charge on its plates in the form of an electrostatic field is called the Capacitance of the capacitor. Not only that, but capacitance is also the property of a capacitor which resists the change of voltage across it.

The Capacitance of a Capacitor


The unit of capacitance is the Farad (abbreviated to F) named after the British physicist Michael Faraday and is defined as a capacitor has the capacitance of One Farad when a charge of One Coulomb is stored on the plates by a voltage of One volt. Capacitance, C is always positive and has no negative units. However, the Farad is a very large unit of measurement to use on its own so sub-multiples of the Farad are generally used such as micro-farads, nano-farads and pico-farads, for example.

Units of Capacitance

Microfarad (F) 1F = 1/1,000,000 = 0.000001 = 10-6 F Nanofarad (nF) 1nF = 1/1,000,000,000 = 0.000000001 = 10-9 F Picofarad (pF) 1pF = 1/1,000,000,000,000 = 0.000000000001 = 10-12 F The capacitance of a parallel plate capacitor is proportional to the area, A of the plates and inversely proportional to their distance or separation, d (i.e. the dielectric thickness) giving us a value for capacitance of C = k( A/d ) where in a vacuum the value of the constant k is 8.84 x 10-12 F/m or 1/4..9 x 109, which is the permittivity of free space. Generally, the conductive plates of a capacitor are separated by air or some kind of insulating material or gel rather than the vacuum of free space.

Types of Capacitor
Ceramic Capacitors Ceramic Capacitors or Disc Capacitors as they are generally called, are made by coating two sides of a small porcelain or ceramic disc with silver and are then stacked together to make a capacitor. For very low capacitance values a single ceramic disc of about 3-6mm is used. Ceramic capacitors have a high dielectric constant (High-K) and are available so that relatively high capacitances can be obtained in a small physical size.

Ceramic Capacitor

They exhibit large non-linear changes in capacitance against temperature and as a result are used as de-coupling or by-pass capacitors as they are also non-polarized devices. Ceramic capacitors have values ranging from a few picofarads to one or two microfarads but their voltage ratings are generally quite low. Ceramic types of capacitors generally have a 3-digit code printed onto their body to identify their capacitance value in pico-farads. Generally the first two digits indicate the capacitors value and the third digit indicates the number of zero's to be added. For example, a ceramic disc capacitor with the markings 103 would indicate 10 and 3 zero's in pico-farads which is equivalent to 10,000 pF or10nF. Likewise, the digits 104 would indicate 10 and 4 zero's in pico-farads which is equivalent to 100,000 pFor 100nF and so on. Then on the image of a ceramic capacitor above the numbers 154 indicate 15 and 4 zero's in pico-farads which is equivalent to 150,000 pF or 150nF. Letter codes are sometimes used to indicate their tolerance value such as: J = 5%, K = 10% or M = 20% etc.

Electrolytic Capacitors
Electrolytic Capacitors are generally used when very large capacitance values are required. Here instead of using a very thin metallic film layer for one of the electrodes, a semi-liquid electrolyte solution in the form of a jelly or paste is used which serves as the second electrode (usually the cathode). The dielectric is a very thin layer of oxide which is grown electro-chemically in production with the thickness of the film being less than ten microns. This insulating layer is so thin that it is possible to make capacitors with a large value of capacitance for a small physical size as the distance between the plates, d is very small.

Electrolytic Capacitor

The majority of electrolytic types of capacitors are Polarised, that is the DC voltage applied to the capacitor terminals must be of the correct polarity, i.e. positive to the positive terminal and negative to the negative terminal as an incorrect polarisation will break down the insulating oxide layer and permanent damage may result. All polarised electrolytic capacitors have their polarity clearly marked with a negative sign to indicate the negative terminal and this polarity must be followed. Electrolytic Capacitors are generally used in DC power supply circuits due to their large capacitances and small size to help reduce the ripple voltage or for coupling and decoupling applications. One main disadvantage of electrolytic capacitors is their relatively low voltage rating and due to the polarisation of electrolytic capacitors, it follows then that they must not be used on AC supplies. Electrolytic's generally come in two basic forms; Aluminum Electrolytic Capacitors and Tantalum Electrolytic Capacitors.
Electrolytic Capacitor

Aluminium Electrolytic Capacitors There are basically two types of Aluminium Electrolytic Capacitor, the plain foil type and the etched foil type. The thickness of the aluminium oxide film and high breakdown voltage give these capacitors very high capacitance values for their size. The foil plates of the capacitor are anodized with a DC current. This anodizing process sets up the polarity of the plate material and determines which side of the plate is positive and which side is negative. The etched foil type differs from the plain foil type in that the aluminium oxide on the anode and cathode foils has been chemically etched to increase its surface area and permittivity. This gives a smaller sized capacitor than a plain foil type of equivalent value but has the disadvantage of not being able to withstand high DC currents compared to the plain type. Also their tolerance range is quite large at up to 20%. Typical values of capacitance for an aluminium electrolytic capacitor range from 1uF up to 47,000uF. Etched foil electrolytic's are best used in coupling, DC blocking and by-pass circuits while plain foil types are better suited as smoothing capacitors in power supplies. But aluminium electrolytic's are "polarised" devices so reversing the applied voltage on the leads will cause the insulating layer within the capacitor to become destroyed along with the capacitor. However, the electrolyte used within the capacitor helps heal a damaged plate if the damage is small. Since the electrolyte has the properties to self-heal a damaged plate, it also has the ability to re-anodize the foil plate. As the anodizing process can be reversed, the electrolyte has the ability to remove the oxide coating from the foil as would happen if the capacitor was connected with a reverse polarity. Since the electrolyte has the ability to conduct electricity, if the aluminum oxide layer was removed or destroyed, the capacitor would allow current to pass from one plate to the other destroying the capacitor, "so be aware".

Capacitor Characteristics
There are a bewildering array of capacitor characteristics and specifications associated with the humble capacitor and reading the information printed onto the

body of a capacitor can sometimes be difficult especially when colours or numeric codes are used. Each family or type of capacitor uses its own unique identification system with some systems being easy to understand, and others that use misleading letters, colours or symbols. The best way to figure out what a capacitor label means is to first figure out what type of family the capacitor belongs to whether it is ceramic, film, plastic or electrolytic. Even though two capacitors may have exactly the same capacitance value, they may have different voltage ratings. If a smaller rated voltage capacitor is substituted in place of a higher rated voltage capacitor, the increased voltage may damage the smaller capacitor. Also we remember from the last tutorial that with a polarised electrolytic capacitor, the positive lead must go to the positive connection and the negative lead to the negative connection otherwise it may again become damaged. So it is always better to substitute an old or damaged capacitor with the same type as the specified one. An example of capacitor markings is given below. Capacitor Characteristics

The capacitor, as with any other electronic component, comes defined by a series of characteristics. These Capacitor Characteristics can always be found in the datasheets that the capacitor manufacturer provides to us so here are just a few of the more important ones. 1. Nominal Capacitance, (C) The nominal value of the Capacitance, C of a capacitor is measured in picoFarads (pF), nano-Farads (nF) or micro-Farads (F) and is marked onto the body of the capacitor as numbers, letters or coloured bands. The capacitance of a

capacitor can change value with the circuit frequency (Hz) y with the ambient temperature. Smaller ceramic capacitors can have a nominal value as low as one pico-Farad, ( 1pF ) while larger electrolytic's can have a nominal capacitance value of up to one Farad, ( 1F ). All capacitors have a tolerance rating that can range from -20% to as high as +80% for aluminium electrolytic's affecting its actual or real value. The choice of capacitance is determined by the circuit configuration but the value read on the side of a capacitor may not necessarily be its actual value. 2. Working Voltage, (WV) The Working Voltage is the maximum continuous voltage either DC or AC that can be applied to the capacitor without failure during its working life. Generally, the working voltage printed onto the side of a capacitors body refers to its DC working voltage, ( WV-DC ). DC and AC voltage values are usually not the same for a capacitor as the AC voltage value refers to the r.m.s. value and NOT the maximum or peak value which is 1.414 times greater. Also, the specified DC working voltage is valid within a certain temperature range, normally - 30C to + 70C. Any DC voltage in excess of its working voltage or an excessive AC ripple current may cause failure. It follows therefore, that a capacitor will have a longer working life if operated in a cool environment and within its rated voltage. Common working DC voltages are 10V, 16V, 25V, 35V, 50V, 63V, 100V, 160V, 250V, 400V and 1000V and are printed onto the body of the capacitor. 3. Tolerance, (%) As with resistors, capacitors also have a Tolerance rating expressed as a plus-orminus value either in picofarad's (pF) for low value capacitors generally less than 100pF or as a percentage (%) for higher value capacitors generally higher than 100pF. The tolerance value is the extent to which the actual capacitance is allowed to vary from its nominal value and can range anywhere from -20% to +80%. Thus a 100F capacitor with a 20% tolerance could legitimately vary from 80F to 120F and still remain within tolerance.

Capacitors are rated according to how near to their actual values they are compared to the rated nominal capacitance with coloured bands or letters used to indicated their actual tolerance. The most common tolerance variation for capacitors is 5% or 10% but some plastic capacitors are rated as low as 1%.
4. Leakage Current

The dielectric used inside the capacitor to separate the conductive plates is not a perfect insulator resulting in a very small current flowing or "leaking" through the dielectric due to the influence of the powerful electric fields built up by the charge on the plates when applied to a constant supply voltage. This small DC current flow in the region of nano-amps (nA) is called the capacitors Leakage Current. Leakage current is a result of electrons physically making their way through the dielectric medium, around its edges or across its leads and which will over time fully discharging the capacitor if the supply voltage is removed. When the leakage is very low such as in film or foil type capacitors it is generally referred to as "insulation resistance" ( Rp ) and can be expressed as a high value resistance in parallel with the capacitor as shown. When the leakage current is high as in electrolytic's it is referred to as a "leakage current" as electrons flow directly through the electrolyte. Capacitor leakage current is an important parameter in amplifier coupling circuits or in power supply circuits, with the best choices for coupling and/or storage applications being Teflon and the other plastic capacitor types (polypropylene, polystyrene, etc) because the lower the dielectric constant, the higher the insulation resistance. Electrolytic-type capacitors (tantalum and aluminum) on the other hand may have very high capacitances, but they also have very high leakage currents (typically of the order of about 5-20 A per F) due to their poor isolation resistance, and are therefore not suited for storage or coupling applications. Also, the flow of leakage current for aluminium electrolytic's increases with temperature. 5. Working Temperature, (T)

Changes in temperature around the capacitor affect the value of the capacitance because of changes in the dielectric properties. If the air or surrounding temperature becomes to hot or to cold the capacitance value of the capacitor may change so much as to affect the correct operation of the circuit. The normal working range for most capacitors is -30C to +125C with nominal voltage ratings given for a Working Temperature of no more than +70C especially for the plastic capacitor types. Generally for electrolytic capacitors and especially aluminium electrolytic capacitor, at high temperatures (over +85C the liquids within the electrolyte can be lost to evaporation, and the body of the capacitor (especially the small sizes) may become deformed due to the internal pressure and leak outright. Also, electrolytic capacitors can not be used at low temperatures, below about -10C, as the electrolyte jelly freezes. 6. Temperature Coefficient, (TC) The Temperature Coefficient of a capacitor is the maximum change in its capacitance over a specified temperature range. The temperature coefficient of a capacitor is generally expressed linearly as parts per million per degree centigrade (PPM/C), or as a percent change over a particular range of temperatures. Some capacitors are non linear (Class 2 capacitors) and increase their value as the temperature rises giving them a temperature coefficient that is expressed as a positive "P". Some capacitors decrease their value as the temperature rises giving them a temperature coefficient that is expressed as a negative "N". For example "P100" is +100 ppm/C or "N200", which is -200 ppm/C etc. However, some capacitors do not change their value and remain constant over a certain temperature range, such capacitors have a zero temperature coefficient or "NPO". These types of capacitors such as Mica or Polyester are generally referred to as Class 1 capacitors. Most capacitors, especially electrolytic's lose their capacitance when they get hot but temperature compensating capacitors are available in the range of at least P1000 through to N5000 (+1000 ppm/C through to -5000 ppm/C). It is also possible to connect a capacitor with a positive temperature coefficient in series or

parallel with a capacitor having a negative temperature coefficient the net result being that the two opposite effects will cancel each other out over a certain range of temperatures. Another useful application of temperature coefficient capacitors is to use them to cancel out the effect of temperature on other components within a circuit, such as inductors or resistors etc. 7. Polarization Capacitor Polarization generally refers to the electrolytic type capacitors but mainly the Aluminium Electrolytic's, with regards to their electrical connection. The majority of electrolytic capacitors are polarized types, that is the voltage connected to the capacitor terminals must have the correct polarity, i.e. positive to positive and negative to negative. Incorrect polarization can cause the oxide layer inside the capacitor to break down resulting in very large currents flowing through the device resulting in destruction as we have mentioned earlier. The majority of electrolytic capacitors have their negative, -ve terminal clearly marked with either a black stripe, band, arrows or chevrons down one side of their body as shown, to prevent any incorrect connection to the DC supply. Some larger electrolytic's have their metal can or body connected to the negative terminal but high voltage types have their metal can insulated with the electrodes being brought out to separate spade or screw terminals for safety. Also, when using aluminium electrolytic's in power supply smoothing circuits care should be taken to prevent the sum of the peak DC voltage and AC ripple voltage from becoming a "reverse voltage".

The Farad
We now know that the ability of a capacitor to store a charge gives it its capacitance value C, which has the unit of the Farad, F. But the farad is an

extremely large unit on its own making it impractical to use, so submultiple's or fractions of the standard Farad unit are used instead. To get an idea of how big a Farad really is, the surface area of the plates required producing a capacitor with a value of one Farad with a reasonable plate separation of just 1mm operating in a vacuum and rearranging the equation for capacitance above would be: A = Cd 8.85pF/m = (1 x 0.001) 8.85x10-12 = 112,994,350 m2 or 113 million m2 which would be equivalent to a plate of more than 10 kilometres x 10 kilometres square. Capacitors which have a value of one Farad or more tend to have a solid dielectric and as "One Farad" is such a large unit to use, prefixes are used instead in electronic formulas with capacitor values given in micro-Farads (F), nano-Farads (nF) and the pico-Farads (pF). For example: Sub-units of the Farad

Convert the following capacitance values from a) 22nF to uF, b) 0.2uF to nF, c) 550pF to uF. a) 22nF = 0.022Uf b) 0.2uF = 200nF

c) 550pF = 0.00055uF Capacitor Letter Codes Table


Picofarad Nanofarad Microfarad Picofarad Nanofarad Microfarad Code Code (pF) (nF) (uF) (pF) (nF) (uF) 10 0.01 0.00001 100 4700 4.7 0.0047 472 15 0.015 0.000015 150 5000 5.0 0.005 502 22 0.022 0.000022 220 5600 5.6 0.0056 562 33 0.033 0.000033 330 6800 6.8 0.0068 682 47 0.047 0.000047 470 10000 10 0.01 103 100 0.1 0.0001 101 15000 15 0.015 153 120 0.12 0.00012 121 22000 22 0.022 223 130 0.13 0.00013 131 33000 33 0.033 333 150 0.15 0.00015 151 47000 47 0.047 473 180 0.18 0.00018 181 68000 68 0.068 683 220 0.22 0.00022 221 100000 100 0.1 104 330 0.33 0.00033 331 150000 150 0.15 154 470 0.47 0.00047 471 200000 200 0.2 254 560 0.56 0.00056 561 220000 220 0.22 224 680 0.68 0.00068 681 330000 330 0.33 334 750 0.75 0.00075 751 470000 470 0.47 474 820 0.82 0.00082 821 680000 680 0.68 684 1000 1.0 0.001 102 1000000 1000 1.0 105 1500 1.5 0.0015 152 1500000 1500 1.5 155 2000 2.0 0.002 202 2000000 2000 2.0 205 2200 2.2 0.0022 222 2200000 2200 2.2 225 3300 3.3 0.0033 332 3300000 3300 3.3 335

Crystal oscillator

A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits incorporating them became known as crystal oscillators,[1] but other piezoelectric materials including polycrystalline ceramics are used in similar circuits. Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion crystals are manufactured annually. Most are used for consumer devices such as wristwatches, clocks, radios, computers, and cellphones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.

Ic base

Using an IC base saves the IC from burning due to overheat if IC is soldered directly. Also, changing an IC becomes very easy if the IC gets damaged due to some reason and once the IC- base is soldered, the IC can be easily taken out and fitted back n number of times. Before soldering the IC-Base it should be checked that all the pins have successfully pierced the holes of the PCB and appeared on back side because sometimes the some pins are not able to pierce and get damaged in the process. The IC-Base should be carefully installed upright according to circuit, but if it gets soldered oppositely by mistake then there is no need to de-solder the IC-Base, rather the IC should be fitted in the base keeping in mind the orientation of the circuit.

Diode

A diode is a semiconductor device which allows current to flow through it in only one direction. Although a transistor is also a semiconductor device, it does not operate the way a diode does. A diode is specifically made to allow current to flow through it in only one direction. Some ways in which the diode can be used are listed here. A diode can be used as a rectifier that converts AC (Alternating Current) to DC (Direct Current) for a power supply device.. What is a Diode and how to work? A diode is the simplest sort of semiconductor device. Broadly speaking, a semiconductor is a material with a varying ability to conduct electrical current. Most semiconductors are made of a poor conductor that has had impurities (atoms of another material) added to it. The process of adding impurities is called doping. In the case of LEDs, the conductor material is typically aluminum-gallium-arsenide (AlGaAs). In pure aluminum-gallium-arsenide, all of the atoms bond perfectly to their neighbors, leaving no free electrons (negatively-charged particles) to conduct electric current. In doped material, additional atoms change the balance, either adding free electrons or creating holes where electrons can go. Either of these additions make the material more conductive. A semiconductor with extra electrons is called N-type material, since it has extra negativelycharged particles. In N-type material, free electrons move from a negatively-charged area to a positively charged area.

A semiconductor with extra holes is called P-type material, since it effectively has extra positively-charged particles. Electrons can jump from hole to hole, moving from a negativelycharged area to a positively-charged area. As a result, the holes themselves appear to move from a positively-charged area to a negatively-charged area. A diode comprises a section of N-type material bonded to a section of P-type material, with electrodes on each end. This arrangement conducts electricity in only one direction. When no voltage is applied to the diode, electrons from the N-type material fill holes from the P-type material along the junction between the layers, forming a depletion zone. In a depletion zone, the semiconductor material is returned to its original insulating state -- all of the holes are filled, so there are no free electrons or empty spaces for electrons, and charge can't flow.

At the junction, free electrons from the N-type material fill holes from the P-type material. This creates an insulating layer in the middle of the diode called the depletion zone. To get rid of the depletion zone, you have to get electrons moving from the N-type area to the Ptype area and holes moving in the reverse direction. To do this, you connect the N-type side of the diode to the negative end of a circuit and the P-type side to the positive end. The free electrons in the N-type material are repelled by the negative electrode and drawn to the positive electrode. The holes in the P-type material move the other way. When the voltage difference between the electrodes is high enough, the electrons in the depletion zone are boosted out of their holes and begin moving freely again. The depletion zone disappears, and charge moves across the diode.

When the negative end of the circuit is hooked up to the N-type layer and the positive end is hooked up to P-type layer, electrons and holes start moving and the depletion zone disappears. If you try to run current the other way, with the P-type side connected to the negative end of the circuit and the N-type side connected to the positive end, current will not flow. The negative electrons in the N-type material are attracted to the positive electrode. The positive holes in the P-type material are attracted to the negative electrode. No current flows across the junction because the holes and the electrons are each moving in the wrong direction. The depletion zone increases. (See How Semiconductors Work for more information on the entire process.)

When the positive end of the circuit is hooked up to the N-type layer and the negative end is hooked up to the P-type layer, free electrons collect on one end of the diode and holes collect on the other. The depletion zone gets bigger. The interaction between electrons and holes in this setup has an interesting side effect -- it generates light! In the next section, we'll find out exactly why this is.

leds :

LED working principle What is LED?


Light emitting diodes, commonly called LEDs, are real unsung heroes in the electronics world. They do dozens of different jobs and are found in all kinds of devices. Among other things, they form the numbers on digital clocks, transmit information from remote controls, light up watches and tell you when your appliances are turned on. Collected together, they can form images on a jumbo television screen or illuminate a traffic light. Basically, LEDs are just tiny light bulbs that fit easily into an electrical circuit. But unlike ordinary incandescent bulbs, they don't have a filament that will burn out, and they don't get especially hot. They are illuminated solely by the movement of electrons in a semiconductor material, and they last just as long as a standard transistor. In this article, we'll examine the simple principles behind these ubiquitous blinkers, illuminating some cool principles of electricity and light in the process.

How Can a Diode Produce Light?


Light is a form of energy that can be released by an atom. It is made up of many small particlelike packets that have energy and momentum but no mass. These particles, called photons, are the most basic units of light. Photons are released as a result of moving electrons. In an atom, electrons move in orbitals around the nucleus. Electrons in different orbitals have different amounts of energy. Generally speaking, electrons with greater energy move in orbitals farther away from the nucleus. For an electron to jump from a lower orbital to a higher orbital, something has to boost its energy level. Conversely, an electron releases energy when it drops from a higher orbital to a lower one. This energy is released in the form of a photon. A greater energy drop releases a higher-energy photon, which is characterized by a higher frequency. (Check out How Light Works for a full explanation.) As we saw in the last section, free electrons moving across a diode can fall into empty holes from the P-type layer. This involves a drop from the conduction band to a lower orbital, so the electrons release energy in the form of photons. This happens in any diode, but you can only see the photons when the diode is composed of certain material. The atoms in a standard silicon diode, for example, are arranged in such a way that the electron drops a relatively short distance.

As a result, the photon's frequency is so low that it is invisible to the human eye -- it is in the infrared portion of the light spectrum. This isn't necessarily a bad thing, of course: Infrared LEDs are ideal for remote controls, among other things. Visible light-emitting diodes (VLEDs), such as the ones that light up numbers in a digital clock, are made of materials characterized by a wider gap between the conduction band and the lower orbitals. The size of the gap determines the frequency of the photon -- in other words, it determines the color of the light. While all diodes release light, most don't do it very effectively. In an ordinary diode, the semiconductor material itself ends up absorbing a lot of the light energy. LEDs are specially constructed to release a large number of photons outward. Additionally, they are housed in a plastic bulb that concentrates the light in a particular direction. As you can see in the diagram, most of the light from the diode bounces off the sides of the bulb, traveling on through the rounded end.

LEDs have several advantages over conventional incandescent lamps. For one thing, they don't have a filament that will burn out, so they last much longer. Additionally, their small plastic bulb makes them a lot more durable. They also fit more easily into modern electronic circuits. But the main advantage is efficiency. In conventional incandescent bulbs, the light-production process involves generating a lot of heat (the filament must be warmed). This is completely wasted energy, unless you're using the lamp as a heater, because a huge portion of the available electricity isn't going toward producing visible light. LEDs generate very little heat, relatively speaking. A much higher percentage of the electrical power is going directly to generating light, which cuts down on the electricity demands considerably. Up until recently, LEDs were too expensive to use for most lighting applications because they're built around advanced semiconductor material. The price of semiconductor devices has plummeted over the past decade, however, making LEDs a more cost-effective lighting option

for a wide range of situations. While they may be more expensive than incandescent lights up front, their lower cost in the long run can make them a better buy. In the future, they will play an even bigger role in the world of technology.

Sip resistor

SIP means 'single in-line package', so it is a pack of several resistors, often with one end common. The connections are a series of pins like one side of a DIP (dual in-line package) as often seen in integrated circuits. The resistors may be used for a variety of purposes, like bus terminators, resistor ladder networks, pull-ups or pull-downs, but usually in microcontroller boards.

Voltage Regulator

A LM7805 Voltage Regulator is a voltage regulator that outputs +5 volts. An easy way to remember the voltage output by a LM78XX series of voltage regulators is the last two digits of the number. A LM7805 ends with "05"; thus, it outputs 5 volts. The "78" part is just the convention that the chip makers use to denote the series of regulators that output positive voltage. The other series of regulators, the LM79XX, is the series that outputs negative voltage. So:

LM78XX: Voltage regulators that output positive voltage, "XX"=voltage output. LM79XX: Voltage regulators that output negative voltage, "XX"=voltage output The LM7805, like most other regulators, is a three-pin IC. Pin 1 (Input Pin): The Input pin is the pin that accepts the incoming DC voltage, which the voltage regulator will eventually regulate down to 5 volts. Pin 2 (Ground): Ground pin establishes the ground for the regulator. Pin 3 (Output Pin): The Output pin is the regulated 5 volts DC.

Be advised, though, that though this voltage regulator can accept an input voltage of 36 volts, it is recommended to limit the voltage to 2-3 volts higher than the output regulated voltage. For a 5-volt regulator, no more than 8 volts should be applied as the input voltage. The difference between the input and output voltage appears as heat. The greater the difference between the input and output voltage, the more heat is generated. If too much heat is generated, through high input voltage, the regulator can overheat. If the regulator does not have a heat sink to dissipate this heat, it can be destroyed and malfunction. So the two options are, design your circuit so that the input voltage going into the regulator is limited to 2-3 volts above the output regulated voltage or place a heat sink in your circuit to dissipate the created heat.

Key Features

Output current up to 1.5 A Output voltages of 5; 6; 8; 8.5; 9; 12; 15; 18; 24 V Thermal overload protection Short circuit protection Output transition SOA protection 2 % output voltage tolerance (A version)

Guaranteed in extended temperature range (A version)

Microcontroller:
It was electricity in the beginning....The people were happy because they did not know that it was all around them and could be utilized. That was good. Then Faraday came and a stone has started to roll slowly... The first machines using a new sort of energy appeared soon. A long time has passed since then and just when the people finally got used to them and stopped paying attention to what a new generation of specialists were doing, someone came to an idea that electrons could be a very convenient toy being closed in a glass pipe. It was just a good idea at first, but there was no return. Electonics was born and the stone kept on rolling down the hill faster and faster... A new science - new specialists. Blue coats were replaced with white ones and people who knew something about electronics appeared on the stage. While the rest of humanity were passively watching in disbelief what was going on, the plotters split in two groups - software-oriented and hardware-oriented. Somewhat younger than their teachers, very enthusiastic and full of ideas, both of them kept on working but separate ways. While the first group was developing constantly and gradually, the hardware-oriented people, driven by success, threw caution to the wind and invented transistors. Up till that moment, the things could be more or less kept under control, but a broad publicity was not aware of what was going on, which soon led to a fatal mistake! Being naive in belief that cheap tricks could slow down technology development and development of the world and retrieve the good all days, mass market opened its doors for the products of Electronics Industry, thus closing a magic circle. A rapid drop in prices made these components available for a great variety of people. The stone was falling freely... The first integrated circuits and processors appeared soon, which caused computers and other products of electronics to drop down in price even more. They could be bought everywhere. Another circle was closed! Ordinary people got hold of computers and computer era has begun... While this drama was going on, hobbyists and professionals, also split in two groups and protected by anonymity, were working hard on their projects. Then, someone suddenly put a question: Why should not we make a universal component? A cheap, universal integrated circuit that could be programmed and used in any field of electronics, device or wherever needed? Technology has been developed enough as well as the market. Why not? So it happened, body and spirit were united and the first integrated circuit was designed and called the MICROCONTROLLER.

1.1 what are microcontrollers and what are they used for?
Like all good things, this powerful component is basically very simple. It is made by mixing tested and high- quality "ingredients" (components) as per following receipt:

1. The simplest computer processor is used as the "brain" of the future system. 2. Depending on the taste of the manufacturer, a bit of memory, a few A/D converters, timers, input/output lines etc. are added 3. All that is placed in some of the standard packages. 4. A simple software able to control it all and which everyone can easily learn about has been developed. On the basis of these rules, numerous types of microcontrollers were designed and they quickly became man's invisible companion. Their incredible simplicity and flexibility conquered us a long time ago and if you try to invent something about them, you should know that you are probably late, someone before you has either done it or at least has tried to do it. The following things have had a crucial influence on development and success of the microcontrollers: Powerful and carefully chosen electronics embedded in the microcontrollers can independetly or via input/output devices (switches, push buttons, sensors, LCD displays, relays etc.), control various processes and devices such as industrial automation, electric current, temperature, engine performance etc. Very low prices enable them to be embedded in such devices in which, until recent time it was not worthwhile to embed anything. Thanks to that, the world is overwhelmed today with cheap automatic devices and various smart appliences. Prior knowledge is hardly needed for programming. It is sufficient to have a PC (software in use is not demanding at all and is easy to learn) and a simple device (called the programmer) used for loading raedy-to-use programs into the microcontroller. So, if you are infected with a virus called electronics, there is nothing left for you to do but to learn how to use and control its power.

HOW DOES THE MICROCONTROLLER OPERATE?


Even though there is a large number of different types of microcontrollers and even more programs created for their use only, all of them have many things in common. Thus, if you learn to handle one of them you will be able to handle them all. A typical scenario on the basis of which it all functions is as follows: 1. Power supply is turned off and everything is stillthe program is loaded into the microcontroller, nothing indicates what is about to come 2. Power supply is turned on and everything starts to happen at high speed! The control logic unit keeps everything under control. It disables all other circuits except quartz crystal to operate. While the preparations are in progress, the first milliseconds go by. 3. Power supply voltage reaches its maximum and oscillator frequency becomes stable. SFRs are being filled with bits reflecting the state of all circuits within the microcontroller. All pins are configured as inputs. The overall electronis starts operation in rhythm with pulse sequence. From now on the time is measured in micro and nanoseconds. 4. Program Counter is set to zero. Instruction from that address is sent to instruction decoder which recognizes it, after which it is executed with immediate effect.

5. The value of the Program Counter is incremented by 1 and the whole process is repeated...several million times per second.

1.2 WHAT IS IN THE MICROCONTROLLER?


As you can see, all the operations within the microcontroller are performed at high speed and quite simply, but the microcontroller itself would not be so useful if there are not special circuits which make it complete. In continuation, we are going to call your attention to them. I. Read Only Memory (ROM) Read Only Memory (ROM) is a type of memory used to permanently save the program being executed. The size of the program that can be written depends on the size of this memory. ROM can be built in the microcontroller or added as an external chip, which depends on the type of the microcontroller. Both options have some disadvantages. If ROM is added as an external chip, the microcontroller is cheaper and the program can be considerably longer. At the same time, a number of available pins is reduced as the microcontroller uses its own input/output ports for connection to the chip. The internal ROM is usually smaller and more expensive, but leaves more pins available for connecting to peripheral environment. The size of ROM ranges from 512B to 64KB. II. Random Access Memory (RAM) Random Access Memory (RAM) is a type of memory used for temporary storing data and intermediate results created and used during the operation of the microcontrollers. The content of this memory is cleared once the power supply is off. For example, if the program performes an addition, it is necessary to have a register standing for what in everyday life is called the sum . For that purpose, one of the registers in RAM is called the "sum" and used for storing results of addition. The size of RAM goes up to a few KBs.

III. Electrically Erasable Programmable ROM (EEPROM) The EEPROM is a special type of memory not contained in all microcontrollers. Its contents may be changed during program execution (similar to RAM ), but remains permanently saved even after the loss of power (similar to ROM). It is often used to store values, created and used during operation (such as calibration values, codes, values to count up to etc.), which must be saved after turning the power supply off. A disadvantage of this memory is that the process of programming is relatively slow. It is measured in milliseconds(ms).

IV. Special Function Registers (SFR) Special function registers are part of RAM memory. Their purpose is predefined by the manufacturer and cannot be changed therefore. Since their bits are physically connected to particular circuits within the microcontroller, such as A/D converter, serial communication module etc., any change of their state directly affects the operation of the microcontroller or some of the circuits. For example, writing zero or one to the SFR controlling an input/output port causes the appropriate port pin to be configured as input or output. In other words, each bit of this register controls the function of one single pin. V. Program Counter Program Counter is an engine running the program and points to the memory address containing the next instruction to execute. After each instruction execution, the value of the counter is incremented by 1. For this reason, the program executes only one instruction at a time just as it is written. Howeverthe value of the program counter can be changed at any moment, which causes a jump to a new memory location. This is how subroutines and branch instructions are

executed. After jumping, the counter resumes even and monotonous automatic counting +1, +1, +1 VI. Central Processor Unit (CPU) As its name suggests, this is a unit which monitors and controls all processes within the microcontroller and the user cannot affect its work. It consists of several smaller subunits, of which the most important are:

Instruction decoder is a part of the electronics which recognizes program instructions and runs other circuits on the basis of that. The abilities of this circuit are expressed in the "instruction set" which is different for each microcontroller family. Arithmetical Logical Unit (ALU) performs all mathematical and logical operations upon data. Accumulator is an SFR closely related to the operation of ALU. It is a kind of working desk used for storing all data upon which some operations should be executed (addition, shift etc.). It also stores the results ready for use in further processing. One of the SFRs, called the Status Register, is closely related to the accumulator, showing at any given time the "status" of a number stored in the accumulator (the number is greater or less than zero etc.).

A bit is just a word invented to confuse novices at electronics. Joking aside, this word in practice indicates whether the voltage is present on a conductor or not. If it is present, the approprite pin is set to logic one (1), i.e. the bits value is 1. Otherwise, if the voltage is 0 V, the appropriate pin is cleared (0), i.e. the bits value is 0. It is more complicated in theory where a bit is referred to as a binary digit, but even in this case, its value can be either 0 or 1. Input/output ports (I/O Ports) In order to make the microcontroller useful, it is necessary to connect it to peripheral devices. Each microcontroller has one or more registers (called a port) connected to the microcontroller pins.

Why do we call them input/output ports? Because it is possible to change a pin function according to the user's needs. These registers are the only registers in the microcontroller the state of which can be checked by voltmeter!Oscillator

Even pulses generated by the oscillator enable harmonic and synchronous operation of all circuits within the microcontroller. It is usually configured as to use quartz-crystal or ceramics resonator for frequency stabilization. It can also operate without elements for frequency stabilization (like RC oscillator). It is important to say that program instructions are not executed at the rate imposed by the oscillator itself, but several times slower. It happens because each instruction is executed in several steps. For some microcontrollers, the same number of cycles is

needed to execute any instruction, while it's different for other microcontrollers. Accordingly, if the system uses quartz crystal with a frequency of 20MHz, the execution time of an instruction is not expected 50nS, but 200, 400 or even 800 nS, depending on the type of the microcontroller! Timers/Counters Most programs use these miniature electronic "stopwatches" in their operation. These are commonly 8- or 16-bit SFRs the contents of which is automatically incremented by each coming pulse. Once the register is completely loaded, an interrupt is generated! If these registers use an internal quartz oscillator as a clock source, then it is possible to measure the time between two events (if the register value is T1 at the moment measurement has started, and T2 at the moment it has finished, then the elapsed time is equal to the result of subtraction T2-T1 ). If the registers use pulses coming from external source, then such a timer is turned into a counter. This is only a simple explanation of the operation itself. Its somehow more complicated in practice.

A register or a memory cell is an electronic circuit which can memorize the state of one byte. Besides 8 bits available to the user, each register has also a number of addressing bits. It is important to remember that: All registers of ROM as well as those of RAM referred to as general-purpose registers are mutually equal and nameless. During programming, each of them can be assigned a name, which makes the whole operation much easier. All SFRs are assigned names which are different for different types of the microcontrollers and each of them has a special function as their name suggests.

Watchdog timer The Watchdog Timer is a timer connected to a completely separate RC oscillator within the microcontroller. If the watchdog timer is enabled, every time it counts up to the program end, the microcontroller reset occurs and program execution starts from the first instruction. The point is to prevent this from happening by using a special command. The whole idea is based on the fact that every program is executed in several longer or shorter loops. If instructions resetting the watchdog timer are set at the appropriate program locations, besides commands being regularly executed, then the operation of the watchdog timer will not affect the program execution. If for any reason (usually electrical noise in industry), the program counter "gets stuck" at some memory location from which there is no return, the watchdog will not be cleared, so the registers value being constantly incremented will reach the maximum et voila! Reset occurs! Power Supply Circuit There are two things worth attention concerning the microcontroller power supply circuit:

Brown out is a potentially dangerous state which occurs at the moment the microcontroller is being turned off or when power supply voltage drops to the lowest level due to electric noise. As the microcontroller consists of several circuits which have different operating voltage levels, this can cause its out of control performance. In order to prevent it, the microcontroller usually has a circuit for brown out reset built-in. This circuit immediately resets the whole electronics when the voltage level drops below the lower limit. Reset pin is usually referred to as Master Clear Reset (MCLR) and serves for external reset of the microcontroller by applying logic zero (0) or one (1) depending on the type of the microcontroller. In case the brown out is not built in the microcontroller, a simple external circuit for brown out reset can be connected to this pin. Serial communication

Parallel connections between the microcontroller and peripherals established over I/O ports are the ideal solution for shorter distances up to several meters. However, in other cases, when it is necessary to establish communication between two devices on longer distances it is obviously not possible to use parallel connections. Then, serial communication is the best solution. Today, most microcontrollers have several different systems for serial communication built in as a standard equipment. Which of them will be used depends on many factors of which the most important are: How many devices the microcontroller has to exchange data with? How fast the data exchange has to be? What is the distance between devices? Is it necessary to send and receive data simultaneously? One of the most important things concerning serial communication is the Protocol which should be strictly observed. It is a set of rules which must be applied in order that devices can correctly interpret data they mutually exchange. Fortunately, the microcontrollers automatically take care of this, so the work of the programmer/user is reduced to a simple write (data to be sent) and read (received data).

A byte consists of 8 bits grouped together. If a bit is a digit then it is logical that bytes are numbers. All mathematical operations can be performed upon them, just like upon common decimal numbers, which is carried out in the ALU. It is important to remember that byte digits are not of equal significance. The largest value has the leftmost bit called the most significant bit (MSB). The rightmost bit has the least value and is therefore called the least significant bit (LSB). Since 8 digits (zeros and ones) of one byte can be combined in 256 different ways, the largest decimal number which can be represented by one byte is 255 (one combination represents zero). Program Unlike other integrated circuits which only need to be connected to other components and turn the power supply on, the microcontrollers need to be programmed first. This is a so called "bitter pill" and the main reason why hardware-oriented electronics engineers stay away from microcontrollers. It is a trap causing huge losses because the process of programming the microcontroller is basically very simple.

In order to write a program for the microcontroller, several "low-level" programming languages can be used such as Assembly, C and Basic (and their versions as well). Writing program procedure consists of simple writing instructions in the order in which they should be executed. There are also many programs running in Windows environment used to facilitate the work providing additional visual tools. This book describes the use of Assembly because it is the simplest language with the fastest execution allowing entire control on what is going on in the circuit.

Interrupt - electronics is usually more faster than physical processes it should keep under control. This is why the microcontroller spends most of its time waiting for something to happen or execute. In other words, when some event takes place, the microcontroller does something. In order to prevent the microcontroller from spending most of its time endlessly checking for logic state on input pins and registers, an interrupt is generated. It is the signal which informs the central processor that something attention worthy has happened. As its name suggests, it interrupts regular program execution. It can be generated by different sources so when it occurs, the microcontroller immediately stops operation and checks for the cause. If it is needed to perform some operations, a current state of the program counter is pushed onto the Stack and the appropriate program is executed. It's the so called interrupt routine. Stack is a part of RAM used for storing the current state of the program counter (address) when an interrupt occurs. In this way, after a subroutine or an interrupt execution, the microcontroller knows from where to continue regular program execution. This address is cleared after returning to the program because there is no need to save it any longer, and one location of the stack is automatically availale for further use. In addition, the stack can consist of several levels. This enables subroutines nesting, i.e. calling one subroutine from another.

ARCHITECTURE OF 8051 MICROCONTROLLER


2.1 WHAT IS 8051 STANDARD? Microcontroller manufacturers have been competing for a long time for attracting choosy customers and every couple of days a new chip with a higher operating frequency, more memory and upgraded A/D converters appeared on the market. However, most of them had the same or at least very similar architecture known in the world of microcontrollers as 8051 compatible. What is all this about? The whole story has its beginnings in the far 80s when Intel launched the first series of microcontrollers called the MCS 051. Even though these microcontrollers had quite modest

features in comparison to the new ones, they conquered the world very soon and became a standard for what nowadays is called the microcontroller. The main reason for their great success and popularity is a skillfully chosen configuration which satisfies different needs of a large number of users allowing at the same time constant expansions (refers to the new types of microcontrollers). Besides, the software has been developed in great extend in the meantime, and it simply was not profitable to change anything in the microcontrollers basic core. This is the reason for having a great number of various microcontrollers which basically are solely upgraded versions of the 8051 family. What makes this microcontroller so special and universal so that almost all manufacturers all over the world manufacture it today under different name?

As seen in figure above, the 8051 microcontroller has nothing impressive in appearance: 4 Kb of ROM is not much at all. 128b of RAM (including SFRs) satisfies the user's basic needs. 4 ports having in total of 32 input/output lines are in most cases sufficient to make all necessary connections to peripheral environment. The whole configuration is obviously thought of as to satisfy the needs of most programmers working on development of automation devices. One of its advantages is that nothing is missing and nothing is too much. In other words, it is created exactly in accordance to the average users taste and needs. Another advantages are RAM organization, the operation of Central Processor Unit (CPU) and ports which completely use all recourses and enable further upgrade. 2.2 PINOUT DISCRIPTION

Pins 1-8: Port 1 Each of these pins can be configured as an input or an output.

Pin 9: RS A logic one on this pin disables the microcontroller and clears the contents of most registers. In other words, the positive voltage on this pin resets the microcontroller. By applying logic zero to this pin, the program starts execution from the beginning. Pins10-17: Port 3 Similar to port 1, each of these pins can serve as general input or output. Besides, all of them have alternative functions: Pin 10: RXD Serial asynchronous communication input or Serial synchronous communication output. Pin 11: TXD Serial asynchronous communication output or Serial synchronous communication clock output. Pin 12: INT0 Interrupt 0 input. Pin 13: INT1 Interrupt 1 input. Pin 14: T0 Counter 0 clock input. Pin 15: T1 Counter 1 clock input. Pin 16: WR Write to external (additional) RAM. Pin 17: RD Read from external RAM. Pin 18, 19: X2, X1 Internal oscillator input and output. A quartz crystal which specifies operating frequency is usually connected to these pins. Instead of it, miniature ceramics resonators can also be used for frequency stability. Later versions of microcontrollers operate at a frequency of 0 Hz up to over 50 Hz. Pin 20: GND Ground. Pin 21-28: Port 2 If there is no intention to use external memory then these port pins are configured as general inputs/outputs. In case external memory is used, the higher address byte, i.e. addresses A8-A15 will appear on this port. Even though memory with capacity of 64Kb is not used, which means that not all eight port bits are used for its addressing, the rest of them are not available as inputs/outputs. Pin 29: PSEN If external ROM is used for storing program then a logic zero (0) appears on it every time the microcontroller reads a byte from memory. Pin 30: ALE Prior to reading from external memory, the microcontroller puts the lower address byte (A0-A7) on P0 and activates the ALE output. After receiving signal from the ALE pin, the external register (usually 74HCT373 or 74HCT375 add-on chip) memorizes the state of P0 and uses it as a memory chip address. Immediately after that, the ALU pin is returned its previous logic state and P0 is now used as a Data Bus. As seen, port data multiplexing is performed by means of only one additional (and cheap) integrated circuit. In other words, this port is used for both data and address transmission. Pin 31: EA By applying logic zero to this pin, P2 and P3 are used for data and address transmission with no regard to whether there is internal memory or not. It means that even there is a program written to the microcontroller, it will not be executed. Instead, the program written to external ROM will be executed. By applying logic one to the EA pin, the microcontroller will use both memories, first internal then external (if exists). Pin 32-39: Port 0 Similar to P2, if external memory is not used, these pins can be used as general inputs/outputs. Otherwise, P0 is configured as address output (A0-A7) when the ALE pin is driven high (1) or as data output (Data Bus) when the ALE pin is driven low (0). Pin 40: VCC +5V power supply.

2.3 INPUT/OUTPUT PORTS (I/O PORTS) All 8051 microcontrollers have 4 I/O ports each comprising 8 bits which can be configured as inputs or outputs. Accordingly, in total of 32 input/output pins enabling the microcontroller to be connected to peripheral devices are available for use. Pin configuration, i.e. whether it is to be configured as an input (1) or an output (0), depends on its logic state. In order to configure a microcontroller pin as an input, it is necessary to apply logic zero (0) to appropriate I/O port bit. In this case, voltage level on appropriate pin will be 0. Similarly, in order to configure a microcontroller pin as an input, it is necessary to apply a logic one (1) to appropriate port. In this case, voltage level on appropriate pin will be 5V (as is the case with any TTL input). This may seem confusing but don't loose your patience. It all becomes clear after studying simple electronic circuits connected to an I/O pin.

Input/Output (I/O) pin Figure above illustrates a simplified schematic of all circuits within the microcontroler connected to one of its pins. It refers to all the pins except those of the P0 port which do not have pull-up resistors built-in.

Output pin A logic zero (0) is applied to a bit of the P register. The output FE transistor is turned on, thus connecting the appropriate pin to ground.

Input pin A logic one (1) is applied to a bit of the P register. The output FE transistor is turned off and the appropriate pin remains connected to the power supply voltage over a pull-up resistor of high resistance.

Logic state (voltage) of any pin can be changed or read at any moment. A logic zero (0) and logic one (1) are not equal. A logic one (0) represents a short circuit to ground. Such a pin acts as an output. A logic one (1) is loosely connected to the power supply voltage over a resistor of high resista nce. Since this voltage can be easily reduced by an external signal, such a pin acts as an input.

Port 0
The P0 port is characterized by two functions. If external memory is used then the lower address byte (addresses A0-A7) is applied on it. Otherwise, all bits of this port are configured as inputs/outputs. The other function is expressed when it is configured as an output. Unlike other ports consisting of pins with built-in pull-up resistor connected by its end to 5 V power supply, pins of this port have this resistor left out. This apparently small difference has its consequences:

If any pin of this port is configured as an input then it acts as if it floats. Such an input has unlimited input resistance and indetermined potential.

When the pin is configured as an output, it acts as an open drain. By applying logic 0 to a port bit, the appropriate pin will be connected to ground (0V). By applying logic 1, the external output will keep on floating. In order to apply logic 1 (5V) on this output pin, it is necessary to built in an external pull-up resistor.

Only in case P0 is used for addressing external memory, the microcontroller will provide internal power supply source in order to supply its pins with logic one. There is no need to add external pull-up resistors. Port 1 P1 is a true I/O port, because it doesn't have any alternative functions as is the case with P0, but can be cofigured as general I/O only. It has a pull-up resistor built-in and is completely compatible with TTL circuits. Port 2 P2 acts similarly to P0 when external memory is used. Pins of this port occupy addresses intended for external memory chip. This time it is about the higher address byte with addresses A8-A15. When no memory is added, this port can be used as a general input/output port showing features similar to P1.

Port 3 All port pins can be used as general I/O, but they also have an alternative function. In order to use these alternative functions, a logic one (1) must be applied to appropriate bit of the P3 register. In tems of hardware, this port is similar to P0, with the difference that its pins have a pull-up resistor built-in. Pin's Current limitations When configured as outputs (logic zero (0)), single port pins can receive a current of 10mA. If all 8 bits of a port are active, a total current must be limited to 15mA (port P0: 26mA). If all ports (32 bits) are active, total maximum current must be limited to 71mA. When these pins are configured as inputs (logic 1), built-in pull-up resistors provide very weak current, but strong enough to activate up to 4 TTL inputs of LS series.

As seen from description of some ports, even though all of them have more or less similar architecture, it is necessary to pay attention to which of them is to be used for what and how. For example, if they shall be used as outputs with high voltage level (5V), then P0 should be avoided because its pins do not have pull-up resistors, thus giving low logic level only. When using other ports, one should have in mind that pull-up resistors have a relatively high resistance, so that their pins can give a current of several hundreds microamperes only.

2.4 MEMORY ORGANIZATION The 8051 has two types of memory and these are Program Memory and Data Memory. Program Memory (ROM) is used to permanently save the program being executed, while Data Memory (RAM) is used for temporarily storing data and intermediate results created and used during the operation of the microcontroller. Depending on the model in use (we are still talking about the 8051 microcontroller family in general) at most a few Kb of ROM and 128 or 256 bytes of RAM is used. However All 8051 microcontrollers have a 16-bit addressing bus and are capable of addressing 64 kb memory. It is neither a mistake nor a big ambition of engineers who were working on basic core development. It is a matter of smart memory organization which makes these microcontrollers a real programmers goody. Program Memory The first models of the 8051 microcontroller family did not have internal program memory. It was added as an external separate chip. These models are recognizable by their label beginning with 803 (for example 8031 or 8032). All later models have a few Kbyte ROM embedded. Even though such an amount of memory is sufficient for writing most of the programs, there are situations when it is necessary to use additional memory as well. A typical example are so called lookup tables. They are used in cases when equations describing some processes are too complicated or when there is no time for solving them. In such cases all necessary estimates and

approximates are executed in advance and the final results are put in the tables (similar to logarithmic tables).

How does the microcontroller handle external memory depends on the EA pin logic state:

EA=0 In this case, the microcontroller completely ignores internal program memory and executes only the program stored in external memory. EA=1 In this case, the microcontroller executes first the program from built-in ROM, then the program stored in external memory. In both cases, P0 and P2 are not available for use since being used for data and address transmission. Besides, the ALE and PSEN pins are also used. Data Memory As already mentioned, Data Memory is used for temporarily storing data and intermediate results created and used during the operation of the microcontroller. Besides, RAM memory built in the 8051 family includes many registers such as hardware counters and timers, input/output ports, serial data buffers etc. The previous models had 256 RAM locations, while for the later models this number was incremented by additional 128 registers. However, the first 256 memory locations (addresses 0-FFh) are the heart of memory common to all the models belonging to the

8051 family. Locations available to the user occupy memory space with addresses 0-7Fh, i.e. first 128 registers. This part of RAM is divided in several blocks. The first block consists of 4 banks each including 8 registers denoted by R0-R7. Prior to accessing any of these registers, it is necessary to select the bank containing it. The next memory block (address 20h-2Fh) is bit- addressable, which means that each bit has its own address (07Fh). Since there are 16 such registers, this block contains in total of 128 bits with separate addresses (address of bit 0 of the 20h byte is 0, while address of bit 7 of the 2Fh byte is 7Fh). The third group of registers occupy addresses 2Fh-7Fh, i.e. 80 locations, and does not have any special functions or features. Additional RAM In order to satisfy the programmers constant hunger for Data Memory, the manufacturers decided to embed an additional memory block of 128 locations into the latest versions of the 8051 microcontrollers. However, its not as simple as it seems to be The problem is that electronics performing addressing has 1 byte (8 bits) on disposal and is capable of reaching only the first 256 locations, therefore. In order to keep already existing 8-bit architecture and compatibility with other existing models a small trick was done. What does it mean? It means that additional memory block shares the same addresses with locations intended for the SFRs (80h- FFh). In order to differentiate between these two physically separated memory spaces, different ways of addressing are used. The SFRs memory locations are accessed by direct addressing, while additional RAM memory locations are accessed by indirect addressing.

Memory expansion In case memory (RAM or ROM) built in the microcontroller is not sufficient, it is possible to add two external memory chips with capacity of 64Kb each. P2 and P3 I/O ports are used for their addressing and data transmission.

From the users point of view, everything works quite simply when properly connected because most operations are performed by the microcontroller itself. The 8051 microcontroller has two pins for data read RD#(P3.7) and PSEN#. The first one is used for reading data from external data memory (RAM), while the other is used for reading data from external program memory (ROM). Both pins are active low. A typical example of memory expansion by adding RAM and ROM chips (Hardward architecture), is shown in figure above. Even though additional memory is rarely used with the latest versions of the microcontrollers, we will describe in short what happens when memory chips are connected according to the previous schematic. The whole process described below is performed automatically.

When the program during execution encounters an instruction which resides in external memory (ROM), the microcontroller will activate its control output ALE and set the first 8 bits of address (A0-A7) on P0. IC circuit 74HCT573 passes the first 8 bits to memory address pins. A signal on the ALE pin latches the IC circuit 74HCT573 and immediately afterwards 8 higher bits of address (A8-A15) appear on the port. In this way, a desired location of additional program memory is addressed. It is left over to read its content.

Port P0 pins are configured as inputs, the PSEN pin is activated and the microcontroller reads from memory chip. Similar occurs when it is necessary to read location from external RAM. Addressing is performed in the same way, while read and write are performed via signals appearing on the control outputs RD (is short for read) or WR (is short for write).

Learning section
Soldering
Soldering is a process in which two or more metal items are joined together by melting and flowing a filler metal into the joint, the filler metal having a relatively low melting point. Soft soldering is characterized by the melting point of the filler metal, which is below 400 C (800 F). The filler metal used in the process is called solder. Soldering is distinguished from brazing by use of a lower melting-temperature filler metal; it is distinguished from welding by the base metals not being melted during the joining process. In a soldering process, heat is applied to the parts to be joined, causing the solder to melt and be drawn into the joint by capillary action and to bond to the materials to be joined by wetting action. After the metal cools, the resulting joints are not as strong as the base metal, but have adequate strength, electrical conductivity, and water-tightness for many uses. Soldering is an ancient technique mentioned in the Bible and there is evidence that it was employed up to 5000 years ago in Mesopotamia.

Applications
One of the most frequent applications of soldering is assembling electronic components to printed circuit boards (PCBs). Another common application is making permanent but reversible connections between copper pipes in plumbing systems. Joints in sheet metal objects such as food cans, roof flashing, rain gutters and automobile radiators have also historically been soldered, and occasionally still are. Jewelry components are assembled and repaired by soldering. Small mechanical parts are often soldered as well. Soldering is also used to join lead came and copper foil in stained glass work. Soldering can also be used to effect a semipermanent patch for a leak in a container cooking vessel.

Solders
Soldering filler materials are available in many different alloys for differing applications. In electronics assembly, the eutectic alloy of 63% tin and 37% lead (or 60/40, which is almost identical in performance to the eutectic) has been the alloy of choice. Other alloys are used for plumbing, mechanical assembly, and other applications.

A eutectic formulation has several advantages for soldering; chief among these is the coincidence of the liquidus and solidus temperatures, i.e. the absence of a plastic phase. This allows for quicker wetting out as the solder heats up, and quicker setup as the solder cools. A non-eutectic formulation must remain still as the temperature drops through the liquidus and solidus temperatures. Any differential movement during the plastic phase may result in cracks, giving an unreliable joint. Additionally, a eutectic formulation has the lowest possible melting point, which minimizes heat stress on electronic components during soldering. Lead-free solders are suggested anywhere children may come into contact (since children are likely to place things into their mouths), or for outdoor use where rain and other precipitation may wash the lead into the groundwater. Common solder alloys are mixtures of tin and lead, respectively:

63/37: melts at 183 C (361.4 F) (eutectic: the only mixture that melts at a point, instead of over a range) 60/40: melts between 183190 C (361374 F) 50/50: melts between 185215 C (365419 F)

Lead-free solder alloys melt around 250 C (482 F), depending on their composition. For environmental reasons, 'no-lead' solders are becoming more widely used. Unfortunately most 'no-lead' solders are not eutectic formulations, making it more difficult to create reliable joints with them. Other common solders include low-temperature formulations (often containing bismuth), which are often used to join previously-soldered assemblies without un-soldering earlier connections, and high-temperature formulations (usually containing silver) which are used for hightemperature operation or for first assembly of items which must not become unsoldered during subsequent operations. Specialty alloys are available with properties such as higher strength, better electrical conductivity and higher corrosion resistance. Flux In high-temperature metal joining processes (welding, brazing and soldering), the primary purpose of flux is to prevent oxidation of the base and filler materials. Tin-lead solder, for example, attaches very well to copper, but poorly to the various oxides of copper, which form quickly at soldering temperatures. Flux is a substance which is nearly inert at room temperature, but which becomes strongly reducing at elevated temperatures, preventing the formation of metal oxides. Secondarily, flux acts as a wetting agent in the soldering process, reducing the surface tension of the molten solder and causing it to better wet out the parts to be joined. Fluxes currently available include water-soluble fluxes (no VOC's required for removal) and 'noclean' fluxes which are mild enough to not require removal at all. Performance of the flux needs to be carefully evaluated; a very mild 'no-clean' flux might be perfectly acceptable for production equipment, but not give adequate performance for a poorly-controlled hand-soldering operation.

Traditional rosin fluxes are available in non-activated (R), mildly activated (RMA) and activated (RA) formulations. RA and RMA fluxes contain rosin combined with an activating agent, typically an acid, which increases the wet ability of metals to which it is applied by removing existing oxides. The residue resulting from the use of RA flux is corrosive and must be cleaned off the piece being soldered. RMA flux is formulated to result in a residue which is not significantly corrosive, with cleaning being preferred but optional.

BASIC SOLDERING TECHNIQUES Methods Soldering operations can be performed with hand tools, one joint at a time, or en masse on a production line. Hand soldering is typically performed with a soldering iron, soldering gun, or a torch, or occasionally a hot-air pencil. Sheet metal work was traditionally done with "soldering coppers" directly heated by a flame, with sufficient stored heat in the mass of the soldering copper to complete a joint; torches or electrically-heated soldering irons are more convenient. All soldered joints require the same elements of cleaning of the metal parts to be joined, fitting up the joint, heating the parts, applying flux, applying the filler, removing heat and holding the assembly still until the filler metal has completely solidified. Depending on the nature of flux material used, cleaning of the joints may be required after they have cooled. The distinction between soldering and brazing is arbitrary, based on the melting temperature of the filler material. A temperature of 450 C is usually used as a practical cut-off. Different equipment and/or fixturing is usually required since (for instance) a soldering iron generally cannot achieve high enough temperatures for brazing. Practically speaking there is a significant difference between the two processesbrazing fillers have far more structural strength than solders, and are formulated for this as opposed to maximum electrical conductivity. Brazed connections are often as strong or nearly as strong as the parts they connect, even at elevated temperatures. "Hard soldering" or "silver soldering" (performed with high-temperature solder containing up to 40% silver) is also often a form of brazing, since it involves filler materials with melting points in the vicinity of, or in excess of, 450 C. Although the term "silver soldering" is used much more often than "silver brazing", it may be technically incorrect depending on the exact melting point of the filler in use. In silver soldering ("hard soldering"), the goal is generally to give a beautiful, structurally sound joint, especially in the field of jewelry. Thus, the temperatures involved, and the usual use of a torch rather than an iron, would seem to indicate that the process should be referred to as "brazing" rather than "soldering", but the endurance of the "soldering" appellation serves to indicate the arbitrary nature of the distinction (and the level of confusion) between the two processes. Induction soldering is a process which is similar to brazing. The source of heat in induction soldering is induction heating by high-frequency AC current. Generally copper coils are used for the induction heating. This induces currents in the part being soldered. The coils are usually made of copper or a copper base alloy. The copper rings can be made to fit the part needed to be

soldered for precision in the work piece. Induction soldering is a process in which a filler metal (solder) is placed between the faying surfaces of (to be joined) metals. The filler metal in this process is melted at a fairly low temperature. Fluxes are a common use in induction soldering. This is a process which is particularly suitable for soldering continuously. The process is usually done with coils that wrap around a cylinder/pipe that needs to be soldered. Some metals are easier to solder than others. Copper, silver, and gold are easy. Iron and nickel are found to be more difficult. Because of their thin, strong oxide films, stainless steel and aluminum are a little more difficult. Titanium, magnesium, cast irons, steels, ceramics, and graphite can be soldered but it involves a process similar to joining carbides. They are first plated with a suitable metallic element that induces interfacial bonding.

Desoldering and resoldering Used solder contains some of the dissolved base metals and is unsuitable for reuse in making new joints. Once the solder's capacity for the base metal has been achieved it will no longer properly bond with the base metal, usually resulting in a brittle cold solder joint with a crystalline appearance. It is good practice to remove solder from a joint prior to resoldering desoldering braids or vacuum desoldering equipment (solder suckers) can be used. Desoldering wicks contain plenty of flux that will lift the contamination from the copper trace and any device leads that are present. This will leave a bright, shiny, clean junction to be resoldered. The lower melting point of solder means it can be melted away from the base metal, leaving it mostly intact though the outer layer will be "tinned" with solder. Flux will remain which can easily be removed by abrasive or chemical processes. This tinned layer will allow solder to flow into a new joint, resulting in a new joint, as well as making the new solder flow very quickly and easily.

Common tools Hand-soldering tools include the electric soldering iron, which has a variety of tips available ranging from blunt to very fine to chisel heads for hot-cutting plastics, and the soldering gun, which typically provides more power, giving faster heat-up and allowing larger parts to be soldered. Hot-air guns and pencils allow rework of component packages which cannot easily be performed with irons and guns. Soldering torches are a type of soldering device that uses a flame rather than a soldering iron tip to heat solder. Soldering torches are often powered by butane and are available in sizes ranging from very small butane/oxygen units suitable for very fine but high-temperature jewelry work, to full-size oxy-fuel torches suitable for much larger work such as copper piping.

A soldering copper is a tool with a large copper head and a long handle, which is heated in a blacksmith's forge fire, and used to apply heat to sheet metal for soldering. Soldering coppers are sometimes used in auto bodywork, although body solder has been mostly superseded by nonmetallic fillers. Toaster ovens and hand held infrared lights have been used to reproduce production processes on a much smaller scale. Bristle brushes are usually used to apply plumbing paste flux. For electronic work, flux-core solder is generally used, but additional flux may be used from a flux pen or dispensed from a small bottle with a syringe-like needle. Wire brush, wire wool and emery cloth are commonly used to prepare plumbing joints for connection. Electronic joints rarely require mechanical cleaning. For PCB assembly and rework, alcohol and acetone are commonly used with cotton swabs or bristle brushes to remove flux residue. A heavy rag is usually used to remove flux from a plumbing joint before it cools and hardens. A fiberglass brush can also be used. For electronic work, solder wick and vacuum-operated "solder sucker" are used to undo solder connections. A heat sink, such as a crocodile clips, can also be used to prevent damaging heat-sensitive components while soldering.

SOLDERING TOOLS
The only tools that are essential to solder are a soldering iron and some solder. There are, however, lots of soldering accessories available (see soldering accessories for more information). Different soldering jobs will need different tools, and different temperatures too. For circuit board work you will need a finer tip, a lower temperature and finer grade solder. You may also want to use a magnifying glass. Audio connectors such as XLR's will require a larger tip, higher temperature and thicker solder. Clamps and holders are also handy when soldering audio cables.

Soldering Irons There are several things to consider when choosing a soldering iron.

Wattage

adjustable or fixed temperature power source (electric or gas) portable or bench use I do not recommend soldering guns, as these have no temperature control and can get too hot. This can result in damage to circuit boards, melt cable insulation, and even damage connectors.

Wattage It is important to realise that higher wattage does not necessarily mean hotter soldering iron. Higher wattage irons just have more power available to cope with bigger joints. A low wattage iron may not keep its temperature on a big joint, as it can loose heat faster than it can reheat itself. Therefore, smaller joints such as circuit boards require a lesser wattage iron - around 15-30 watts will be fine. Audio connectors need something bigger - I recommend 40 watts at least.

Temperature There are a lot of cheap, low watt irons with no temperature control available. Most of these are fine for basic soldering, but if you are going to be doing a lot you may want to consider a variable temperature soldering iron. Some of these simply have a boost button on the handle, which is useful with larger joints, others have a thermostatic control so you can vary the heat of the tip. If you have a temperature controlled iron you should start at about 315-345C (600-650F). You may want to increase this however - I prefer about 700-750F. Use a temperature that will allow you to complete a joint in 1 to 3 seconds.

Power Most soldering irons are mains powered - either 110/230v AC, or bench top soldering stations which transform down to low voltage DC. Also available are battery and gas powered. These are great for the toolbox, but you'll want a plug in one for your bench. Gas soldering irons lose their heat in windy outside conditions more easily that a good high wattage mains powered iron. Portability Most cheaper soldering irons will need to plug into the mains. This is fine a lot of the time, but if there is no mains socket around, you will need another solution. Gas and battery soldering irons are the answer here. They are totally portable and can be taken and used almost anywhere. They

may not be as efficient at heating as a good high wattage iron, but they can get you out of a lot of hassle at times. If you have a bench setup, you should consider using a soldering station. These usually have a soldering iron and desoldering iron with heatproof stands, variable heat, and a place for a cleaning pad. A good solder station will be reliable, accurate with its temperature, and with a range of tips handy it can perform any soldering task you attempt with it.

Solder The most commonly used type of solder is rosin core. The rosin is flux, which cleans as you solder. The other type of solder is acid core and unless you are experienced at soldering, you should stick to rosin core solder. Acid core solder can be tricky and better avoided for the beginner. Rosin core solder comes in three main types - 50/50, 60/40 and 63/37. These numbers represent the amount of tin and lead are present in the solder, as shown below. Solder Type 50/50 60/40 63/37 % Tin % Lead Melting Temp (F) 425 371 361

50 60 63

50 40 37

Any general purpose rosin core solder will be fine.

SOLDERING ACCESSORIES:

Soldering Iron Tips Try to use the right size tip whenever you can. Smaller wires and circuit boards require small fine tips, and mic cable onto an XLR would need a larger tip. You can get pointed tips, or flat tipped ones (sometimes called 'spade tips'). If you have a solder station with a desolderer, you will also want a range of desoldering tips and cleaners. Soldering Iron Stands These are handy to use if you are doing several or more joints. It is a heat resistant cradle for your iron to sit in, so you don't have to lie it down on the bench while it is hot. It really is essential if you are planning to do a lot of bench soldering as it is only a matter of time before you burn something (probably your elbow resting on the hot tip) if you don't use one.

Clamps I strongly recommend clamps of some sort. Trying to hold your soldering iron, the solder, and the wire is tricky enough, but when you have to hold the connector as well it is almost impossible. They are however, adjustable clamps that can be manipulated to hold both the connector and the wire in place so you still have two free hands to apply the heat and the solder. These are cheap items, and I know mine have paid for them many times over.

Magnifying glass If you are doing work on PCBs (printed circuit boards) you may need to get a magnifying glass. This will help you see the tracks on the PCB, and unless you have exceptional sight, small chip resistors are pretty difficult to solder on well without a magnifying glass. Once again, they are not expensive, and some clamps come with one that can mount on the clamp stand.

Solder Wick Solder wick is a mesh that you lay on a joint and heat. When it heats up it also melts the solder which is drawn out of the joint. It is usually used for cleaning up solder from tracks on a circuit board, but you will need a solder sucker to clean out the holes in the circuit board. Place the wick on the solder you want to remove then put your soldering iron on top of the wick. The wick will heat up, then the solder will melt and flow away from the joint and into wick. Solder Suckers If you don't have a solder station with desolderer, and you work on PCB's, you are going to need one of these before too long. They are spring loaded and suck the melted solder out of the joint. They are a bit tricky to use, as you have to melt the solder with your iron, then quickly position the solder sucker over the melted solder and release the spring to suck up the solder. I find solder wick to be easier to use and more effective. Fume Extractors Solder fumes are poisonous. A fume extractor will suck the fumes (smoke) into itself and filter it. An absolute must for your health if you are setting up a soldering bench.

PREPARATION
Step 1: Preparation If you are preparing the cable for a connector, I strongly suggest you put any connector parts on now (the screw on part of an XLR, or casing of a 1/4" jack for example). Get into the habit of sliding these on before you start on the cable, or else you can bet it won't be long before you finish soldering your connector only to discover you forgot to put the connector casing on, and have to start all over again. Once you have all the connector parts on that you need, you will need to strip your cable. This means removing the insulation from the end of the wire and exposing the copper core. You can either use a wire stripper, side cutters, or a knife to do this. The obvious tool to choose to strip a wire would be......a wire stripper. There are many types of wire stripper, and most of them work the same. You simply put the wire in, and squeeze it and pull the end bit off.

It will cut to a preset depth, and if you have chosen the right depth it will cut the insulation off perfectly. It is possible to choose the wrong depth and cut too deeply, or too shallow, but they are very easy to use. On the other hand, some people (myself included) prefer to use a knife or side cutters. I use side cutters for small cable and a Stanley knife for bigger cables...and although I have a couple of wire strippers, I haven't used them for years. This may seem odd, but I've got my side cutters and knife with me anyway, and they do the job fine. If you are using side cutters (as shown here), position them about 10mm (1/2 inch) from the end, and gently squeeze the cutters into the insulation to pierce it, but not far enough to cut the copper strands of the core. Open the cutters slightly so you can turn the wire and pierce the rest of the insulation. You may have to do this a few times to cut through all of the insulation, but it is better to cut too shallow and have to turn and cut again rather than cut the core and have to start again. Now you should be able to slide the insulation off with your cutters, or pull it off with your fingers. This may sound a tedious method, but in no time at all you will be able to do it in two cuts and a flick of the cutters. I won't explain how I use a knife to do larger cable, as I'd hate someone to slice a finger or thumb open following my instructions. Using a sharp blade like that certainly does have its risks, so stick with wire cutters or side cutters if you are at all unsure. If your connector has been used before, make sure you remove any remnants of wire and solder from the contacts. Do this by putting the tip of your soldering iron into the hole and flicking the solder out when it has melted. Common Sense Alert! Please be careful when you flick melted solder...flick it away from you.

TINNING
Step 2: Tinning

Whatever it is you are soldering, you should 'tin' both


contacts before you attempt to solder them. This coats or fills the wires or connector contacts with solder so you can easily melt them together. To tin a wire, apply the tip of your iron to the wire for a second or two, then apply the solder to the wire. The solder should flow freely onto the wire and coat it (if it's stranded wire the solder should flow into it,

and fill the wire). You may need to snip the end off afterwards, particularly if you have put a little too much solder on and it has formed a little ball at the end of the wire.

Be careful not to overheat the wire, as the insulation will start to melt. On cheaper cable the insulation can 'shrink back' if heated too much, and expose more copper core that you intended. You can cut the wire back after you have tinned it, but it's best simply not to overheat it.

The larger the copper core, the longer it will take to heat up enough to draw the solder in, so use a higher temperature soldering iron for larger cables if you can. To tin a contact on an audio XLR connector, hold the iron on the outside of the the contact for a second or two, then apply the solder into the cavity of the contact. Once again, the solder should flow freely and fill the contact. Connectors such as jacks have contacts that are just holes in a flat part of the connector. To tin these you put your iron on it, and apply the solder to where the iron is touching. The solder should flow and cover the hole. Once you have tinned both parts, you are ready to solder them together.

SOLDERING

Step 3: Soldering This step can often be the easiest when soldering audio cables. You simply need to place your soldering iron onto the contact to melt the solder. When the solder in the contact melts, slide the wire into the contact. Remove the iron and hold the wire still while the solder solidifies again. You will see the solder 'set' as it goes hard. This should all take around 1-3 seconds.

A good solder joint will be smooth and shiny. If the joint is dull and crinkly, the wire probably moved during soldering. If you have taken too long it will have solder spikes. If it does not go so well, you may find the insulation has melted, or there is too much stripped wire showing. If this is the case, you should desolder the joint and start again.

Cleaning Your Soldering Iron You should clean your tip after each use. There are many cleaning solutions and the cheapest (and some say best) is a damp sponge. Just rub the soldering iron tip on it after each solder. Another option is to use tip cleaner. This comes in a little pot that you push the tip into. This works well if your tip hasn't been cleaned for a while. It does create a lot of smoke, so it is better not to let the tip get so dirty that you need to use tip cleaner.

Some solder stations come with a little pad at the base of the holder. If you have one of these, you should get into the habit of wiping the tip on the pad each time you apply solder with it.

If you need to clean solder off a circuit board, solder wick is what you need. You place the wick on the joint or track you want to clean up, and apply your soldering iron on top. The solder melts and is drawn into the wick. If there is a lot of solder the wick will fill up, so gently pull the wick through the joint and your iron, and the solder will flow into it as it passes.

Tips and Tricks 1. 2. 3. 4. 5. Melted solder flows towards heat. Most beginning solderers tend to use too much solder and heat the joint for too long. Don't move the joint until the solder has cooled. Keep your iron tip clean. Use the proper type of iron and tip size.

Troubleshooting If either of the parts you are soldering is dirty or greasy, the solder won't take (or 'stick') to it. Desolder the joint and clean the parts before trying again. Another reason the solder won't take is that it may not be the right sort of metal. For example you cannot solder aluminum with lead/tin solder. If the joint has been moved during soldering, it may look grainy or dull. It may also look like this if the joint was not heated properly while soldering. If the joint was overheated the solder will have formed a spike and there will be burnt flux residue.

Printed Circuit Board Etching:


Etching is where the excess copper is removed to leave the individual tracks or traces as they are sometimes called Buckets, bubble tanks, and spray machines lots of different ways to etch, but most firms currently use high pressure conveyerised spray equipment. Spray etching is fast, ammoniacal etching solutions when sprayed can etch 55 microns of copper a minute. Less than 40 seconds to etch a standard 1 oz, 35 micron circuit board. Many different chemical solutions can be used to etch circuit boards. Ranging from slow controlled speed etches used for surface preparation to the faster etches used for etching the tracks. Some are best used in horizontal spray process equipment while others are best used in tanks. Etchants for PTH work have to be selective and be non aggressive to tin / tin lead plating, which is used as the etch resist. Copper etching is normally exothermic, where high speed etching is carried out solution cooling is normally required. This is normally done by placing titanium water cooling coils into the etchant. Almost all etching solutions liberate toxic corrosive fumes, extraction is highly recommended. All etchants are corrosive and toxic, mainly due to the high metal content. P.P.E. Personal Protection Equipment must always be used, spent solutions should always be disposed of properly and not down local drains, where they pollute local sewage works and rivers. Ferric Chloride: An old favorite, also very good at staining fingers, clothing, etc brown. Etch rate can be very high but is dependent on solution movement over the surface of the board and temperature. At 70C using Spray etching 1oz copper is removed in a little under a minute, normal etching temperature is more likely to be 45C. When etching circuits if up to 5% of HCL is added it, increases etch rate, helps to stop staining, and reduces the risk of the solution sludging. Ferric especially with extra HCL makes a very good stainless steel etchant. When Ferric crystals are mixed with water some free HCL produced through hydrolysis.

FeCl3 + 3H2O > Fe(OH)3 + 3HCL The basic etching reaction takes place in 3 stages. First the ferric ion oxidizes copper to cuprous chloride, which is then further oxidized to cupric chloride. FeCl3 + Cu > FeCl2 + CuCl FeCl3 + CuCl > FeCl2 + CuCl2 As the cupric chloride builds up at further reaction takes place, CuCl2 + Cu > 2CuCl The etch rate quickly falls off after about 17oz/gallon (100g/l of copper has been etched. For a typical solution containing 5.3lb/gallon (530g/l) of ferric chloride. PCB Etching Since the introduction of laser printers making your own PCBs (Printed Circuit Boards) has become fairly easy. The method described here assumes you want to make a PCB from an electronics magazine PCB layout - so you can copy it with a copier - or you are able to print your own PCB layouts from a PCB design package or have them available in electronic format and you can print them with a laser printer. I am using the described method below successfully since 1996. I was forced to find an etching method to be used at home after the company I worked for dumped their prototype PCB production tools. A short version of the `greasy' etching method has been published August 2000 in the newsletter `Vijgeblaadje' from the Dutch FIG (HCC Forth gebruikersgroep).

PCB Layout PCB Preparation PCB UV Exposure PCB Development PCB Etching Trouble shooting More Examples

PCB Layout The PCB layout is a mirrored positive one - black on white. Mirrored as viewed from the silkscreen top (component) side. The PCB layout is printed 1:1 on paper by means of a laser printer or copier machine. The laser printer or copier toner will not run out when it gets wet or oily. The ink of an inkjet paper print does run out and inkjet printers are therefore useless with the described method.

I have used several types of HP laser printers (LaserJet Series II, 5L, 4000 and 1100). These printers work fine. It might be possible that the toner texture on the layout prints from your used laser printer is not dense enough and passes too much light. However, results might be improved by setting the tone density to maximum. Generally printer driver properties allow to set the toner density.

Positive mirrored (top view) layout Component (top view) layout

PCB Preparation The PCB layout paper is drenched with sunflower-seed oil. Sunflower-seed oil is common available from your local grocery or wall market. Superfluous oil should be removed carefully with tissue paper. The sunflower-seed oil is used to make the white part of the layout paper transparent for light. If you prefer to use the PCB layout more than once let the drenched PCB layout paper dry at least 48 hours. The layout paper should be carefully dried on forehand as much as possible with tissue paper. Sunflower-seed oil is a `drying' oil. Exposed to the air over a number of hours, the layout paper becomes rigid again. A kind of polymerization takes place. You will get a lot less or no greasy fingers anymore afterwards. Other mineral or vegetable oils might work as well to obtain light transparency. However, they might not be `drying' oils. When I started experimenting, sunflower-seed oil was the first oil I used and it worked fine. So I didn't try any other oils. Using water does not work. The layout paper crumples up a bit.

Drench layout with sunflower-seed oil

Layout fully drenched

Greasy layout PCB UV Exposure The protective plastic layer is removed - peeled back - from the photosensitive PCB. The toner side of the greased layout is placed on the copper of the PCB. Captured air-bubbles are gently pressed away from underneath the layout. The PCB with the layout is now covered with an appropriate sized windowpane and placed on a piece of plain polished tile or marble. The tile or marble absorbs the heat coming from the UV bulb, which is significant. Three to four minutes 300W bulb UV exposure from a distance of 30-40 cm will do the photo process. Take care when finished and removing the PCB, it gets hot!

PCB with partly peeled back protective plastic layer and `dried' layout

Home-built UV exposure box with 300W UV bulb, polished tile and window pane

Place layout with toner side on copper of the PCB

Cover PCB and layout with window-pane

Exposure

PCB Development The PCB is developed with a 1% solution of sodium hydroxide NaOH. You can make this solvent by adding 10 gram of sodium hydroxide pellets to 1 liter of water and mix it until everything is dissolved. Use a brush to speed up the developing and clean the PCB during this process if the PCB is still greasy due to the applied sunflower-seed oil. The developing process takes about 1 minute. It is sometimes difficult to guess when the developing is finished. The traces should become clear and the exposed photosensitive layer has dissolved (during the brushing you see darker `cloud' coming off the PCB surface).

Gently brush the PCB

Almost developed, some traces are not clear yet

PCB Etching The developed PCB is etched with a 220 g/l solution of ammonium peroxydisulfate (NH4)2S2O8 a.k.a. ammonium persulfate, 220 gram added to 1 liter of water and mix it until everything is dissolved. Theoretically it should be possible to etch slightly more than 60 grams of copper with 1 liter etching solution. Assume 50% efficiency, about 30 grams of copper. With a thickness of 35 m copper on your PCB this covers a copper area of about 1000 cm2. Unfortunately the efficiency of the etching solution degrades, dissolved ammonium peroxydisulfate decomposes slowly. You better make just enough etching solution you need to etch. For an etching tray of about 20 x 25 cm a minimum practical amount is 200-250 ml solution. So you dissolve about 44 grams ammonium peroxydisulfate into 200 ml or 55 grams into 250 ml water. Etching at ambient temperature might take over an hour, it is better to heat up the etching solvent to about 35-45 degrees Celsius. The etching solution heating up could be done in a magnetron, this takes about 40 to 60 seconds in a 850W magnetron depending on the initial temperature of the etching solution (hint: first try this with just water to determine the timer setting of the magnetron). The etching - rocking the etching tray - takes about 15-30 minutes at this temperature. If you have a heated, air-bubble circulated etching fluid tank available, this is probably the fastest way to etch. At higher temperatures the etching performance decreases. The etching process is an exothermic reaction, it generates heat. Take care; cool your etching tray when necessary! You should minimize the amount of copper to etch by creating copper area in

your PCB layout as much as possible. When starting the etching process and little to etch it is difficult to keep the etching solution at 35-45 degrees Celsius. It helps to fill for example the kitchen sink with warm water and rock the etching tray in the filled kitchen sink. When the ammonium peroxydisulfate is dissolved it is a clear liquid. After an etching procedure it gradually becomes blue and deeper blue - the chemical reaction creates dissolved copper sulfate CuSO4. Compared to other etching chemicals like hydrated iron (III) chloride FeCl3.6H2O a.k.a. ferric chloride or the combination of hydrochloric acid HCL and hydrogen peroxide H2O2, using ammonium peroxydisulfate is a clean and safe method. Did you ever spill dissolved iron chloride on your clothes or your assumed stainless steel kitchen sink? Do you really want to keep concentrated hydrochloric acid and hydrogen peroxide at home? So, without doubt ammonium peroxydisulfate is the best choice for etching at home. However, copper sulfate is a poisonous substance and should be treated as chemical waste.

Rock the etching tray

The epoxy of the PCB becomes visible

Almost finished

The etching solution colors slighty blue

Finished Trouble shooting The above mentioned exposure timing should be determined experimentally. But even when the exposure timing is correct PCB etching failures could happen because of low quality or too old

photosensitive PCB, the photosensitive layer has aged despite the protective plastic layer. Other possible causes are too high concentration of development solution causing the photosensitive part not exposed to light to be dissolved by the sodium hydroxide solution as well. When developing too short not all of the copper of the PCB will be etched. Developing might take some experimenting to get used to it and know what to expect. Furthermore set the toner density of your laser printer driver always to maximum. More examples

Exposure

Development

Etching

Finished

Software
INTRODUCTION TO KEIL
Keil MicroVision is an integrated development environment used to create software to be run on embedded systems (like a microcontroller). It allows for such software to be written either in assembly or C programming languages and for that software to be simulated on a computer before being loaded onto the microcontroller. Vision3 is an IDE (Integrated Development Environment) that helps write, compile, and debug embedded programs. It encapsulates the following components: A project manager. Make facility. Tool configuration Editor

A powerful debugger. TO CREATE A NEW PROJECT IN UVISION3:


1. Select Project - New Project.

2. 3. 4.

Select a directory and enter the name of the project file. Select Project = Select Device and select a device from Device Database. Create source files to add to the project

5. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and add the source files to the project. 6. Select Project - Options and set the tool options. Note that when the target device is selected from the Device Database all-special options are set automatically. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target.

To create a new project, simply start MicroVision and select Project=>New Project from the pull down menus. In the file dialog that appears, choose a name and directory for the project. It is recommended that a new directory be created for each project, as several files will be generated. Once the project has been named, the dialog shown in the figure below will appear, prompting the user to select a target device. In this lab, the chip being used is the AT89C52, which is listed under the heading Atmel. Window for choosing target device. Next, Micro Vision must be instructed to generate a HEX file upon program compilation. A HEX file is a standard file format for storing executable code that is to be loaded onto the microcontroller. In the Project Workspace pane at the left, right click on Target 1 and select Options for 1 .Under the Output tab of the resulting options dialog, ensure that both the Create Executable and Create HEX File options are checked. Then click OK. Project Options Dialog Next, a file must be added to the project that will contain the project code. To do this, expand the Target 1 heading, right click on the Source Group 1 folder, and select Add files. Create a new blank file (the file name should end in .asm), select it, and click Add. The new file should now appear in the Project Workspace pane under the Source Group 1 folder. Double-click on the newly created file to open it in the editor. All code for this lab will go in this file. To compile the program, first save all source files by clicking on the Save All button, and then click on the Rebuild All Target Files to compile the program as shown in the figure below. If any errors or warnings occur during compilation, they will be displayed in the output window at the bottom of the screen. All errors and warnings will reference the line and column number in which they occur along with a description of the problem so that they can be easily located. Note that only errors indicate that the compilation failed, warnings do not (though it is generally a good idea to look into them anyway).

Project Workspace Pane Save All and Build All Target Files Buttons When the program has been successfully compiled, it can be simulated using the integrated debugger in Keil MicroVision. To start the debugger, select Debug=>Start/Stop Debug Session from the pull down menus. At the left side of the debugger window, a table is displayed containing several key parameters about the simulated microcontroller, most notably the elapsed time (circled in the figure below). Just above that, there are several buttons that control code execution. The Run button will cause the program to run continuously until a breakpoint is reached, whereas the Step Into button will execute the next line of code and then pause (the current position in the program is indicated by a yellow arrow to the left of the code). Fig 6.5: Vision3 Debugger window

PROGRAMMER
The programmer used is a powerful programmer for the Atmel 89 series of microcontrollers that includes 89C51/52/55, 89S51/52/55 and many more. It is simple to use & low cost, yet powerful flash microcontroller programmer for the Atmel 89 series. It will Program, Read and Verify Code Data, Write Lock Bits, Erase and Blank Check. All fuse and lock bits are programmable. This programmer has intelligent onboard firmware and connects to the serial port. It can be used with any type of computer and requires no special hardware. All that is needed is a serial communication port which all computers have. All devices also have a number of lock bits to provide various levels of software and programming protection. These lock bits are fully programmable using this programmer. Locks bits are useful to protect the program to be read back from microcontroller only allowing erase to reprogram the microcontroller. Major parts of this programmer are Serial Port, Power Supply and Firmware microcontroller. Serial data is sent and received from 9 pin connector and converted to/from TTL logic/RS232 signal levels by MAX232 chip. A Male to Female serial port cable, connects to the 9 pin connector of hardware and another side connects to back of computer. All the programming intelligence is built into the programmer so you do not need any special hardware to run it. Programmer comes with window based software for easy programming of the devices.

Reference
The 8051Microcontroller by Kenneth J. Ayala The 8051 Microcontroller and Embedded Systems by Muhammad Ali Mazidi. www.vedrobotics.co.in www.datasheetarchive.com www.alldatasheet.com www.answers.com www.google.com