Академический Документы
Профессиональный Документы
Культура Документы
Embedded system
An Embedded System is a combination of computer hardware and software, and perhaps additional mechanical part designed to perform a specific function. An embedded system is a microcontroller-based, software driven, reliable, real-time control system, autonomous, or human or network interactive, operating on diverse physical variables and in diverse environments and sold into a competitive and cost conscious market. An embedded system is not a computer system that is used primarily for processing, not a software system on PC or UNIX, not a traditional business or scientific application. High-end embedded & lower end embedded systems. High-end embedded system - Generally 32, 64 Bit Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc .Lower end embedded systems - Generally 8,16 Bit Controllers used with an minimal operating systems and hardware layout designed for the specific purpose. Examples Small controllers and devices in our everyday life like Washing Machine, Microwave Ovens, where they are embedded in.
Fig:1.2 V Diagram
Program installation you will need special tools to get your software into embedded systems. Power consumption Portable systems must run on battery power, and the software in these systems must conserve power. Embedded systems have a microprocessor/ microcontroller and a memory.
Some have a serial port or a network connection. They usually do not have keyboards, screens or disk drives.
APPLICATIONS:
Military and aerospace embedded software applications
1) Communication Applications 2) Industrial automation and process control software
3) Mastering the complexity of applications. 4) Reduction of product design time. 5) Real time processing of ever increasing amounts of data. 6) Intelligent, autonomous sensors
Block diagram:
The ac voltage, typically 220V rms, is connected to a transformer, which steps that ac voltage down to the level of the desired dc output. A diode rectifier then provides a full-wave rectified voltage that is initially filtered by a simple capacitor filter to produce a dc voltage. This resulting dc voltage usually has some ripple or ac voltage variation. A regulator circuit removes the ripples and also remains the same dc value even if the input dc voltage varies, or the load connected to the output dc voltage changes. This voltage regulation is usually obtained using one of the popular voltage regulator IC units.
FILTER
IC REGULATOR
LOAD
BUILD
DOWNLOAD
DD
Tools
Fig.3.1.1: A Typical Transformer The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils; instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. The ratio of the number of turns on each coil, called the turns ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage The ratio of the number of turns on each coil, called the turns ratio, TURNS RATIO = (Vp / Vs) = ( Np / Ns ) Where,
Vp = primary (input) voltage. Vs = secondary (output) voltage Np = number of turns on primary coil Ns = number of turns on secondary coil Ip = primary (input) current Is = secondary (output) current.
Fig 3.1.3: Circuit diagram (Power supply). A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi, applied to one input terminal, a regulated dc output voltage, Vo, from a second terminal.
The series 78 regulators provide fixed positive regulated voltages from 5 to 24 volts. Similarly, the series 79 regulators provide fixed negative regulated voltages from 5 to 24 volts. For ICs, microcontroller, LCD --------- 5 volts For alarm circuit, op-amp, relay circuits ---------- 12 volts
Microcontrollers will combine other devices such as: A timer module to allow the microcontroller to perform tasks for certain time periods. as a PIC or another microcontroller. An ADC to allow the microcontroller to accept analogue input data for processing. Microcontrollers are: Smaller in size Consumes less power
Inexpensive Micro controller is a stand alone unit, which can perform functions on its own
without any requirement for additional hardware like I/O ports and external memory. The heart of the microcontroller is the CPU core. In the past, this has traditionally been based on a 8-bit microprocessor unit. For example Motorola uses a basic 6800 microprocessor core in their 6805/6808 microcontroller devices. In the recent years, microcontrollers have been developed around specifically designed CPU cores, for example the microchip PIC range of microcontrollers. AT89C51 is the 40 pins, 8 bit Microcontroller manufactured by Atmel group. It is the flash type reprogrammable memory. Advantage of this flash memory is we can erase the program with in few minutes. It has 4kb on chip ROM and 128 bytes internal RAM and 32 I/O pin as arranged as port 0 to port 3 each has 8 bit bin .Port 0 contain 8 data line(D0-D7) as well as low order address line(AO-A7). Port 2 contain higher order address line (A8-A15). Port 3 contains special purpose register such as serial input receiver register SBUF, interrupt INT0,INT1 and timers T0 , T1 many of the pins have multi functions which can be used as general purpose I/O pins (or) Special purpose function can be decided by the programmer itself.
and DPL. DPTR does not have a single internal address; DPH and DPL are each assigned an address. The Data Pointer (DPTR) is the 8051s only user-accessible 16-bit (2-byte) register. DPTR, as the name suggests, is used to point to address something like HL register pair in 8085 microprocessor. It is used by a number of commands that allow the 8051 to access external memory and internal memory. While DPTR is most often used to point to data in external memory, many programmers often take advantage of the fact that its the only true 16-bit register available. It is often used to store 2-byte values that have nothing to do with memory locations.
CY AC F0 RS1 RS0 OV -P
Carry flag Auxiliary carry flag Flag 0 (User Flag) Register bank selector bit1 Register bank selector bit0 Overflow flag Reserved for future use Parity flag
RS1 0 0 1 1
RS0 0 1 0 1
Register Bank 0 1 2 3
A functioning computer must have memory for program codes, commonly in ROM, and RAM memory for variable data that can be altered as the program runs.The 8051 has internal RAM and ROM memory for these functions.Additional memory can be added externally using suitable circuits. Unlike Microcontrollers with Von Neumann architectures, which can use a single memory address for either program code or data, but not for both, the 8051 has a Harvard architecture, which uses the same address, in different memories, for code and data. Internal circuitry accesses the correct memory based on the nature of the operation in progress. Harvard architecture uses separate buses to fetch the data and the address
Bank 3 18h-1fh 8051 microcontroller has 16-bit address bus and 8 bit data bus, with 16-bit
address bus we can address maximum of 64Kilobytes of external memory that is from 0000h to FFFF. 8051 is available with 4kilobytes of internal ROM its derivatives 8751,8951are available with EPROM, FLASH ROM respectively with 4kilobytes capacity.
may be used by user variables that need to be accessed frequently or at high-speed. This area is also utilized by the microcontroller as a storage area for the operating stack. This fact severely limits the 8051s stack since, as illustrated in the memory map, the area reserved for the stack is only 80 bytes and usually it is less since these 80 bytes has to be shared between the stack and user variables.
ADD A, R4
Thus if the Accumulator (A) contained the value 3 and R4 contained the value 3, the Accumulator would contain the value 6 after this instruction was executed. However, as the memory map shows, the "R" Register R4 is really part of Internal RAM. Specifically, R4 is address 04h. Thus the above instruction accomplishes the same thing as the following operation:
ADD A, 04h
This instruction adds the value found in Internal RAM address 04h to the value of the Accumulator, leaving the result in the Accumulator. Since R4 is really Internal RAM 04h, the above instruction effectively accomplished the same thing. But watch out! As the memory map shows, the 8051 has four distinct register banks. When the 8051 is first booted up, register bank 0 (addresses 00h through 07h) is used by default. However, your program may instruct the 8051 to use one of the
alternate register banks; i.e., register banks 1, 2, or 3. In this case, R4 will no longer be the same as Internal RAM address 04h. For example, if your program instructs the 8051 to use register bank 3, "R" register R4 will now be synonymous with Internal RAM address 1Ch. The concept of register banks adds a great level of flexibility to the 8051, especially when dealing with interrupts (we'll talk about interrupts later). However, always remember that the register banks really reside in the first 32 bytes of Internal RAM. Register banks can be selected with the help of RS0, RS1 bits in the program status word (PSW).
using external RAM or code memory or peripheral interface you may only use ports P1 and P3 for your own use. P1 (Port 1, Address 90h, Bit-Addressable): This is input/output port 1. Each bit of this SFR corresponds to one of the pins on the microcontroller. For
example, bit 0 of port 1 is pin P1.0 i.e., pin number 1 bit 7 is pin P1.7 i.e., pin number 8. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level. P2 (Port 2, Address A0h, Bit-Addressable): This is input/output port 2. Each bit of this SFR corresponds to one of the pins on the Microcontroller. For example, bit 0 of port 2 is pin P2.0 i.e., pin number 21, bit 7 is pin P2.7 i.e., pin number 28. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will being it to a low level While the 8051 has four I/O port (P0, P1, P2 and P3), if your hardware uses external RAM or external code memory (i.e., your program is stored in an external ROM or EPROM chip or if you are using external RAM chips) you may not use P0 or P2. This is because the 8051 uses ports P0 and P2 to address the external memory. Thus if you are using external RAM or code memory you may only use ports P1 and P3 for your own use. P3 (Port 3, Address B0h, Bit Addressable): This is input/output port 3. Each bit of this SFR corresponds to one of the pins on the microcontroller. For example, bit 0 of port 3 is pin P3.0 i.e., pin number 10, bit 7 is pin P3.7 i.e., pin number 17. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level. While the 8051 has four I/O port (P0, P1, P2 and P3), if your hardware uses external RAM or external code memory (i.e., your program is stored in an external ROM or EPROM chip or if you are using external RAM chips) you may not use P0 or P2 and p3.6, p3.7. This is because the 8051 uses ports P0 and P2 to address the external memory and P3.6 and P3.7 for write and read operations. Thus if you are using external RAM or code memory you may only use ports P1 and P3 for your own use.
Port 3 can also used for timer/counter, interrupts, serial ports also. P3.0 is also used for serial data reception, P3.1 is for serial data transmission, P3.2 & P3.3 is for external interrupts P3.4 & P3.5 is for timer0 and timer1 respectively. P3.6&P3.7 for write and read operations respectively.
99h.There are four programmable modes for serial data communication that are chosen by setting the SMX bits in SCON. Baud rates are determined by the mode chose. We will discuss about serial port later.
3.2.13. INTERRUPTS
An interrupt is a special feature, which allows the 8051 to provide the illusion of "multi-tasking," although in reality the 8051 is only doing one thing at a time. The word "interrupt" can often be substituted with the word "event." An interrupt is triggered whenever a corresponding event occurs. When the event occurs, the 8051 temporarily puts "on hold" the normal execution of the program and executes a special section of code referred to as an interrupt handler. The interrupt handler performs whatever special functions are required to handle the event and then returns control to the 8051 at which point program execution continues as if it had never been interrupted. The topic of interrupts is somewhat tricky and very important. For that reason, an entire chapter will be dedicated to the topic. For now, suffice it to say that Interrupts can cause program flow to change.Software techniques use up processor time that could be devoted to other tasks Five interrupts are provided in the 8051. Three of these are generated automatically by internal operations: Timer flag 0, Timer flag 1, and the serial port interrupt (RI or TI). Two interrupts are triggered by external signals provided by circuitry that is connected to pins INT0 and INT1 (port pins P3.2 and P3.3 After the Interrupt has been handled by the interrupt subroutine. Program resumption is done by storing the interrupted PC address on the stack in RAM before changing the PC to the interrupt address in ROM. The PC address will be restored from the stack after an RETI instruction is executed at the end of the interrupt subroutine.
8051 designs that can run at specified maximum and minimum frequencies, typically 1 megahertz to 24 megahertz. Minimum frequencies imply that some internal memories are dynamic and must always operate above a minimum frequency or data will be lost.
.C2
XTAL 2
C1 XTAL 1
GND
Ceramic resonators may be used as low-cost alternative to crystal resonators. However, decreases in frequency stability data accuracy make the ceramic resonator a poor choice if high-speed serial data communication with the systems, or critical timing, is to be done.
The oscillator formed by the crystal, capacitors, and an on-chip inverter microcontroller, called the pulse, P, time. The smallest interval of time to accomplish any simple instruction, or part of a complex instruction, however, is the machine cycle. Program instructions may require one, two, or four machine cycles to the executed, depending on the type of instruction. Instructions are fetched and executed by the microcontroller automatically, beginning with the instruction located by the microcontroller automatically.To calculate the time any particular instruction will take to be executed, find the number of cycles, C, The time to execute that instruction is then found by multiplying C by 12 and dividing the product by the crystal frequency: C x 12 T inst = -------------------------------------------Crystal frequency For example, if the crystal frequency is 16 megahertz, then the time to execute an ADD A, R1 one-cycle instructions is .75 microseconds. A 12-megahertz crystal yields the convenient time of 1 microsecond per cycle. An 11.0592-megahertz crystal, although seemingly an odd value, yields a cycle frequency of 921.6 kilohertz, which can be divided evenly by the standard communication baud rates of 19200, 9600, 4800, 2400, 1200, and 300 hertz Oscillator frequency (f)
P1 P2 P2 P2 P2 P1 P2 P2 P1 P2 P1
P1
State 4
State 5 State 3
State 6
State 1
P1
State 2
Chapter 4
IRSENSOR
terminal. The non inverting input terminal is connected IR receiver. When interrupt the IR rays between the IR transmitter and receiver, the IR receiver is not conducting. When IR transmitter passes the rays to receiver, the IR receiver is conducting due to that non inverting input voltage is lower than inverting input. Now the comparator output is GND so the output is given to microcontroller or PC. This circuit is mainly used to for counting application, intruder detector etc.
5.1 Introduction
Fig. 5.1: LCD Display The LCD display consists of two lines, 20 characters per line that is interfaced with the PIC16F73.The protocol (handshaking) for the display is as shown in Fig. The display contains two internal byte-wide registers, one for commands (RS=0) and the
second for characters to be displayed (RS=1). It also contains a user-programmed RAM area (the character RAM) that can be programmed to generate any desired character that can be formed using a dot matrix. To distinguish between these two data areas, the hex command byte 80 will be used to signify that the display RAM address 00h will be chosen Port1 is used to furnish the command or data type, and ports 3.2 to 3.4 furnish register select and read/write levels.
Theory
A liquid crystal is a material (normally organic for LCDs) that will flow like a liquid but whose molecular structure has some properties normally associated with solids. The Liquid Crystal Display (LCD) is a low power device. The power requirement is typically in the order of microwatts for the LCD. However, an LCD requires an external or internal light source. It is limited to a temperature range of about 0C to 60C and lifetime is an area of concern, because LCDs can chemically degrade. There are two major types of LCDs which are: Dynamic-scattering LCDs and Field-effect LCDs The turn-on and turn-off time is an important consideration in all displays. The response time of LCDs is in the range of 100 to 300ms.The lifetime of LCDs is steadily increasing beyond 10,000+hours limit. Since the color generated by LCD units is dependent on the source of illumination, there is a wide range of color choice.
Description Ground +5v power supply Contrast Voltage Instruction/Register Select Read/Write LCD Registers Enable
While Vcc and Vss provide +5v and ground, respectively, Vee is used for controlling LCD contrast.
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. E, 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 latch in the data pins. This pulse must be a minimum of 450 ns wide.
D0 - D7
The 8 - bit data pins, D0 - D7, are used to send information to the LCD or read the contents of the LCD's internal registers. To display letters and numbers, send ASCII codes for the letters A - Z, a - z, and numbers 0 - 9 to these pins while RS = 1. When 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 operation and will not accept any new information. The description of the pins is shown in Table 5.1.
S/C
R/L 0
DL N
DL=1/0:
8/4
bits
per
5*10/5*7dots/character 0 0 0 1 Character address Write to character RAM address after this 0 0 1 Display data address Write to display RAM
executed. While it is possible to write code that waits for a specific amount of time to allow the LCD to execute instructions, this method of "waiting" is not very flexible. If the crystal frequency is changed, the software will need to be modified. Additionally, if the LCD itself is changed for another LCD which, although 44780 compatible, requires more time to perform its operations, the program will not work until it is properly modified. A more robust method of programming is to use the "Get LCD Status" command to determine whether the LCD is still busy executing the last instruction received. The "Get LCD Status" command will return to the user two bits of information; the information that is useful to the user right now is found in DB7. In summary, when user issue the "Get LCD Status" command the LCD will immediately raise DB7 if it's still busy executing a command or lower DB7 to indicate that the LCD is no longer occupied. Thus the program can query the LCD until DB7 goes low, indicating the LCD is no longer busy. At that point user is free to continue and send the next command.
c) Cursor Positioning The cursor positioning in a LCD can be done in the right entry mode or left entry mode. As left entry mode is flexible it is implemented. The circuit diagram of Check post Control System using RFID Module and its components description is described in next chapter.
Chapter 6 BUZZER
A buzzer or beeper is an audio signaling device, which may be mechanical, electromechanical, or piezoelectric. Typical uses of buzzers and beepers include alarm devices, timers and confirmation of user input such as a mouse click.
MECHANICAL BUZZER
A joy buzzer is an example of a purely mechanical buzzer.
ELECTRONIC
A piezoelectric element may be driven by an oscillating electronic circuit or other audio signal source. Sounds commonly used to indicate that a button has been pressed are a click, a ring or a beep. Electronic find many applications in modern days.
FIG.6.1 Buzzer
Keil an ARM Company makes C compilers, macro assemblers, real-time kernels, debuggers, simulators, integrated environments, evaluation boards, and emulators for ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and 8051 MCU families. Keil development tools for the 8051 Microcontroller Architecture support every level of software developer from the professional applications engineer to the student just learning about embedded software development. When starting a new project, simply select the microcontroller you use from the Device Database and the Vision IDE sets all compiler, assembler, linker, and memory options for you. Keil is a cross compiler. So first we have to understand the concept of compilers and cross compilers. After then we shall learn how to work with keil.
Project Manager Simulator Debugger C Cross Compiler, Cross Assembler, Locator/Linker 5. 3 KEIL C CROSS COMPILER Keil is a German based Software development company. It provides several assemble the ARM assembly program: Keil is a German based Software development company. It provides several assemble the absolute object module suitable for our in-circuit emulator. .
8.4 EMBEDDED C
Use of embedded processors in passenger cars, mobile phones, medical equipment, aerospace systems and defense systems is widespread, and even everyday domestic appliances such as dish washers, televisions, washing machines and video recorders now include at least one such device. Because most embedded projects have severe cost constraints, they tend to use low-cost processors like the 8051 family of devices considered in this book. These popular chips have very limited resources available most such devices have around 256 bytes (not megabytes!) of RAM, and the available processor power is around 1000 times less than that of a desktop processor. As a result, developing embedded software presents significant new challenges, even for experienced desktop programmers. If you have some programming experience - in C, C++ or Java - then this book and its accompanying CD will help make your move to the embedded world as quick and painless as possible.
9. CONCLUSION
This project of EYE BLINK SENSING AND ACCIDENT PREVENTER is a cost effective, practical, eco friendly and the safest way to save energy. It clearly tackles the two problems that world is facing today, saving of energy and also prevention of accidents , very efficient.Initial cost and maintenance can be the draw backs of this project. With the advances in technology and good resource planning the cost of the project can be cut down and also with the use of good equipment the maintenance can also be reduced in terms of periodic checks. The IR sensors have long life can be used for fast switching. For these reasons our project presents far more advantages which can over shadow the present limitations. Keeping in view the long term benefits and the initial cost would never be a problem as the investment return time is very less.
10. BIBLIOGRAPHY