Anda di halaman 1dari 38

PROFILE OF THE COMPANY

SOFCON INDIA PVT LTD Training Wing of Sofcon Group imparts practical Training to Fresh Engineers / Working Professionals / Technicians on:

PLC : Allen Bradley, Siemens, Modicon, Mitsubishi, GE Fanuc, Omron... SCADA/HMI : Wonderware, RS View, Win CC, Intellution, Panel View Variable Frequency Drives : Power Flux, Altivar, Danfoss, ABB, Siemens Motion Control, Stepper/Servo Drives DCS: ABB AC 700F, Hollysys SM 202 Process Instrumentation, Panel Designing & AutoCad Industrial Networking (Ethernet, ControlNet, DeviceNet, Modbus, Profibus, Fieldbus) Embedded Systems Training: 8051 Micro Controller, Embedded C, Hardware Interfacing

Assembly Language Programming, AVR, Robotics Programming & Projects Summer / Winter / Project Training with project Guidance for II/III/Final year Engineering/Diploma Students

Customized Training for plants/industries as per customer requirement Soft skill development & Interview Preparation

SOFCON is professionally run by technocrats having decades of experience in Training / process / manufacturing industry.

Sofcon a Group of 05 companies. Trained 15000+ Engineers & expats, 150+ In-plant Training/ Corporate batches &200+ In-campus Training/College batches at Engineering/Diploma colleges.

Placement tie-up with leading automation service providers, process/manufacturing, Electronics industries.
1

INTRODUCTION TO EMBEDDED SYSTEMS


A n E m b e d d e d S y s t e m e m p l o ys a c o m b i n a t i o n o f h a r d w a r e & s o f t w a r e to perform a specific function and part of a larger system that may c o m p u t e r w o r k s i n a r e a c t i v e a n d t i m e - c o n s t r a i n e d environment. Software is used for providing features and flexibility and Hardware is used for performance & sometimes security. An embedded system is a computer system designed for specific control functions within a larger system, often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range of end-user needs. Embedded systems control many devices in common use today.

Embedded systems contain processing cores that are typically either microcontrollers or digital signal processors (DSP). The key characteristic, however, is being dedicated to handle a particular task. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights,factory controllers, or the systems controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. An embedded system is some combination of computer hardware and software, either fixed in capability or programmable, that is specifically designed for a particular function. Industrial machines, automobiles, medical equipment, cameras, household appliances, airplanes, vending machines and toys (as well as the more obvious cellular phone and PDA) are among the myriad possible hosts of an embedded system. Embedded systems that are programmable are provided with programming interfaces, and embedded systems programming is a specialized

occupation.
Characteristics of Embedded Systems: 1. Embedded systems are designed to do some specific task, rather than be a general-purpose computer for multiple tasks. Some also have real-time performance constraints that must be met, for reasons such as safety and usability; others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs.

2. Embedded systems are not always standalone devices. Many embedded systems consist of small, computerized parts within a larger device that serves a more general purpose. 3. The program instructions written for embedded systems are referred to as firmware, and are stored in read-only memory or Flash memory chips. They run with limited computer hardware resources: little memory, small or non-existent keyboard and/or screen. Microcontrollers are widely used in Embedded System products. An Embedded product uses the microprocessor (or microcontroller) to do one task & one task only. A printer is an example of embedded system since the processor inside it performs one task only namely getting the data and printing it. Contrast this with Pentium based PC. A PC can be used for any no. of applications such as word processor, print server, bank teller terminal, video game player, network server or internet terminal. Software for variety of applications can be loaded and run. Of course the reason a PC can perform multiple task is that it has RAM memory and an operating system that loads the application software into RAM & lets the CPU run it. In an Embedded system there is only one application software that is typically burn into ROM. An x86PC contain various Embedded Products such as keyboard, printer, modem, Disc controller, Soundc a r d , C D - R o m D r i v e r , M o u s e & s o o n . E a c h o n e o f t h e s e p e r i p h e r a l s a s a microcontroller inside it that performs only one task. For example inside every mouse there is microcontroller to perform the task of finding the mouse position and sending it to PC. Although microcontroller are preferred choice for many Embedded systems.There are times that a microcontroller is inadequate for the task. For this reason in recent years many manufactures of general purpose microprocessors such as INTEL, Motorolla, AMD & Cyrix have targeted their microprocessors for the high end of Embedded market. While INTEL, AMD, Cyrix push their x86 processors for both the embedded and desktop pc market, Motorolla is determined to keep the 68000 families alive by targeting it mainly for high end of embedded system.

One of the most critical needs of the embedded system is to decrease power consumptions and space. This can be achieved by integrating more functions into the CPU chips. All the embedded processors based on the x86 and 680x0have low power consumptions in additions to some forms of I/O, Com port & ROM all on a single chip. In higher performance Embedded system the trend isto integrate more & more function on the CPU chip & let the designer decide which feature he/she wants to us. Examples Of Embedded System: Automated teller machines (ATMS). A v i o n i c , s u c h a s i n e r t i a l g u i d a n c e s ys t e m s , f l i g h t c o n t r o l h a r d w a r e / software and letter integrated system in aircraft and missile. Cellular telephones and telephonic switches. Computer network equipment, including routers timeservers and firewalls Computer printers, Copiers.
3

Disk drives (floppy disk drive and hard disk drive) Engine controllers and antilock brake controllers for automobiles. Home automation products like thermostat, air conditioners sprinkles and security monitoring system. Household appliances including microwave ovens, washing machines, TV sets ,DVD players/recorders. Medical equipment. Measurement equipment such as digital storage oscilloscopes, logic analyzers and spectrum analyzers. Multimedia appliances: internet radio receivers, TV set top boxes. Personal digital assistants (PDAs), i.e., small hand held computer with P1M5 and other applications. Programmable logic controllers (PLCs) for industrial automation and monitoring. Stationary video game controllers. Wearable computers.

MICROPROCESSOR VS MICROCONTROLLERS
Products using microprocessors generally fall into two categories. The first category uses highperformance microprocessors such as the Pentium in application where system performance is critical.Howeverthe second category of application s i n w h i c h , performance is secondary; issues of power, space and rapid development are more critical than raw processing power. The microprocessors for this category are often called a microcontroller. MICROCONTROLLERS (MCU) The design of a typical microcontroller, which is a true computer on a chip, incorporates all of the features found in micro-processor CPU: ALU, PC, SP, and registers. It also added the other features needed to make a complete computer: ROM, RAM, parallel I/O, serial I/O, counters, and clock circuit. MICROPROCESSOR (MPU) A microprocessor is a general-purpose digital computer central processing unit (CPU). Although popularly known as a computer on a chip is in no sense a complete digital computer.

Basic Electronic Components Capacitors:


Its function is to store electric charge. They are used with resistors in timing circuits because it takes time for a capacitor to fill with charge. They are used to smooth varying DC supplies by acting as a reservoir of charge. They are also used in filter circuits because capacitors easily pass AC (changing) signals but they block DC (constant) signals.
4

Capacitance This is a measure of a capacitor's ability to store charge. A large capacitance means that more charge can be stored. Capacitance is measured in farads, symbol F. However 1F is very large, so prefixes are used to show the smaller values.Three prefixes (multipliers) are used, (micro), n (nano) and p (pico):

means 10-6 (millionth), so 1000000F = 1F n means 10-9 (thousand-millionth), so 1000nF = 1F p means 10-12 (million-millionth), so 1000pF = 1nF split into two

There are many types of capacitor but they can be groups, polarised and unpolarised. Each group has its own circuit symbol. Polarized capacitors (large values, 1F +)

Examples:

Circuit symbol:

Electrolytic Capacitors Electrolytic capacitors are polarized and they must be connected the correct way round, at least one of their leads will be marked + or -. They are not damaged by heat when soldering. There are two designs of electrolytic capacitors; axial where the leads are attached to each end (220F in picture) and radial where both leads are at the same end (10F in picture). Radial capacitors tend to be a little smaller and they stand upright on the circuit board. It is easy to find the value of electrolytic capacitors because they are clearly printed with their capacitance and voltage rating. The voltage rating can be quite low (6V for example) and it should always be checked when selecting an electrolytic capacitor. If the project parts list does not specify a voltage, choose a capacitor with a rating which is greater than the project's power supply voltage. 25V is a sensible minimum for most battery circuits. Tantalum Bead Capacitors Tantalum bead capacitors are polarised and have low voltage ratings like electrolytic capacitors. They are expensive but very small, so they are used where a large capacitance is needed in a small size.

Modern tantalum bead capacitors are printed with their capacitance, voltage and polarity in full. However older ones use a colour-code system which has two stripes (for the two digits) and a spot of colour for the number of zeros to give the value in F. The standard colour code is used, but for the spot, grey is used to mean 0.01 and white means 0.1 so that values of less than 10F can be shown. A third colour stripe near the leads shows the voltage (yellow 6.3V, black 10V, green 16V, blue 20V, grey 25V, white 30V, pink 35V). The positive (+) lead is to the right when the spot is facing you: 'when the spot is in sight, the positive is to the right'. For example: blue, grey, black spot means 68F For example: blue, grey, white spot means 6.8F For example: blue, grey, grey spot means 0.68F

Unpolarised Capacitors (small values, up to 1F)

Examples:

Circuit symbol:

Small value capacitors are unpolarised and may be connected either way round. They are not damaged by heat when soldering, except for one unusual type (polystyrene). They have high voltage ratings of at least 50V, usually 250V or so. Many small value capacitors have their value printed but without a multiplier, so you need to use experience to work out what the multiplier should be For example 0.1 means 0.1F = 100nF. Capacitor Number Code A number code is often used on small capacitors where printing is difficult:

the 1st number is the 1st digit, the 2nd number is the 2nd digit, the 3rd number is the number of zeros to give the capacitance in pF. Ignore any letters - they just indicate tolerance and voltage rating.

For example: 102 means 1000pF = 1nF (not 102pF!) For example: 472J means 4700pF = 4.7nF (J means 5% tolerance).

Capacitor Colour Code

Colour Code

Colour Number A colour code was used on polyester capacitors for many years. It is now 0 obsolete, but of course there are many still around. The colours should be read Black like the resistor code, the top three colour bands giving the value in pF. Ignore Brown 1 the 4th band (tolerance) and 5th band (voltage rating). For example: brown, black, orange means 10000pF = 10nF = 0.01F. Note that there are no gaps between the colour bands, so 2 identical bands actually appear as a wide band.

Variable Capacitors

Variable capacitors are mostly used in radio tuning circuits and they are sometimes called 'tuning capacitors'. They have very small capacitance values, typically between 100pF and 500pF (100pF = 0.0001F). The type illustrated usually has trimmers built in (for making small adjustments - see below) as well as the main variable capacitor. Many variable capacitors have very short spindles which are not suitable for the standard knobs used for variable resistors and rotary switches. It would be wise to check that a suitable knob is available before ordering a variable capacitor. Variable capacitors are not normally used in timing circuits because their capacitance is too small to be practical and the range of values available is very limited. Instead timing circuits use a fixed capacitor and a variable resistor if it is necessary to vary the time period.

Red Orange Yellow Green Blue Violet Grey White

2 3 4 5 6 7 8 9

Variable Capacitor

Variable Capacitor Symbol

Resistor:

A resistor is a passive two terminal electrical component that implements electrical resistance as a circuit element. The current through a resistor is in direct proportion to the voltage across the resistor's terminals. Thus, the ratio of the voltage applied across a resistor's terminals to the intensity of current through the circuit is called resistance. This relation is represented by Ohm's law:

where I is the current through the conductor in units of amperes, V is the potential difference measured across the conductor in units of volts, and R is the resistance of the conductor in units of ohms. More specifically, Ohm's law states that the R in this relation is constant, independent of the current.

Variable Resistor:
A resistor may have one or more fixed tapping points so that the resistance can be changed by moving the connecting wires to different terminals. Some wirewound power resistors have a tapping point that can slide along the resistance element, allowing a larger or smaller part of the resistance to be used where continuous adjustment of the resistance value during operation of equipment is required, the sliding resistance tap can be connected to a knob accessible to an operator. Such a device is called a rheostat and has two terminals.

Transistors:
Transistors amplify current, for example they can be used to amplify the small output current from a logic IC so that it can operate a lamp, relay or other high current device. In many circuits a resistor is used to convert the changing current to a changing voltage, so the transistor is being used to amplify voltage.A transistor may be used as a switch (either fully on with maximum current, or fully off with no current) and as an amplifier(always partly on). Types of transistor There are two types of standard transistors, NPN and PNP, with different circuit symbols. The letters refer to the layers of semiconductor material used to make the transistor. Most transistors used today are NPN because this is the easiest type to make from silicon. If you are new to electronics it is best to start by learning how to use NPN transistors. Transistor circuit symbols The leads are labelled base (B), collector (C) and emitter (E). These terms refer to the internal operation of a transistor but they are not much help in understanding how a transistor is used, so just treat them as labels.

A Darlington pair is two transistors connected together to give a very high current gain. In addition to standard (bipolar junction) transistors, there are field-effect transistors which are usually referred to as FETs.

Diodes:
A diode is a two-terminal electronic component with asymmetric transfer characteristic, with low (ideally zero) resistance to current flow in one direction, and high (ideally infinite) resistance in the other. A semiconductor diode, the most common type today, is a crystalline piece of semiconductor material with a p-n junction connected to two electrical terminals. A vacuum tube diode, now rarely used except in some high-power technologies and by enthusiasts, is a vacuum tube with two electrodes, a plate (anode) and cathode. The most common function of a diode is to allow an electric current to pass in one direction (called the diode's forward direction), while blocking current in the opposite direction (the reverse direction). Thus, the diode can be viewed as an electronic version of a check valve. This unidirectional behavior is called rectification, and is used to convert alternating current to direct current, including extraction of modulation from radio signals in radio receiversthese diodes are forms of rectifiers. However, diodes can have more complicated behavior than this simple onoff action. Semiconductor diodes do not begin conducting electricity until a certain threshold voltage or cutIn voltage is present in the forward direction (a state in which the diode is said to be forwardbiased). The voltage drop across a forward-biased diode varies only a little with the current, and is a function of temperature; this effect can be used as a temperature sensor or voltage reference.

Types of Diodes: Photo Diode Light Emitting Diode

Photo Diode A Photo diode is a type of photo -detector capable of converting light into either current or voltage, depending upon the mode of operation. The common, traditional solar cell used to generate electric solar power is a large area photodiode. Photodiodes are similar to regular semiconductor diodes except that they may be either exposed (to detect vacuum UV or X-rays) or packaged with a window or optical fiber connection to allow light to reach the sensitive part of the device. Many diodes designed for use specifically as a photodiode use a PIN junction rather than a p-n junction, to increase the speed of response. A photodiode is designed to operate in reverse bias.

A photodiode is a p-n junction or PIN structure. When a photon of sufficient energy strikes the diode, it excites an electron, thereby creating a free electron (and a positively charged electron hole). This mechanism is also known as the inner photoelectric effect. If the absorption occurs in the junction's depletion region, or one diffusion length away from it, these carriers are swept from the junction by the built-in field of the depletion region. Thus holes move toward the anode, and electrons toward the cathode, and a photocurrent is produced. This photocurrent is the sum of both the dark current (without light) and the light current, so the dark current must be minimized to enhance the sensitivity of the device.

Light Emitting Diode

Example: Function

Circuit symbol:

LEDs emit light when an electric current passes through them. Connecting and soldering LEDs must be connected the correct way round, the diagram may be labelled a or + for anode and k or - for cathode (yes, it really is k, not c, for cathode!). The cathode is the short lead and there may be a slight flat on the body of round LEDs. If you can see inside the LED the cathode is the larger electrode (but this is not an official identification method). LEDs can be damaged by heat when soldering, but the risk is small unless you are very slow. No special precautions are needed for soldering most LEDs. Testing an LED Never connect an LED directly to a battery or power supply. It will be destroyed almost instantly because too much current will pass through and burn it out.

10

LEDs must have a resistor in series to limit the current to a safe value, for quick testing purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less. Colours of LEDs LEDs are available in red, orange, amber, yellow, green, blue and white. Blue and white LEDs are much more expensive than the other colours. The colour of an LED is determined by the semiconductor material, not by the colouring of the 'package' (the plastic body). LEDs of all colures are available in uncolored packages which may be diffused (milky) or clear. Pin connections of LED displays There are many types of LED display and a supplier's catalogue should be consulted for the pin connections. The diagram on the right shows an example from the Rapid Electronics catalogue. Like many 7-segment displays, this example is available in two versions: Common Anode (SA) with all the LED anodes connected together and Common Cathode (SC) with all the cathodes connected Pin connections diagram together. Letters a-g refer to the 7 segments, A/C is the common anode or cathode as appropriate (on 2 pins). Note that some pins are not present (NP) but their position is still numbered.

Light Dependent Resistor (LDR)


An LDR is an input transducer (sensor) which converts brightness (light) to resistance. It is made from cadmium sulphide (CdS) and the resistance decreases as the brightness of light falling on the LDR increases. Multimeter can be used to find the resistance in darkness and bright light, these are the typical results for a standard LDR:

Darkness: maximum resistance, about 1M . Very bright light: minimum resistance, about 100 .

11

For many years the standard LDR has been the ORP12, now the NORPS12, which is about 13mm diameter. Miniature LDRs are also available and their diameter is about 5mm. An LDR may be connected either way round and no special precautions are required when soldering.

Integrated Circuits (ICs)


An integrated circuit (also referred to as IC, chip, or microchip) is an electronic circuit manufactured by lithography, or the patterned diffusion of trace elements into the surface of a thin substrate of semiconductor material. Additional materials are deposited and patterned to form interconnections between semiconductor devices. Integrated circuit originally referred to a miniaturized electronic circuit consisting of semiconductor devices, as well as passive components bonded to a substrate or circuit board. Types of ICs 555 Timer IC 7805 L293D LM358

555 Timer
The 555 timer IC is an integrated circuit (chip) used in a variety of timer, pulse generation, and oscillator applications. The 555 can be used to provide time delays, as an oscillator, and as a flip-flop element. Derivatives provide up to four timing circuits in one package. The 555 timer is one of the most versatile ICs ever produced. It is a mixture of analogue and circuitry and its applications are virtually limitless in the world of digital pulse generation. It can be used for producing accurate time delays or oscillation. It can be used for applications such as precision timing, pulse generation, sequential timing, time delay generation and pulse width modulation (PWM). Depending on the manufacturer, the standard 555 package includes 25 transistors, 2 diodes and 15 resistors on a silicon chip installed in an 8-pin mini dual-in-line package (DIP-8).
12

Pin Description of 555 Timer

The eight pins carry out the following functions: 1. 2. 3. 4. 5. Ground, which acts as a safety measure as with electrical plugs. Trigger, which passes on voltage to start the timing operations. Output, which carries voltage to the device using the timer. Reset, which is used to end the timing operation . Control voltage, an optional pin used for controlling the timer from outside the main circuit setup. 6. Threshold, which determines how long the timer should output voltage in each on/off cycle in other words, how long the timing interval should be. 7. Discharge, connected to a capacitor which also influences the timing interval. 8. V+, which is the voltage input. The 555 has three operating modes:Monostable mode: It is when the output signal simply switches between the default off position and a temporary on position at regular intervals; this is most commonly used for timers. Astable or Free running mode:It is when the output voltage rises and falls in a set pattern, making it an oscillator. As the pattern can be varied, it can be used for any purpose which requires a particular tone pattern. Bistable or Schmitt trigger:It is when the signal can be held in one of two positions, meaning the 555 timer can act as the smallest possible unit of computer memory.

13

IC 7805
7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides +5V regulated power supply. Capacitors of suitable values can be connected at input and output pins depending upon the respective voltage levels. Pin Description of IC 7805

Pin No 1 2 3

Function Input voltage (5V-18V) Ground (0V) Regulated output; 5V (4.8V-5.2V)

Name Input Ground Output

L293D
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers since they take a low-current control signal and provide a higher-current signal. This higher current signal is used to drive the motors. L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively.
14

Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input is high, the associated driver gets enabled. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state.

Pin Description of L293D

LM358
The LM358 series consists of two independent, high gain, internally frequency compensated operational amplifiers which were designed specifically to operate from a single power supply over a wide range of voltages. Operation from split power supplies is also possible and the low power supply current drain is independent of the magnitude of the power supply voltage. LM358 pin diagram

15

LM358 Features Available in 8-Bump micro SMD chip sized package, (See AN-1112) Internally frequency compensated for unity gain Large dc voltage gain: 100 dB Wide bandwidth (unity gain): 1 MHz (temperature compensated) Wide power supply range: Single supply: 3V to 32V or dual supplies: 1.5V to 16V Very low supply current drain (500 A)essentially independent of supply voltage Low input offset voltage: 2 mV Input common-mode voltage range includes ground Differential input voltage range equal to the power supply voltage Large output voltage swing

MICROCONTROLLERS
Definition of a Microcontroller Microcontroller, as the name suggests, are small controllers. They are like single chip computers that are often embedded into other systems to function as processing/controlling unit. For example, the remote control you are using probably has microcontrollers inside that do decoding and other controlling functions. They are also used in automobiles, washing machines, microwave ovens, toys ... etc, where automation is needed. The key features of microcontrollers include: High Integration of Functionality Microcontrollers sometimes are called single-chip computers because they have on-chip memory and I/O circuitry and other circuitries that enable them to function as small standalone computers without other supporting circuitry. Field Programmability, Flexibility Microcontrollers often use EEPROM or EPROM as their storage device to allow field programmability so they are flexible to use. Once the program is tested to be correct then large quantities of microcontrollers can be programmed to be used in embedded systems. Easy to Use 8051 Microcontroller Features:

4 Kb of ROM is not much at all. 128b of RAM (including SFRs) satisfies the user's basic needs.

16

4 ports having in total of 32 input/output lines are in most cases sufficient to make all necessary connections to peripheral environment.

Pin and Block Diagram of 8051

Pin-out Description 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. 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.
17

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 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. 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. Input/Output Ports (I/O Ports) 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 undetermined 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.

18

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 configured 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 terms of hardware, this port is similar to P0, with the difference that its pins have a pull-up resistor built-in. 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. 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 occupies addresses 2Fh-7Fh, i.e. 80 locations, and does not have any special functions or features.

19

Special Function Registers (SFRs) Special Function Registers (SFRs) are a sort of control table used for running and monitoring the operation of the microcontroller. Each of these registers as well as each bit they include, has its name, address in the scope of RAM and precisely defined purpose such as timer control, interrupt control, serial communication control etc.

20

Registers The Accumulator: The Accumulator, as its name suggests, is used as a general register to accumulate the results of a large number of instructions. It can hold an 8-bit (1-byte) value and is the most versatile register The "B" Register:The "B" register is very similar to the Accumulator in the sense that it may hold an 8-bit (1-byte) value. The "B" register is only used by two 8051 instructions: MUL AB and DIV AB. The Program Counter (PC):The Program Counter (PC) is a 2-byte address which tells the 8051 where the next instruction to execute is found in memory. When the 8051 is initialized PC always starts at 0000h and is incremented each time an instruction is executed. R Registers (R0-R7)

This is a common name for 8 general-purpose registers (R0, R1, R2 ...R7). Even though they are not true SFRs, they deserve to be discussed here because of their purpose. They occupy 4 banks within RAM. Similar to the accumulator, they are used for temporary storing variables and intermediate results during operation. Which one of these banks is to be active depends on two bits of the PSW Register. Active bank is a bank the registers of which are currently used. Program Status Word (PSW) Register: PSW register is one of the most important SFRs. It contains several status bits that reflect the current state of the CPU. Besides, this register contains Carry bit, Auxiliary Carry, two register bank select bits, Overflow flag, parity bit and userdefinable status flag.
21

P-Parity bit. If a number stored in the accumulator is even then this bit will be automatically set (1), otherwise it will be cleared (0). It is mainly used during data transmit and receive via serial communication. Bit 1. This bit is intended to be used in the future versions of microcontrollers. OV Overflow occurs when the result of an arithmetical operation is larger than 255 and cannot be stored in one register. Overflow condition causes the OV bit to be set (1). Otherwise, it will be cleared (0). RS0, RS1 - Register bank select bits. These two bits are used to select one of four register banks of RAM. By setting and clearing these bits, registers R0-R7 are stored in one of four banks of RAM. RS1 0 0 1 1 RS2 0 1 0 1 SPACE IN RAM Bank0 00h-07h Bank1 08h-0Fh Bank2 10h-17h Bank3 18h-1Fh

F0 - Flag 0. This is a general-purpose bit available for use. AC - Auxiliary Carry Flag is used for BCD operations only. CY - Carry Flag is the (ninth) auxiliary bit used for all arithmetical operations and shift instructions. Data Pointer Register (DPTR)- It consists of two separate registers: DPH (Data Pointer High) and (Data Pointer Low). For this reason it may be treated as a 16-bit register or as two independent 8-bit registers. Their 16 bits are primarily used for external memory addressing. Besides, the DPTR Register is usually used for storing data and intermediate results.

Stack Pointer (SP) Register:A value stored in the Stack Pointer points to the first free stack address and permits stack availability. Stack pushes increment the value in the Stack Pointer by 1. Likewise, stack pops decrement its value by 1. Upon any reset and power-on, the value 7 is stored in the Stack Pointer, which means that the space of RAM reserved for the stack starts at this location. If another value is written to this register, the entire Stack is moved to the new memory location.

22

Counters and Timers The 8051 microcontroller has 2 timers/counters called T0 and T1. As their names suggest, their main purpose is to measure time and count external events. Besides, they can be used for generating clock pulses to be used in serial communication, so called Baud Rate. Timer T0 As seen in figure below, the timer T0 consists of two registers TH0 and TL0 representing a low and a high byte of one 16-digit binary number.

TMOD Register (Timer Mode) The TMOD register selects the operational mode of the timers T0 and T1. As seen in figure below, the low 4 bits (bit0 - bit3) refer to the timer 0, while the high 4 bits (bit4 - bit7) refer to the timer 1. There are 4 operational modes and each of them is described herein.

Bits of this register have the following function:

GATE1 enables and disables Timer 1 by means of a signal brought to the INT1 pin (P3.3): o 1 - Timer 1 operates only if the INT1 bit is set. o 0 - Timer 1 operates regardless of the logic state of the INT1 bit. C/T1 selects pulses to be counted up by the timer/counter 1: o 1 - Timer counts pulses brought to the T1 pin (P3.5). o 0 - Timer counts pulses from internal oscillator. T1M1, T1M0 These two bits select the operational mode of the Timer 1. T1M1 0 T1M0 0 MODE 0 DESCRIPTION 13-bit timer

23

0 1 1

1 0 1

1 2 3

16-bit timer 8-bit auto-reload Split mode

GATE0 enables and disables Timer 1 using a signal brought to the INT0 pin (P3.2): 1 - Timer 0 operates only if the INT0 bit is set. 0 - Timer 0 operates regardless of the logic state of the INT0 bit. C/T0 selects pulses to be counted up by the timer/counter 0: o 1 - Timer counts pulses brought to the T0 pin (P3.4). o 0 - Timer counts pulses from internal oscillator. T0M1, T0M0 These two bits select the operational mode of the Timer 0.
o o
T0M1 0 0 1 1 T0M0 0 1 0 1 MODE 0 1 2 3 DESCRIPTION 13-bit timer 16-bit timer 8-bit auto-reload Split mode

Timer 0 in mode 0 (13-bit timer):This mode configures timer 0 as a 13-bit timer which consists of all 8 bits of TH0 and the lower 5 bits of TL0. As a result, the Timer 0 uses only 13 of 16 bits. Timer 0 in mode 1 (16-bit timer):Mode 1 configures timer 0 as a 16-bit timer comprising all the bits of both registers TH0 and TL0. That's why this is one of the most commonly used modes. Timer operates in the same way as in mode 0, with difference that the registers count up to 65 536 as allowable by the 16 bits. Timer 0 in mode 2 (Auto-Reload Timer):Mode 2 configures timer 0 as an 8-bit timer. Actually, timer 0 uses only one 8-bit register for counting and never counts from 0, but from an arbitrary value (0-255) stored in another (TH0) register. Timer 0 in Mode 3 (Split Timer):Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8-bit timers. In other words, the 16-bit timer consisting of two registers TH0 and TL0 is split into two independent 8-bit timers. This mode is provided for applications requiring an additional 8-bit timer or counter. The TL0 timer turns into timer 0, while the TH0 timer turns into timer 1. In addition, all the control bits of 16-bit Timer 1 (consisting of the TH1 and TL1 register), now control the 8-bit Timer 1. Even though the 16-bit Timer 1 can still be configured to operate in any of modes (mode 1, 2 or 3), it is no longer possible to disable it as there is no control bit to do it. Thus, its operation is restricted when timer 0 is in mode 3.

24

Timer Control (TCON) Register: TCON register is also one of the registers whose bits are directly in control of timer operation. Only 4 bits of this register are used for this purpose, while rest of them is used for interrupt control to be discussed later.

TF1 bit is automatically set on the Timer 1 overflow. TR1 bit enables the Timer 1. o 1 - Timer 1 is enabled. o 0 - Timer 1 is disabled. TF0 bit is automatically set on the Timer 0 overflow. TR0 bit enables the timer 0. o 1 - Timer 0 is enabled. o 0 - Timer 0 is disabled.

Liquid Crystal Display (LCD)


A liquid crystal display (LCD) is a flat panel display, electronic visual display, or video display that uses the light modulating properties of liquid crystals. Liquid crystals do not emit light directly .LCDs are available to display arbitrary images (as in a general-purpose computer display) or fixed images which can be displayed or hidden, such as preset words, digits, and 7segment displays as in a digital clock. LCDs are used in a wide range of applications including computer monitors, televisions, instrument panels, aircraft cockpit displays, and signage. They are common in consumer devices such as video players, gaming devices, clocks, watches, calculators, and telephones etc

Stepper Motor
A stepper motor (or step motor) is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor's position can then be commanded to move and hold at one of these steps without any feedback sensor (an open-loop controller), as long as the motor is carefully sized to the application.

25

Stepper motors are constant power devices Stepper motors with higher inductance coils provide greater torque at low speeds and lower torque at high speeds compared to stepper motors with lower inductance coils.

Direct Current (DC) motor


A direct current (DC) motor is a fairly simple electric motor that uses electricity and a magnetic field to produce torque, which turns the motor. At its most simple, a DC motor requires two magnets of opposite polarity and an electric coil, which acts as an electromagnet. The repellent and attractive electromagnetic forces of the magnets provide the torque that causes the DC motor to turn.

A DC motor requires at least one electromagnet. This electromagnet switches the current flow as the motor turns, changing its polarity to keep the motor running. The other magnet or magnets can either be permanent magnets or other electromagnets. Often, the electromagnet is located in the center of the motor and turns within the permanent magnets, but this arrangement is not necessary.

Seven-Segment Display
A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dotmatrix displays. Seven-segment displays are widely used in digital clocks, electronic meters, and other electronic devices for displaying numerical information.

In a simple LED package, typically all of the cathodes (negative terminals) or all of the anodes (positive terminals) of the segment LEDs are connected and brought out to a common pin; this is referred to as a "common cathode" or
26

"common anode" device. Hence a 7 segment plus decimal point package will only require nine pins (though commercial products typically contain more pins, and/or spaces where pins would go, in order to match industry standard pinouts).

Interfacing with 8051 Microcontroller.


Interfacing LCD with 8051 Microcontroller. LCD display is an inevitable part in almost all embedded projects and this article is about interfacing 162 LCD with 8051 microcontroller.

The circuit diagram given above shows how to interface a 162 LCD module with AT89C51 microcontroller. Capacitor C3, resistor R3 and push button switch S1 forms the reset circuitry. Ceramic capacitors C1, C2 and crystal X1 is related to the clock circuitry which produces the system clock frequency. P1.0 to P1.7 pins of the microcontroller is connected to the DB0 to DB7 pins of the module respectively and through this route the data goes to the LCD module. P3.3, P3.4 and P3.5 are connected to the E, R/W, RS pins of the microcontroller and through this route the control signals are transferred to the LCD module. Resistor R1 limits the current through the back light LED and so do the back light intensity. POT R2 is used for adjusting the contrast of the display.

27

Interfacing DC Motor with 8051 Microcontroller This article shows how to interface a DC motor to an 8051 microcontroller. Interfacing DC motor to 8051 forms an essential part in designing embedded robotic projects. A well designed 8051-DC motor system has essentially two parts. Firstly an 8051 with the required software to control the motor and secondly a suitable driver circuit.

In the circuit components R1, S1 and C3 forms a debouncing reset circuitry. C1, C2 and X1 are related to the oscillator. Port pins P1.0 and P1.1 are connected to the corresponding input pins of the L293D motor driver. The motor is connected across output pins 3 and 6 of the L293D. The software is so written that the logic combinations of P1.0 and P1.1 control the direction of the motor. Initially when power is switched ON, P1.0 will be high and P1.1 will be low. This condition is maintained for a preset amount of time (around 1S) and for this time the motor will be running in the clockwise direction (refers the function table of L293D). Then the logic of P1.0 and P1.1 are swapped and this condition is also maintained for the same duration. This makes the motor to run in the anti clockwise direction for the same duration and the entire cycle is repeated. Interfacing Seven Segment Display with 8051 Microcontroller This article is about how to interface a seven segment LED display to an 8051 microcontroller. 7 segment LED display is very popular and it can display digits from 0 to 9 and quite a few

28

characters like A, b, C, ., H, E, e, F, n, o,t,u,y, etc. Knowledge about how to interface a seven segment display to a micro controller is very essential in designing embedded systems.

The circuit diagram shown above is of an AT89C51 microcontroller based 0 to 9 counter which has a 7 segment LED display interfaced to it in order to display the count. This simple circuit illustrates two things. How to setup simple 0 to 9 up counter using 8051 and more importantly how to interface a seven segment LED display to 8051 in order to display a particular result. The common cathode seven segment display D1 is connected to the Port 1 of the microcontroller (AT89S51) as shown in the circuit diagram. R3 to R10 are current limiting resistors. S3 is the reset switch and R2, C3 forms a debouncing circuitry. C1, C2 and X1 are related to the clock circuit.

Interfacing LED with 8051 Microcontroller LEDs are connected to the port P0. LEDs need approximately 10mA current to flow through them in order to glow at maximum intensity. However the output of the controller is not sufficient enough to drive the LEDs, so if the positive leg of the LED is connected to the pin and the negative to ground as shown in the figure, the LED will not glow at full illumination

29

. To overcome this problem LEDs are connected in the reverse order and they run on negative logic i.e., whenever 1 is given on any pin of the port, the LED will switch off and when logic 0 is provided the LED will glow at full intensity. As soon as we provide supply to the controller, the LEDs start blinking i.e., they become on for a certain time duration and then become off for the same time duration. This delay is provided by calling the delay function. The values inside the delay function have been set to provide a delay in multiples of millisecond (delay (100) will provide a delay of 100 milliseconds. Interfacing Stepper Motor with 8051 Microcontroller To cause the stepper to rotate, we have to send a pulse to each coil in turn. The 8051 does not have sufficient drive capability on its output to drive each coil, so there are a number of ways to drive a stepper. Stepper motors are usually controlled by transistor or driver IC like ULN2003.

30

Driving current for each coil is then needed about 60mA at +5V supply. A Darlington transistor array, ULN2003 is used to increase driving capacity of the 2051 chip. Four 4.7k resistors help the 2051 to provide more sourcing current from the +5V supply.

Programming
8 LEDs are connected at port 1. WAP to glow all LEDs in a pattern with delay. #include<reg51.h> #define LED P1 void delay(unsigned int); void main() { LED=0x00; while(1) { LED=0xFF; delay(20); LED=0x00; delay(20); } } void delay(unsigned int time) { Unsigned int i,j; for(i=0;i<time<i++) for(j=0;j<1275;j++); }

A switch is connected at P1.1 and an LED at P2.5. WAP to glow LED when switch is pressed. #include<reg51.h> sbit SWITCH=P1^1; sbit LED=P2^5; void main() {
31

SWITCH=1; LED=0; if(SWITCH==0) LED=1; else LED=0; } One Switch is connected at P1.0 and second Switch at P 1.1 and a 7 Segment display is connected at Port 3. WAP to display 0 on 7 Segment display when First switch is pressed and display 1 when second switch is pressed. #include<reg51.h> #define DISPLAY P3 Sbit s0=P1^0; Sbit s1=P1^1; void main() { DISPLAY=0x00; S0=0; S1=1; While(1) { If(s0==1) DISPLAY=0xC0; Else if(s1==1) DISPLAY=0xF9; } } Now let us write a program that will display 'NEHA' on LCD. #include<reg51.h> #define LCD P1 sbit rs=P2^0; sbit rw=P2^1; sbit en=P2^2; void init(); void lcddat(unsigned char); void cmd(unsigned char);
32

void delay(unsigned int); void main() { init(); lcddat(N); lcddat(E); lcddat(H); lcddat(A); while(1); } void init() { cmd(0x01); delay(10); cmd(0x06); delay(10); cmd(0x38); delay(10); cmd(0x0e); delay(10); cmd(0x80); delay(10); } void lcddat(unsigned char n) {

33

LCD=n; rs=1; rw=0; en=1; delay(10); en=0; } void cmd(unsigned char m) { LCD=m; rs=0; rw=0; en=1; delay(10); en=0; } void delay(unsigned int x) { unsigned int I,j; for(i=0;i<x;i++) for(j=0;j<1275;j++); }

34

INTRODUCTION TO AVR
The AVR is a modified Harvard architecture 8-bit RISC single chip microcontroller which was developed by Atmel in 1996. The AVR was one of the first microcontroller families to use onchip flash memory for program storage, as opposed to one-time programmable ROM, EPROM, or EEPROM used by other microcontrollers at the time.

Atmel ATmega8 In AVR program and data are stored in separate physical memory systems that appear in different address spaces, but having the ability to read data items from program memory using special instructions. BASIC FAMILIES AVRs are generally classified into six broad groups:

tinyAVR the ATtiny series


0.516 kB program memory 632-pin package Limited peripheral set

megaAVR the ATmega series


4256 kB program memory 28100-pin package Extended instruction set (Multiply instructions and instructions for handling larger program memories)

Extensive peripheral set


35

Application-specific AVR

megaAVRs with special features not found on the other members of the AVR family, such as LCD controller, USB controller, advanced PWM, CAN etc.

ATmega8

Pin Diagram & Pin Description of ATmega8 FEATURES OF ATmega8: 8- bit microcontroller. 28 pin IC. Developed in 1996 by Atmel Corporation. Execute most of the instruction in one clock pulse. RISC based & Harvard based architecture. 2 timers of 8 bit and one of 16 bit. ROM=8 KB EPROM=512 KB RAM=1 KB
36

CONCLUSION
An engineer must have a good practical as well as theoretical knowledge. He must be technically sound as book knowledge is incomplete. The technical training was an educative as well as interactive. We learned how to make the people learn. Technical lectures presented by the professional technicians on Embedded Systems and Embedded C were really interesting and healthy to learn the industrial trends. Practical Training is a true platform to initiate the step towards professionalism in an engineers life. I am thankful to all the faculty members and Principal for supporting my work and for providing a right track.

37

REFERENCES
1. THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEM b y Muhammad Ali Mazidi, Janice Ali Mazidi, Rolin D. Mckinley 2. www.wikipedia.org 3. http://www.projects-forum.com/Thread-EMBEDDED-SYSTEMS-full-report-doc-1-12845 4. http://iprojectreports.blogspot.in/2011/02/project-report-on-embedded-systems.html 5. http://fbadhusha.weebly.com/uploads/3/8/9/5/3895546/elr_embedded-system.pdf 6. http://www.scribd.com/doc/15058835/project-report-on-embedded-system

38

Anda mungkin juga menyukai