Beruflich Dokumente
Kultur Dokumente
1.1 INTRODUCTION Embedded system employs a combination of software & hardware to perform a specific function. It is a part of a larger system which may not be a computer Works in a reactive & time constrained environment. Any electronic system that uses a CPU chip, but that is not a general-purpose workstation, desktop or laptop computer is known as embedded system. Such systems generally use microprocessors; microcontroller or they may use custom-designed chips or both. They are used in automobiles, planes, trains, space vehicles, machine tools, cameras, consumer and office appliances, cell phones, PDAs and other handhelds as well as robots and toys. The uses are endless, and billions of microprocessors are shipped every year for a myriad of applications.
basic
In embedded systems, the software is permanently set into a read-only memory such as a ROM or flash memory chip, in contrast to a general-purpose computer that loads its programs into RAM each time. Sometimes, single board and rack mounted generalpurpose computers are called "embedded computers" if used to control
We are living in the Embedded World. You are surrounded with many embedded products and your daily life largely depends on the proper functioning of these gadgets. Television, Radio, CD player of your living room, Washing Machine or Microwave Oven in your kitchen, Card readers, Access Controllers, Palm devices of your work space enable you to do many of your tasks very effectively. Apart from all these, many controllers embedded in your car take care of car operations between the bumpers and most of the times you tend to ignore all these controllers. In recent days, you are showered with variety of information about these embedded controllers in many places. All kinds of magazines and journals regularly dish out details about latest technologies, new devices, fast applications which make you believe that your basic survival is controlled by these embedded products. Now you can agree to the fact that these embedded products have successfully invaded into our world. You must be wondering about these embedded controllers or systems. What is this Embedded System? The computer you use to compose your mails, or create a document or analyze the database is known as the standard desktop computer. These desktop computers are manufactured to serve many purposes and applications. You need to install the relevant software to get the required processing facility. So, these desktop computers can do many things. In contrast, embedded controllers carryout a specific work for which they are designed. Most of the time, engineers design these embedded controllers with a specific goal in mind. So these controllers cannot be used in any other place. Theoretically, an embedded controller is a combination of a piece of microprocessor based hardware and the suitable software to undertake a specific task. These days designers have many choices in microprocessors/microcontrollers. Especially, in 8 bit and 32 bit, the available variety really may overwhelm even an experienced designer. Selecting a right microprocessor may turn out as a most difficult first step and it is getting complicated as new devices continue to pop-up very often.
AUTOMOBILES: Fuel Injection control (for fuel efficiency), Air bags and
Scanners, Heart rate monitors, Pacemaker etc) Industrial Control: such as CNC machines are example embedded systems.
BUSINESS
APPLICATIONS:
Vending
machines,
scanners,
printers.
Machines
HARDWARE
SOFTWARE
Control Software :Responsible for managing and synchronizing Computation Extensive Software Device Drivers which control System's Peripheral User Interface for collecting user inputs Operating System (optional) : Operating System is a software which manages the
CHAPTER 2=SIMULATION
2.1 INTRODUCTION
4
Simulation is the imitation of some real thing, state of affairs, or process. The act of simulating something generally entails representing certain key characteristics or behaviors of a selected physical or abstract system. Simulation is used in many contexts, including the modeling of natural systems or human systems in order to gain insight into their functioning. Other contexts include simulation of technology for performance optimization, safety, engineering, training and education. Simulation can be used to show the eventual real effects of alternative conditions and courses of action A computer simulation (or "sim") is an attempt to model a real-life or hypothetical situation on a computer so that it can be studied to see how the system works. By changing variables, predictions may be made about the behavior of the system. Computer simulation has become a useful part of modeling many natural systems in physics, chemistry, biology and human systems in economics and social science(the computational sociology) as well as in engineering to gain insight into the operation of those systems. For example, simulators have been used to debug a microprogram or sometimes commercial application programs, before the program is downloaded to the target machine. Since the operation of the computer is simulated, all of the information about the computer's operation is directly available to the programmer, and the speed and execution of the simulation can be varied at will.
2.2.1 STOCHASTIC SYSTEM A system, such as this one, that relies heavily upon random behavior is referred to as a stochastic system. The results generated from a stochastic system are typically
5
analyzed statistically in order to make conclusions regarding the behavior of the system.For example, consider a simulated system consisting of a series of bank tellers who must provide transaction services to incoming customers. The length of time required for a teller to process a customer's transaction cannot usually be predetermined before the simulation is started. Consequently such a simulation system must introduce random behavior to simulate the duration of each transaction. During the analysis of a real world banking system it may be discovered that the time required for a transaction occurs over some well known probability distribution. Hence the duration of each transaction may be generated from this distribution. A similar strategy may be adopted for the rate at which customers enter a bank. Through the introduction of this randomness, the results of a simulation may never be the same as a previous simulation. 2.2.2 DETERMINISTIC SYSTEM Conversely, a deterministic simulation system incorporates absolutely no random
behavior whatsoever. As such, the simulation results for a given set of inputs will always be identical. Simulations involving circuit behavior are examples of deterministic systems. Supplying high signals to both inputs of a 2-input NAND gate will always produce a low signal on the gate's output, regardless of where the gate is located in the circuit's design hierarchy or when the inputs are received by the gate. In the context of circuit simulation, deterministic simulation is used to verify that a particular circuit design is behaving as expected when the circuit is supplied with a given set of inputs; the circuit produces the expected outputs at the correct time.
interact at the electrical or analog level, whereas simulating a circuit described in terms of gates, flip-flops and registers will demonstrate the digital interaction amongst the components. Circuits may be described and simulated at several levels of abstraction. This section will describe three major abstraction levels, each of which are related to the simulation models described above. These levels are described below in order of increasing abstraction level
Consequently, continuous simulation techniques are often used to implement circuit-level simulators. Although this method generates very accurate results, the technique is very computationally intensive, resulting in poor simulation speed. As a result, circuit-level simulation is usually not feasible for large designs and is therefore commonly used to simulate only the most critical sub regions of a given circuit.
subsequently simulated. Because the components are increasingly abstract, more complex systems may be designed and simulated at the gate level rather than at the switch level.
2.5
2.6
10
11
12
13
3.2 HISTORY
14
Intel Corporation introduced an 8-bit microcontroller called 8051 in 1981 this controller had 128 bytes of RAM, 4k bytes of on chip ROM, two timers, one serial port, and four ports all are on single chip. The 8051 is an 8 bit processor, meaning that the CPU can work on only 8 bit data at a time. Data larger than 8 bits broken into 8 bit pieces to be processed by CPU. It has for I/O 8 bit wide.
15
QUANTITY
4K bytes 128 bytes 2 32 1 6
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
16
Assembly language is often used in microcontrollers and since they usually follow RISC architecture, the instruction set is small. The development package of microcontrollers often includes an assembler, a simulator, a programmer to "burn" the chip and a demonstration board. Some packages include a high level language compiler such as a C compiler and more sophisticated libraries.
17
A Timer module to allow the microcontroller to perform tasks for certain time A serial I/O port to allow data to flow between the microcontroller and other An ADC to allow the microcontroller to accept analogue input data for
periods.
processing.
Figure: Showing a typical microcontroller device and its different subunits The heart of the microcontroller is the CPU core. In the past this has traditionally been based on an 8-bit microprocessor unit.
18
19
20
21
Figure: Internal Architecture of 8051 There are four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports upon RESET are configured as output, ready to be used as output ports. To use any of these ports as an input port, it must be programmed.
PORT 0
Port 0 occupies a total of 8 pins (pins 32-39) .It can be used for input or output. To use the pins of port 0 as both input and output ports, each pin must be connected externally to a 10K ohm pull-up resistor. This is due to the fact that P0 is an open drain, unlike P1, P2, and P3.Open drain is a term used for MOS chips in the same way that open collector is used for TTL chips. With external pull-up resistors connected upon reset, port 0 is configured as an output port. For example, the following code will continuously send out to port 0 the alternating values 55H and AAH
22
PORT 0 AS INPUT:
With resistors connected to port 0, in order to make it an input, the port must be programmed by writing 1 to all the bits. In the following code, port 0 is configured first as an input port by writing 1's to it, and then data is received from the port and sent to
23
P1.
Dual Role of Port 0 :-Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. When connecting an 8051/31 to an external memory, port 0 provides both address and data. The 8051 multiplexes address and data through port 0 to save pins. ALE indicates if P0 has address or data. When ALE = 0, it provides data D0-D7, but when ALE =1 it has address and data with the help of a 74LS373 latch.
PORT 1
Port 1 occupies a total of 8 pins (pins 1 through 8). It can be used as input or output. In contrast to port 0, this port does not need any pull-up resistors since it already has pullup resistors internally. Upon reset, Port 1 is configured as an output port. For example, the following code will continuously send out to port1 the alternating values 55h & AAh
PORT 1 AS INPUT
24
To make port1 an input port, it must be programmed as such by writing 1 to all its bits. In the following code port1 is configured first as an input port by writing 1s to it, then data is received from the port and saved in R7 ,R6 & R5.
PORT 2
Port 2 occupies a total of 8 pins (pins 21- 28). It can be used as input or output. Just like P1, P2 does not need any pull-up resistors since it already has pull-up resistors internally. Upon reset, Port 2 is configured as an output port. For example, the following code will send out continuously to port 2 the alternating values 55h and AAH. That is all the bits of port 2 toggle continuously.
PORT 2 AS INPUT
To make port 2 an input, it must programmed as such by writing 1 to all its bits. In the following code, port 2 is configured first as an input port by writing 1s to it. Then data is received from that port and is sent to P1 continuously.
PORT 3
Port 3 occupies a total of 8 pins, pins 10 through 17. It can be used as input or output. P3 does not need any pull-up resistors, the same as P1 and P2 did not. Although port 3 is configured as an output port upon reset. Port 3 has the additional function of providing some extremely important signals such as interrupts. This information applies both 8051 and 8031 chips. There functions are as follows:25
P3.0 and P3.1 are used for the RxD and TxD serial communications signals. Bits P3.2 and P3.3 are set aside for external interrupts. Bits P3.4 and P3.5 are used for timers 0 and 1. Finally P3.6 and P3.7 are used to provide the WR and RD signals of external memories connected in 8031 based systems.
ALE/PROG
Address Latch Enable is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/ 6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.
PSEN
Program Store Enable is the read strobe to external program memory. When the AT89S8252 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
26
EA/VPP
EA stands for External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming when 12-volt programming is selected.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output is from the inverting oscillator amplifier.
Oscillator Characters:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator; either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.
27
Memory components are exactly like that. For a certain input we get the contents of a certain addressed memory location and that's all. Two new concepts are brought to us:
28
addressing and memory location. Memory consists of all memory locations, and addressing is nothing but selecting one of them. This means that we need to select the desired memory location on one hand, and on the other hand we need to wait for the contents of that location. Besides reading from a memory location, memory must also provide for writing onto it. This is done by supplying an additional line called control line. We will designate this line as R/W (read/write). Control line is used in the following way: if r/w=1, reading is done, and if opposite is true then writing is done on the memory location. Memory is the first element, and we need a few operation of our microcontroller. The amount of memory contained within a microcontroller varies between different microcontrollers. Some may not even have any integrated memory (e.g. Hitachi 6503, now discontinued). However, most modern microcontrollers will have integrated memory. The memory will be divided up into ROM and RAM, with typically more ROM than RAM. Typically, the amount of ROM type memory will vary between around 512 bytes and 4096 bytes, although some 16 bit microcontrollers such as the Hitachi H8/3048 can have as much as 128 Kbytes of ROM type memory. ROM type memory, as has already been mentioned, is used to store the program code. ROM memory can be ROM (as in One Time Programmable memory), EPROM, or EEPROM. The amount of RAM memory is usually somewhat smaller, typically ranging between 25 bytes to 4 Kbytes. RAM is used for data storage and stack management tasks. It is also used for register stacks (as in the microchip PIC range of microcontrollers).
29
signals to the input of an AND gate and using the output of the gate as the read strobe to the external program/data memory.
0003H for External Interrupt 0, 000BH for Timer 0, 0013H for External Interrupt 1, 001BH for Timer 1, and so on. If an interrupt service routine is short enough (as is often the case in control applications), it can reside entirely within that 8-byte interval. Longer service routines can use a jump instruction to skip over subsequent interrupt locations, if other interrupts are in use. The lowest addresses of program memory can be either in the on-chip Flash or in an external memory. To make this selection, strap the External Access (EA) pin to either VCC or GND. For example, in the AT89C51 with 4K bytes of on-chip Flash, if the EA pin is strapped to VCC, program fetches to addresses 0000H through 0FFFH are directed to the internal Flash. Program fetches to addresses 1000H through FFFFH are directed to external memory. In the AT89C52 (8K bytes Flash), EA = VCC selects addresses 0000H through 1FFFH to be internal and addresses 2000H through FFFFH to
31
be external. If the EA pin is strapped to GND, all program fetches are directed to external memory. The read strobe to external memory, PSEN, is used for all external program fetches. Internal program fetches do not activate PSEN. The hardware configuration is for external program execution. Note that 16 I/O lines (Ports 0 and 2) are dedicated to bus functions during external program memory fetches. Port 0 serves as a multiplexed address/data bus. It emits the low byte of the Program Counter (PCL) as an address and then goes into a float state while waiting for the arrival of the code byte from the program memory. During the time that the low byte of the Program Counter is valid on P0, the signal ALE (Address Latch Enable) clocks this byte into an address latch. Meanwhile, Port 2 emits the high byte of the Program Counter (PCH). Then PSEN strobes the external memory and the microcontroller reads the code byte. Program memory addresses are always 16 bits wide, even though the actual amount of program memory used may be less than 64K bytes. External program execution sacrifices two of the 8-bit ports, P0 and P2, to the function of addressing the program memory.
32
33
Internal data memory addresses are always 1 byte wide, which implies an address space of only 256 bytes. However, the addressing modes for internal RAM can in fact accommodate 384 bytes. Direct addresses higher than 7FH access one memory space and indirect addresses higher than 7FH access a different memory space. Thus, the Upper 128 and SFR space are occupying the same block of addresses, 80H through FFH, although they are physically separate entities. The lowest 32 bytes are grouped into 4 banks of 8 registers. Program instructions call out these registers as R0 through R7. Two bits in the Program Status Word (PSW) select which register bank is in use. This architecture allows more efficient use of code space, since register instructions are shorter than instructions that use direct addressing.
34
Figure: Simplified central processing unit with three registers Registers are therefore memory locations whose role is to help with performing various mathematical operations or any other operations with data wherever data can be found. Look at the current situation. We have two independent entities (memory and CPU) which are interconnected, and thus any exchange of data is hindered, as well as its functionality. If, for example, we wish to add the contents of two memory locations and return the result again back to memory, we would need a connection between memory and CPU. Simply stated, we must have some "way" through data goes from one block to another.
3.11 BUS
That "way" is called "bus". Physically, it represents a group of 8, 16, or more wires. There are two types of buses: address and data bus. The first one consists of as many lines as the amount of memory we wish to address and the other one is as wide as data, in our case 8 bits or the connection line. First one serves to transmit address from CPU memory, and the second to connect all blocks inside the microcontroller.
As far as functionality, the situation has improved, but a new problem has also appeared: we have a unit that's capable of working by itself, but which does not have any contact with the outside world, or with us! In order to remove this deficiency, let's add a block which contains several memory locations whose one end is connected to the data bus, and the other has connection with the output lines on the microcontroller which can be seen as pins on the electronic component.
Figure: Showing connection between memory and central unit using buses
Figure: Simplified input-output unit communicating with external world When working with it the port acts like a memory location. Something is simply being written into or read from it, and it could be noticed on the pins of the microcontroller.
transmission line to logical "0" for a period of time (which we will designate as T), so the receiving side will know that it is receiving data, and so it will activate its mechanism for reception. Let's go back now to the transmission side and start putting logic zeros and ones onto the transmitter line in the order from a bit of the lowest value to a bit of the highest value. Let each bit stay on line for a time period which is equal to T, and in the end, or after the 8th bit, let us bring the logical unit "1" back on the line which will mark the end of the transmission of one data. The protocol we've just described is called in professional literature NRZ (Non-Return to Zero).
Figure: Serial unit sending data through three lines only As we have separate lines for receiving and sending, it is possible to receive and send data (info.) at the same time. So called full-duplex mode block which enables this way of communication is called a serial communication block. Unlike the parallel transmission, data moves here bit by bit, or in a series of bits what defines the term serial communication comes from. After the reception of data we need to read it from the receiving location and store it in memory as opposed to sending where the process is reversed. Data goes from memory through the bus to the sending location, and then to the receiving unit according to the protocol.
block which is significant to us because it can give us information about time, duration, protocol etc. The basic unit of the timer is a free-run counter which is in fact a register whose numeric value increments by one in even intervals, so that by taking its value during periods T1 and T2 and on the basis of their difference we can determine how much time has elapsed. This is a very important part of the microcontroller whose understanding requires most of our time.
Figure: Block for converting an analog input to digital output Finally, the microcontroller is now completed, and all we need to do now is to assemble it into an electronic component where it will access inner blocks through the outside pins. The picture below shows what a microcontroller looks like inside.
Figure: Physical configuration of the interior of a microcontroller Thin lines which lead from the center towards the sides of the microcontroller represent wires connecting inner blocks with the pins on the housing of the microcontroller so called bonding lines. Chart on the following page represents the center section of a microcontroller.
For a real application, a microcontroller alone is not enough. Beside a microcontroller, we need a program that would be executed, and a few more elements which make up interface logic towards the elements of regulation.
Double Click on the icon present on the desktop. The following window will be popped-up
5. Select New from File menu. 6. And save file as file_name.c i.e. save file with .c extension.
7. Select the device and then build the target. We can select the device as atmel or Philips as per the requirement.
10. Type the application code and after compiling, saving the code burn it into controller using Proload.
ACKNOWLADGEMENT
I take this opportunity to express my gratitude to my college Global Research Institute of management & Technology, Nachron (Radaur) for introducing the training in my course. Industrial training is an important aspect in the field of engineering, only after going through this training, I became aware of the practical and factory atmosphere. I am indebted to all the features of industrial electronics research and development department without their interest my training would never be materialized. It is my luck to get chance to join HCL,Hissar, which is the fountain head in the field of electronics and communication, adopting latest technology in electronics. I would like to thank department as a whole and particularly Mr. NARENDER SHARMA (HEAD TRAINING) AND MR. NITIN KUMAR for their genuine help to clear all difficulties during the training. At last I would like to thank the entire staff of DUCAT unit for providing me the necessary resources to enable me to complete my training without any difficulty and making it successful.
PREFACE
Theoretical knowledge is useless without being pragmatic. So, for the purpose training we got chance in DUCAT. For the period of 8 weeks without this training requirement of our B. Tech (E.C.E) would not have been fulfilled. Here, we come to know about the industrial environment. We also need managerial quality, technical, skills and here we were exposed to the electronic instruments which we have never seen before. We were also acquainted to the other departments of the DUCAT classes on different industrial aspects like IPR and certification etc. like providing extra
PROJECT REQUIREMENTS
ICS USED: ATMEL 89S52 (MICROCONTROLLER) ADC 0804 ULN 2003 ACTIVE COMPONENTS: 7805 (5 VOLT REGULATOR) CRYSTAL 11.0592MHZ TEMP. SENSOR LM 35 LED PASSIVE COMPONENTS: RESISTOR PACK DIODE TRANSFORMER 12-0-12 RELAYS 12VOLTS POWER SUPPLY: 5VOLTS 1 1 1 1 1 1 1
1 4 1 4
6. Company Profile (Max. 2 pages) 7. Training Contents (should be chapter wise, subheadings should be marked as 1.1, 1.2.under chapter 1 and so on) 8. Any Project covered 9. References Report should be on A4 size paper. There should be no page number on Title page. Page numbering should be in roman( I,ii,iii.) and at center bottom on above mentioned (2),(3),(4) & (5) and in numerics(1,2,3.) and at center bottom on above mentioned (6) onwards. Margins:
Top 1.0, Bottom 1.0, Left 1.5 and Right 1.0. Line spacing: 1.5 lines.
Caption for table: - above the table and should be marked as Table
1.1, Table 1.2 (under chapter 1) and so on. Caption for figures: - below the figure and should be marked as Figure 2.1, Figure 2.2 (under chapter 2) and so on. Font: - Times New Roman (NO italics).
Size: - 12 for text, 14 for headings (Chapter names Bold) and 12 for Sub headings.
Training Report
On EMBEDDED SYSTEM DESIGN
At
HCL,Hissar
Submitted in Partial fulfillment of requirement for the award of the degree of
B.tech in ECE
Submitted By: Name Rohit Kumar Roll No.- 4608126
Session ( 2008-2012) for 4th year Electronics & Communication Engineering Department GLOBAL RESEARCH INSTITUTE OF MANAGEMENT &TECHNOLOGY
Village NACHRON, RADAUR. Distt. YAMUNA NAGAR (Affiliated to Kurushetra University, Kurushetra)