Beruflich Dokumente
Kultur Dokumente
1 INTRODUCTION:
Embedded systems are by far the most prevalent of all electronic and computer systems used in world today. Advances in processors, controllers and memory technology and their associated low cost allow them to be considered for an enormous number of applications that led in tremendous growth in the size and sophistication of embedded applications. In present days embedded systems got great benefits in the Application of micro controllers and microprocessors. In simple words one can define embedded system as a processor that is embedded into the application. An embedded system product uses a micro controller (or microprocessor) to do one and only one task. Due to this reason embedded system is also called as dedicated system. Micro controller is concerned with rapid movement of bits within the chip. The micro controller can function as a computer with the addition of no external digital parts. The first task faced when learning to use a new computer is to become familiar with the capability of the machine. Studying the internal hardware design best learns the features of the computer also called as the architecture of the device. Embedded systems generally are developed around custom hardware, require high quality and reliability and frequently deal with real-time issues. Examples of these systems include telecommunication-switching systems, aircrafts, spacecraft, weapons systems, real-time systems, and the multitude of applications in the car and home.
1.2. CHARACTERISTICS:
Two major areas of differences are cost and power consumption. Since many embedded systems are produced in tens of thousands to millions of units range, reducing cost is a major concern. Embedded systems often use a (relatively) slow processor and small memory size to minimize costs. The slowness is not just clock speed. The whole architecture of the computer is often intentionally simplified to lower costs. For example, embedded systems often use peripherals controlled by synchronous serial interfaces, which are ten to hundreds of times slower than comparable peripherals used in PCs. Programs on an embedded system often run with realtime constraints with limited hardware resources: often there is no disk drive, operating system, keyboard or screen. A flash drive may replace rotating media, and a small keypad and LCD screen may be used instead of a PC's keyboard and screen. 1
Firmware is the name for software that is embedded in hardware devices, e.g. in one or more ROM/Flash memory IC chips. Embedded systems are routinely expected to maintain 100% reliability while running continuously for long periods, sometimes measured in years. Firmware is usually developed and tested too much harsher requirements than is general-purpose software, which can usually be easily restarted if a problem occurs.
Platform: There are many different CPU architectures used in embedded designs. This in
contrast to the desktop computer market which is limited to just a few competing architectures mainly the Intel/AMD x86 and the Apple/Motorola/IBM Power PCs which are used in the Apple Macintosh. One common configuration for embedded systems is the system on a chip, an application-specific integrated circuit, for which the CPU was purchased as intellectual property to add to the IC's design.
Tools: Like a typical computer programmer, embedded system designers use compilers,
assemblers and debuggers to develop an embedded system. Those software tools can come from several sources: Software companies that specialize in the embedded market Ported from the GNU software development tools. Sometimes, development tools for a personal computer can be used if the embedded processor is a close relative to a common PC processor. Embedded system designers also use a few software tools rarely used by typical computer programmers. Some designers keep a utility program to turn data files into code, so that they can include any kind of data in a program. Most designers also have utility programs to add a checksum or CRC to a program, so it can check its program data before executing it.
Operating system: They often have no operating system, or a specialized embedded operating
system (often a real-time operating system), or the programmer is assigned to port one of these to the new system.
about design priorities and acceptable methods. Mentoring, code-reviews and ego less programming are recommended.
1.3.1. START-UP:
All embedded systems have start-up code. Usually it disables interrupts, sets up the electronics, tests the computer (RAM, CPU and software), and then starts the application code. Many embedded systems recover from short-term power failures by restarting (without recent self-tests). Restart times under a tenth of a second are common. Many designers have found one of more hardware plus software-controlled LEDs useful to indicate errors during development (and in some instances, after product release, to produce troubleshooting diagnostics). A common scheme is to have the electronics turn off the LED(s) at reset, whereupon the software turns it on at the first opportunity, to prove that the hardware and start-up software have performed their job so far. After that, the software blinks the LED(s) or sets up light patterns during normal operation, to indicate program execution progress and/or errors. This serves to reassure most technicians/engineers and some users.
Many designers recommend reading each IO device once per loop, and storing the result so the logic acts on consistent values. Many designers prefer to design their state machines to check only one or two things per state. Usually this is a hardware event, and a software timer. Designers recommend that hierarchical state machines should run the lower-level state machines before the higher, so the higher run with accurate information. Complex functions like internal combustion controls are often handled with multi-dimensional tables. Instead of complex calculations, the code looks up the values. The software can interpolate between entries, to keep the tables small and cheap. One major disadvantage of this system is that it does not guarantee a time to respond to any particular hardware event. Careful coding can easily assure that nothing disables interrupts for long. Thus interrupt code can run at very precise timings. Another major weakness of this system is that it can become complex to add new features. Algorithms that take a long time to run must be carefully broken down so only a little piece gets done each time through the main loop.This system's strength is its simplicity, and on small pieces of software the loop is usually so fast that nobody cares that it is not predictable. Another advantage is that this system guarantees that the software will run. There is no mysterious operating system to blame for bad behavior.
general-purpose screen-based interfaces is the two menu buttons and a line of text in the user's native language. It's used in pagers, medium-priced printers, network switches, and other medium-priced situations that require complex behavior from users. When there's text, there are languages. The default language should be the one most widely understood.
2.1.2. FEATURES:
80C51 Central Processing Unit On-chip FLASH Program Memory Speed up to 33 MHz Full static operation RAM expandable externally to 64 k bytes 4 level priority interrupt 6 interrupt sources 5
Four 8-bit I/O ports Full-duplex enhanced UART Framing error detection Automatic address recognition Power control modes Clock can be stopped and resumed Idle mode Power down mode Programmable clock out Second DPTR register Asynchronous port reset Low EMI (inhibit ALE) 3 16-bit timers Wake up from power down by an external interrupt
Figure 2.1.2-2 Block diagram of Micro Controller PIN 40 Power supply, 5v from voltage regulator to drive the IC. PIN 20 Ground Point. Port 0: Port 0 is an 8-bit open-drain bi-directional I/O port as shown in figure 2.1.2-2. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high- impedance inputs. Port0 may also be configured to be the multiplexed loworder address/data bus during accesses to external pro gram and data memory. In this mode P0 has internal pull-ups. Port0 also receives the code bytes during flash programming, and 8
Port 1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification. Port 2: Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port2 also receives the high- order address bits and some control signals during flash programming and verification. Port 3: Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89C51 as listed. Port3 also receives some Control signals for Flash pro gramming and verification. Port Pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Alternate Functions RXD (serial input port) TXD (serial output port) INT0 (external interrupt 0) INT1 (external interrupt 1) T0 (timer 0 external input). T1 (timer 1 external input). WR (external data memory write strobe). RD (external data memory read strobe).
Here we use Port 0 as Input Port and Port 2 as Output Port and Port 3.4 as Interrupt Port RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the 9
device. ALE/PROG Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE is skipped during each access to external Data pulse Memory. If desired, ALE operation can be weakly pulled high. Setting the ALE
disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is disable bit has no effect if the microcontroller is in external execution mode. PSEN Program Store Enable is the read strobe to external pro gram memory. When the AT89C51 is executing code from external pro gram memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP External access enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. strapped to V for internal program Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be
CC
executions. This pin also receives the 12-volt internal clock operating
programming enable voltage (VPP) during Flash programming, for parts that require 12-volt VPP. XTAL1 Input to the inverting oscillator amplifier and input to the circuit. XTAL2 Output from the inverting oscillator amplifier.
10
2.1.4. INTERRUPTS:
The AT89S52 has a total of five interrupt vectors: two external interrupts (INT0 and INT1), two timer interrupts (Timers 0 and 1), and the serial port interrupt. These interrupts are all shown in Table 2.1.4.Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in special Function register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. Note that table shows that bit positions IE.6 and IE.5 are unimplemented. User software should not write 1s to these bit positions, since they may be used in future PT89 products. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle.
0Timer 0 and 1: Timer 0 and Timer 1 in the P89S51 operate the same way as Timer 0 and Timer 11
1 in the P89C51. The Timer 1 flags, TF) and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle.
12
2.1.7 MODES:
Idle Mode: In idle mode, the CPU puts itself to sleep while all the on- chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. It should be noted that when idle is terminated by a hardware reset, the device normally resumes program execu tion, from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle memory. Power-down mode: In the power-down mode, the oscillator is stopped, and the instruction that invokes power-down is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the power-down mode is terminated. The only exit from power-down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize. should not be one that writes to a port pin or to external
13
Table 2.1.7 Status of External Pins during Idle and Power-down Mode
14
BLOCK DIAGRAM
15
Figure 2.3.1-1 Light Emitting Diodes Not long ago LEDs were only bright enough to be used as indicators on dashboards or electronic equipment. But recent advances have made LEDs bright enough to rival traditional lighting technologies. Modern LEDs can replace incandescent bulbs in almost any application. LEDs with a voltage range of 1.2V 3.3V are used for power supply and signal posts. At the signal posts resistors (450 Ohms) are used near LEDs to convert the LEDs to 5V.
CHAPTER 3
16
MEMS SENSOR
3.1 MEMS
The MMA7660FC is a 1.5 g 3-Axis Accelerometer with Digital Output (I 2C). It is a very low power, low profile capacitive MEMS sensor featuring a low pass filter, compensation for 0g offset and gain errors, and conversion to 6-bit digital values at a user configurable samples per second. The device can be used for sensor data changes, product orientation, and gesture detection through an interrupt pin (INT). The device is housed in a small 3mm x 3mm x 0.9mm DFN package.
3.2 Features
3mm x 3mm x 0.9mm DFN Package Low Power Current Consumption: Off Mode: 0.4 A, Standby Mode: 3 A, Active Mode: 47 A at 1 ODR Configurable Samples per Second from 1 to 120 samples a second. Low Voltage Operation: Analog Voltage: 2.4 V - 3.6 V Digital Voltage: 1.71 V - 3.6 V Auto-Wake/Sleep Feature for Low Power Consumption Tilt Orientation Detection for Portrait/Landscape Capability Gesture Detection Including Shake Detection and Tap Detection Robust Design, High Shocks Survivability (10,000 g) RoHS Compliant Halogen Free Environmentally Preferred Product Low Cost
17
18
19
20
21
22
4.2 FEATURES
12-bit resolution 1 LSB max DNL 1 LSB max INL (MCP3204/3208-B) 2 LSB max INL (MCP3204/3208-C) 4 (MCP3204) or 8 (MCP3208) input channels Analog inputs programmable as single-ended or pseudo-differential pairs On-chip sample and hold SPI serial interface (modes 0,0 and 1,1) Single supply operation: 2.7V - 5.5V 100 ksps max. sampling rate at VDD = 5V 50 ksps max. sampling rate at VDD = 2.7V Low power CMOS technology: - 500 nA typical standby current, 2 A max. - 400 A max. active current at 5V 23
Industrial temp range: -40C to +85C Available in PDIP, SOIC and TSSOP packages
CHAPTER 5
24
Most of the LCD modules conform to a standard interface specification. A 14pin access is provided having eight data lines, three control lines and three power lines. The connections are laid out in one of the two common configurations, either two rows of seven pins, or a single row of 14 pins. One of the, pins are numbered on the LCDs print circuit board (PCB), but if not, it is quite easy to locate pin1. Since this pin is connected to ground, it often has a thicker PCB track, connected to it, and it is generally connected to metalwork at same point.
G 1
+5V 2
-5V 3
07
08
09
10
11
12
13
14
D0
D1 D2 D3
D4
D5 D6 D7
RS
R/W EN
R/W, read/write: R/W input allows the user to write information to the LCD or read information from it. R/W=1 when reading; R/W=0 when writing. EN, Enable The enable pin is used by the LCD to latch information presented to its data pins.When data is supplied to data pins, a high-to-low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450ns wide. D0-D7: The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents of the LCDs internal register To display letters and numbers, we send ASCII codes for the letters A-Z, a-z, and numbers 0-9 to these pins while making RS There are also instruction command codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the instruction command codes. We also use RS=0 to check the busy flag bit to see if the LCD is ready to receive information. The busy flag is D7 and can be read when R/W=1 and RS=0, as follows: if R/W=1,RS=0. When D7=1 (busy flag=1), the LCD is busy taking care of internal operations and will not accept any information. PIN 1 2 3 4 SYMBOL Vss Vcc Vee RS I/O ---I DESCRIPTION Ground +5V power supply Power supply to control contrast RS=0 to select command register RS=1 to select data register R/W=0 for write R/W=1 for read Enable The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus
5 6 7 8 9 10 11 12 13 14
R/W
EN I/O DB0 I/O DB1 I/O DB2 I/O DB3 I/O DB4 I/O DB5 I/O DB6 I/O DB7 I/O Table 5.3-1 Pin Description of LCD 27
28
6.1 Description
29
30
31
32
33
34
CHAPTER 7
DC MOTOR:
INTRODUCTION: Industrial applications use dc motors because the speed-torque relationship can be varied to almost any useful form -- for both dc motor and regeneration applications in either direction of rotation. Continuous operation of dc motors is commonly available over a speed range of 8:1. Infinite range (smooth control down to zero speed) for short durations or reduced load is also common. Dc motors are often applied where they momentarily deliver three or more times their rated torque. In emergency situations, dc motors can supply over five times rated torque without stalling (power supply permitting). Dynamic braking (dc motor-generated energy is fed to a resistor grid) or regenerative braking (dc motor-generated energy is fed back into the dc motor supply) can be obtained with dc motors on applications requiring quick stops, thus eliminating the need for, or reducing the size of, a mechanical brake. Dc motors feature a speed, which can be controlled smoothly down to zero, immediately followed by acceleration in the opposite direction -- without power circuit switching. And dc motors respond quickly to changes in control signals due to the dc motor's high ratio of torque to inertia. 7.1 DC Motor types Wound-field dc motors are usually classified by shunt-wound, series-wound, and compound- wound. In addition to these, permanent-magnet and brushless dc motors are also available, normally as fractional-horsepower dc motors. Dc motors may be further classified for intermittent or continuous duty. Continuous-duty dc motors can run without an off period. 7.2 DC Motors - Speed control There are two ways to adjust the speed of a wound-field dc motor. Combinations of the two are sometimes used to adjust the speed of a dc motor. 7.3 DC Motor - Shunt-field control Reel drives require this kind of control. The dc motor's material is wound on a reel at constant linear speed and constant strip tension, regardless of diameter. Control is obtained by weakening the shunt-field current of the dc motor to increase speed and to reduce output torque for a given armature current. Since the rating of a dc motor is determined by heating, the maximum permissible armature current is approximately constant over the speed range. This means that at rated current, the dc motor's output torque varies inversely with speed, and the dc motor has constant-horsepower capability over its speed range. Dc motors offer a solution, which is good for only obtaining speeds greater than the base speed. A momentary speed reduction below the dc motor's base speed can be obtained by overexciting the field, but prolonged over excitation overheats the dc motor. Also, magnetic saturation in the dc motor permits only a small reduction in speed for a substantial increase in field voltage. 35
Dc motors have a maximum standard speed range by field control is 3:1, and this occurs only at low base speeds. Special dc motors have greater speed ranges, but if the dc motor's speed range is much greater than 3:1, some other control method is used for at least part of the range. 7.4 Armature-voltage DC Motor Control: In this method, shunt-field current is maintained constant from a separate source while the voltage applied to the armature is varied. Dc motors feature a speed, which is proportional to the counter emf. This is equal to the applied voltage minus the armature circuit IR drop. At rated current, the torque remains constant regardless of the dc motor speed (since the magnetic flux is constant) and, therefore, the dc motor has constant torque capability over its speed range. Horsepower varies directly with speed. Actually, as the speed of a self-ventilated motor is lowered, it loses ventilation and cannot be loaded with quite as much armature current without exceeding the rated temperature rise. 7.5 DC Motors-Selection Choosing a dc motor and associated equipment for a given application requires consideration of several factors. 7.5.1 DC Motors Speed range If field control is to be used, and a large speed range is required, the base speed must be proportionately lower and the motor size must be larger. If speed range is much over 3:1, armature voltage control should be considered for at least part of the range. Very wide dynamic speed range can be obtained with armature voltage control. However, below about 60% of base speed, the motor should be derated or used for only short periods. 7.5.2 DC Motors - Speed variation with torque Applications requiring constant speed at all torque demands should use a shuntwound dc motor. If speed change with load must be minimized, a dc motor regulator, such as one employing feedback from a tachometer, must be used. When the dc motor speed must decrease as the load increases, compound or serieswound dc motors may be used. Or, a dc motor power supply with a drooping volt-ampere curve could be used with a shunt-wound dc motor. 7.6 DC Motors - Reversing This operation affects power supply and control, and may affect the dc motor's brush adjustment, if the dc motor cannot be stopped for switching before reverse operation. In this case, compound and stabilizing dc motor windings should not be used, and a suitable armature-voltage control system should supply power to the dc motor. 7.7 DC Motors - Duty cycle Direct current motors are seldom used on drives that run continuously at one speed and load. Motor size needed may be determined by either the peak torque requirement or heating.
frequency of occurrence of the overload. Dc motor peak torque is often limited by the maximum current that the power supply can deliver. Dc motors can commutate greater loads at low speed without damage. NEMA standards specify that machines powered by dc motors must deliver at least 150% rated current for 1 min at any speed within rated range, but most dc motors do much better.
37
7.2-1 Motor speed(speed vs time) You can see that the average speed is around 150, although it varies quite a bit. If the supply voltage is switched fast enough, it wont have time to change speed much, and the speed will be quite steady. This is the principle of switch mode speed control. Thus the speed is set by PWM Pulse Width Modulation.
7.10 Inductors
Before we go on to discuss the circuits, we must first learn something about the action of inductive loads, and inductors. Inductors do not allow the current flowing through them to change instantly (in the same way capacitors do not allow the voltage across them to change instantly). The voltage dropped across an inductor carrying a current i is given by the equation
where di/dt is the rate of change of the current. If the current is suddenly changed by opening a switch, or turning a transistor off, the inductor will generate a very high voltage across it. For example, turning off 100 Amps in 1 microsecond through a 100 microHenry inductor generates 10kV!
This waveform will be a spiky switching waveform at low frequencies, but at high frequencies the inductance of the motor will smooth this out to an average DC current level proportional to the PWM demand. This third point can be seen from the following two graphs. One shows the worst case on-off current waveform, the other the best case steady DC current waveform:
Front Condition:
Back Condition:
Right condition
Left Condition
CHAPTER 9 CONCLUSION
9.1 Conclusion
41
According to the circuit designed and by the program code that is dumped into the micro controller we were able to achieve the aim that we desired. Hence by using the analysis of the above project we achieved the ease of industrial work with well established motion controlled password security system, solution for controlling multiple functions with security .This project can be used in any industries to decrease the human resource afford and to increase the security of work.
CHAPTER 10 BIBLIOGRAPHY
10.1Text books Referred
THE 8051 MICROCONTROLLER AND EMBEDDED SYATEMS MAZIDI THE 8051 MICROCONTROLLER architecture, programming & applications 42 by MUHAMMAD ALI by KENNETH J.AYALA
10.2Web References
http://www.technologystudent.com/_vti_bin/shtml.exe/index.html http://www.electronickits.com/kit/complete/complete.html http://www.youtube.com/watch?v=Srwk-i5aXRQ http://www.unibw.de/robotics/videos/ http://www.datasheet4u.com/html/7/8/0/7806_FairchildSemiconductor.pdf.
43
44