Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 52

Training Report

OF SIX WEEKS INDUSTRIAL TRAINING AT

APPIN TECHNOLOGIES
Bachelor of Technology [B.TECH]

MAHARAJA INSTITUTE OF TECHNOLOGY [Affiliated to GGSIPU]

SUBMITTED BY :-

ROHIT KUMAR KAUSHAL ECE 2 (7thSEM) 1441502808

INTRODUCTION TO EMBEDDED SYSTEMS


Like the familiar Microwave Oven, an Embedded System is designed to perform some dedicated function. A combination of hardware and software, it forms an embedded part of a complete device. Since an Embedded system has a limited range of applications, design engineers face no problem to optimize both size and quality of performance. enhance reliability 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. Typically, Embedded systems are Reactive and Real time systems. A Reactive system is one, which is in continual interaction with its environment and executes at a pace determined by that environment. The functioning of a digital camera can be taken as an example for Real time and Reactive Embedded systems.

Examples of Embedded Systems Audio like mp3 players and telephone switches for interactive voice response systems Avionics, such as inertial guidance systems, flight control hardware & software and other integrated systems in aircraft and missiles Cellular telephones and telephone switches Electric or Electronic Motor controller for Brushless DC motors, Induction motors and DC Motors Engine controllers and antilock brake controllers for automobiles Home automation products, such as thermostats, air conditioners, sprinklers, and security monitoring systems Handheld calculators Household appliances, including microwave ovens, washing machines, television sets, DVD players and recorders Medical equipment Personal digital assistant Videogame consoles Computer peripherals such as routers and printers Industrial controllers for remote machine operation,Digital musical instruments (digital synthesizers and digital pianos).

Security applications such as DVR and video servers

Characteristics 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 reason such as safety and usability,others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs. Embedded Systems are not always separate devices. Most often they are physically built-in to the devices they control. The software written for embedded systems is often called firmware, and is stored in read-only memory or Flash memory chips rather than a disk drive. It often runs with limited computer hardware resources: small or no keyboard, screen, and little memory. Must be dependable. Reliability R (t) = Probability of system working correctly provided that it was working at t=O. Making the system dependable must not be an afterthought, it must be considered from the very beginning Maintainability M (d) = Probability of system working correctly d time units after error occurred

Availability A (t): Probability o f system working at time t. Safety: No harm to be caused. Security: Confidential and authentic communication. Even perfectly designed systems assumptions about the workload and possible errors turn out to be wrong. Must be efficient Dedicated towards a certain application. Knowledge about behavior at design time can be used to minimize resources and to maximize robustness. Application areas Automotive Electronics Avionics Trains Telecommunication Medical systems Authentication Military applications Robotics Sensor technology Mobile phones Mobile base station Telecom switch

Optical & copper connections Smart welding machine Sewing machine

Challenges for Embedded Systems The obvious ones are security, real-time, scalability, and high availability, but other key challenges exist, such as what w e call performance-based interoperability. Although these complex, ubiquitous systems are glued together with layers of protocols, they still have time constraints and other performance demands that impact how the system will perform. and thereby h o w it will be accepted b y the public. For example, if we have a deadline for sending videos across multiple links, is it really going to get to the people wanting to watch the video in a manner that they can view the video properly? Solving this issue requires meeting time constraints and going through layers of protocols, software mappings, and switches from one kind of network to another, and through layers of software. If the result is a poor quality video, people won't accept the product. Also, for embedded systems to be universal they must be easier to use, and we're starting to see that. For example, with e-mail enabled phones, you might want to go through the Internet and download your e-mail; but you still have to punch in a URL

using the keypad on the phone and then the result is three tiny lines of text on the screen, which is not too exciting. Yet some people like it, and they're using it. Better interfaces will make this application more prevalent. Another challenge for smart environments is safety. For example, in a smart Institution, you won't want to see doors opening and closing at the wrong times, or windows slamming on somebody's hand. Smart environments must be safe environments. In the end, people won't want them if they're not safe, available, and reliable. In fact, smart environments must be as reliable as, say, the power grid. We come in every day, we turn on the lights, and the electricity is there. We need the same kind of performance from these smart spaces Interoperability is an even bigger challenge. The diversity of embedded devices in my opinion, the main challenge is to define a distributed computing model for networked embedded systems. Networking these devices is just the first step. The ultimate goal is to make them cooperate to combine or aggregate their functionalities or resources. Their number and variety is so large that a traditional distributed model simply cannot be applied without causing an overwhelming programming overhead. To keep programming at such a scale manageable, the new computing model must tolerate incomplete results, partial synchronization, and weak consistency. So far,

researchers have proposed scalable solutions for simple cooperative tasks such as routing using content-based addressing which w e rely will make our everyday life extremely difficult, if we cannot have these devices silently cooperate b y exchanging data and tasks. Finally, fault tolerance and security are traditional challenges for any distributed system, and they will ultimately determine the acceptance of embedded technologies by society. Being able to provide an environment that is secure and highly available while still delivering deterministic real-time characteristics is very important. Correctness-getting systems software and applications to run correctly, especially because they're used in many safety critical areas. Another big issue will be scalability, meaning that the industry must face the challenges of designing complex software that scales well with existing Microcontroller solutions for embedded systems. Embedded Systems will play a key role to drive the technological evolution in the next decades. In this respect they stand on the same level as Nano technologies, bioelectronics, and photonics. The central role of Embedded systems in the economy grows stronger and stronger. The starting point is the convergence between storage,security, video, audio, mobility and connectivity. Systems are converging and ICs are more and more converging with systems. This poses a number of

challenges for designers and technologists. A key issue is the definition o f the right methodologies to translate system knowledge and competences into complex embedded systems, taking into account many system requirements and constraints. This means to be able to build the right environment to exploit architectural and technological solution.

INTRODUCTION TO MICROCONTROLLERS
A digital computer typically consists of three major components: the Central Processing Unit(CPU), program and data memory, and an Input/Output (I/O) system. The CPU controls the flow of information among the components of the computer. It also processes the data by performing digital operations. Most of the processing is done in the Arithmetic-Logic Unit (ALU)within the CPU. When the CPU of a computer is built on a single printed circuit board, the computer is called a minicomputer. A microprocessor is a CPU that is compacted into a single-chip semiconductor device. Microprocessors are general-purpose devices, suitable for many applications. A computer built around a microprocessor is called a microcomputer. The choice of I/O and memory devices of a microcomputer depends on the specific application. Forexample, most personal computers contain a keyboard and monitor as standard input and output devices. A microcontroller is an entire computer manufactured on a single chip. Microcontrollers are usually dedicated devices

embedded within an application. For example, microcontrollers are used as engine controllers in automobiles and as exposure and focus controllers in cameras. In order to serve these applications, they have a high concentration of on-chip facilities such as serial ports, parallel input output ports, timers, counters, interrupt control, analog-to-digital converters, random access memory, read only memory, etc. The I/O, memory, and on-chip peripherals of a microcontroller are selected depending on the specifics of the target application. Since microcontrollers are powerful digital processors, the degree of control and programmability they provide significantly enhances the effectiveness of the application.

MICROCONTROLLER v/s MICROPROCESSOR


Microprocessor and microcontroller are two popular terms in world of computer. However,microprocessor and microcontroller has different functions and features. Microprocessors generally require external components or circuits to implement program memory, RAM memory and Input/Output. Intel's 8085, 80386 and Pentium are examples of microprocessors. Microcontrollers incorporate program memory, RAM memory and input/output port into one chip. Microchip's PIC series and Atmel's AVR series are examples of

microcontrollers. One of the main differences is that microcontrollers are usually designed to perform a small set of specific functions, for example as in the case of a Automatic Braking System which performs a small set of input processing functions, whereas microprocessors tend to be designed to perform a wider set of general purpose functions. For example, microcontrollers are widely used in modern cars where they will each perform a dedicated task, i.e. a microcontroller to regulate the brakes on all four wheels, or a microcontroller to regulate the car air conditioning, or a microcontroller for automatic gate systems. These microcontrollers will perform few other tasks (if any) other than those specified. Compare to a microprocessor in a PC which performs a wide range of tasks related to the general requirements of a PC such as performing the necessary calculations for a very wide set of software applications, performing Input/Output for the main subsystems, peripheral control and etc.

TYPES OF MICROCONTROLLERS
The predominant family of microcontrollers are 8-bit types since this word size has proved popular for the vast majority of tasks the devices have been required to perform. The microcontroller family would have a common instruction subset but family

members differ in the amount, and type, of memory, timer facility, port options, etc. possessed, thus producing costeffective devices suitable for particular manufacturing requirements. There are 4 major 8 bit micro controllers. They are Freescale's 6811, Intel's 8051, Zilog's Z8 and PIC 16x from Microchip Technology. Each of these Microcontrollers have a unique set of instruction set and register set; therefore they are not compatible with each other.

8051 MICROCONTROLLER The 8051 is the first microcontroller of the MCS-51 family introduced by Intel Corporation at the end of the 1970s. The 8051 family with its many enhanced members enjoys the largest market share, estimated to be about 40%, among the various microcontroller architectures. The architecture of the 8051 family of microcontrollers is referred to as the MCS-51 architecture, or sometimes simply as MCS-51. The

microcontrollers have an 8-bit data bus. They are capable of addressing 64K of program memory and a separate 64K of data memory. The 8051 has 4K of code memory implemented as onchip Read Only Memory (ROM). The 8051 has 128 bytes of internal Random Access Memory (RAM). It has two timer/counters, a serial port, 4 general purpose parallel input/output ports, and interrupt control logic with five sources of interrupts. Besides internal RAM, the 8051 has various Special Function Registers (SFR), which are the control and data registers for on-chip facilities

COMPARISON OF 8051 FAMILY MEMBERS


Feature 8051 ROM (program space in bytes) 4K RAM (bytes) 128 Timers 2 I/O pins 32 Serial port 1 Interrupt sources 6 8052 8K 256 3 32 1 8 8031 0K 128 2 32 1 6

HARVARD ARCHITECTURE
The Harvard architecture is a computer architecture with physically separate storage and signal pathways for instructions and data. In a Harvard architecture, there is no need to make the two memories share characteristics. In particular, the word width, timing, implementation technology, and memory address structure can differ. In some systems, instructions can be stored in read-only memory while data memory generally requires read-write memory. In some systems, there is much more instruction memory than data memory so instruction addresses are wider than data addresses. The Modified Harvard architecture is very much like the Harvard architecture but

provides a pathway between the instruction memory and the CPU that allows words from the instruction memory to be treated as read-only data. This allows constant data, particularly text strings, to be accessed without first having to be copied into data memory, thus preserving more data memory for read/write variables. Special machine language instructions are provided to read data from the instruction memory. This is by contrast with a Von Neumann architecture computer, in which both instructions and data are stored in the same memory system and (without the complexity of a cache) must be accessed in turn. Microcontrollers (complete computers on a single chip) may use the Modified Harvard architecture for the reasons it was first developed, which are to improve memory access speeds with moderate complexity and to allow the instruction and data memory systems to be implemented independently of each other.

RISC V/S CISC


Complex instruction set computer (CISC, pronounced like "sisk") is a computer instruction set architecture (ISA) in which each instruction can execute several low-level operations, such as a load from memory, an arithmetic operation, and a memory store, all in a single instruction. The term was retroactively coined in contrast to reduced instruction set computer (RISC). The acronym RISC (pronounced as risk), for reduced instruction

set computer, represents a CPU design strategy emphasizing the insight that simplified instructions that "do less" may still provide for higher performance if this simplicity can be utilized to make instructions execute very quickly. For any given level of general performance, a RISC chip will typically have far fewer transistors dedicated to the core logic which originally allowed designers to increase the size of the register set and increase internal parallelism. Other features, which are typically found in RISC architectures are: Uniform instruction format, using a single word with the opcode in the same bit positions in every instruction, demanding less decoding; Identical general purpose registers, allowing any register to be used in any context, simplifying compiler design (although normally there are separate floating point registers); Simple addressing modes. Complex addressing performed via sequences of arithmetic and/or load-store operations; Few data types in hardware, some CISCs have byte string instructions, or support complex numbers; this is so far unlikely to be found on a RISC. Exceptions abound, of course, within both CISC and RISC.

RISC designs are also more likely to feature a Harvard memory model, where the instruction stream and the data stream are conceptually separated; this means that modifying the memory where code is held might not have any effect on the instructions executed by the processor (because the CPU has a separate instruction and data cache), at least until a special synchronization instruction is issued. On the upside, this allows both caches to be accessed simultaneously, which can often improve performance.

8051 ARCHITECTURE
The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited to 8 bits. Some of the features that have made the 8051 popular are: 8-bit data bus 16-bit address bus 32 general purpose registers each of 8 bits 16 bit timers (usually 2, but may have more, or less). 3 internal and 2 external interrupts. Bit as well as byte addressable RAM area of 16 bytes. Four 8-bit ports, (short models have two 8-bit ports).

16-bit program counter and data pointer

PIN DESCRIPTION OF 8051


PIN 9: PIN 9 is the reset pin which is used reset the microcontrollers internal registers and ports upon starting up.2 machine cycle should be high at this pin. PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a crystal at these pins to provide clock pulses to the circuit. PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V 500mA to function properly. PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash memory. In order to program this we need to supply a voltage of +12V at pin 31. If external memory is connected then PIN 31, also called EA/VPP, should be connected to ground to indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is used when multiple memory chips are connected to the controller and only one of them needs to be selected. PIN 29 is called PSEN. This is "program select enable". In order to use the external memory it is required to provide the low voltage (0) on both PSEN and EA pins. Ports There are 4 8-bit ports: P0, P1, P2 and P3.

PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional functions associated with them based upon the context of their usage. PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter inputs, read and write pins for memory access. PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P2 will act as an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8-A15, as can be seen from fig PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P0 acts as a multiplexed address and data bus that can be used to access external memory in conjunction with PORT P2. P0 acts as AD0AD7, as can be seen from fig

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 8051 has due to the shear number of

instructions that make use of the accumulator. More than half of the 8051s 255 instructions manipulate or use the accumulator in some way. The "R" registers The "R" registers are a set of eight registers that are named R0, R1, etc. up to and including R7.These registers are used as auxillary registers in many operations. 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. Thus, if you want to quickly and easily multiply or divide A by another number, you may store the other number in "B" and make use of these two instructions.Aside from the MUL and DIV instructions, the "B" register is often used as yet another temporary storage register much like a ninth "R" register. The Data Pointer (DPTR) The Data Pointer (DPTR) is the 8051s only user-accessable 16bit (2-byte) register. The Accumulator, "R" registers, and "B" register are all 1-byte values. DPTR, as the name suggests, is used to point to data. It is used

by a number of commands which allow the 8051 to access external memory. When the 8051 accesses external memory it will access external memory at the address indicated by DPTR. 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. It is important to note that PC isnt always incremented by one. Since some instructions require 2 or 3 bytes the PC will be incremented by 2 or 3 in these cases.The Program Counter is special in that there is no way to directly modify its value. The Stack Pointer (SP) The Stack Pointer, like all registers except DPTR and PC, may hold an 8-bit (1-byte) value. The Stack Pointer is used to indicate where the next value to be removed from the stack should be taken from. When you push a value onto the stack, the 8051 first increments the value of SP and then stores the value at the resulting memory location.When you pop a value off the stack, the 8051 returns the value from the memory location indicated by SP, and then decrements the value of SP. This order of operation is important. When the 8051 is

initialized SP will be initialized to 07h. If you immediately push a value onto the stack, the value will be stored in Internal RAM address 08h. This makes sense taking into account what was mentioned two paragraphs above: First the 8051 will increment the value of SP (from 07h to 08h) and then will store the pushed value at that memory address (08h).

SPECIAL FUNCTION REGISTER The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF. This area of memory cannot be used for data or program storage, but is instead a series of memory-mapped ports and registers. All port input and output can therefore be performed by memory mov operations on specified addresses in the SFR. Also, different status registers are mapped into the SFR, for use in checking the status of the 8051, and changing some operational parameters of the 8051. The 4 ports, register A,B, and stack pointer SP have already been explained above. The rest of the SFR are explained below. DPL/DPH (Data Pointer Low/High, Addresses 82h/83h): The SFRs DPL and DPH work together to represent a 16-bit

value called the Data Pointer. The data pointer is used in operations regarding external RAM and some instructions involving code memory. Since it is an unsigned two-byte integer value, it can represent values from 0000h to FFFFh (0 through 65,535 decimal)

PCON (Power Control, Addresses 87h): The Power Control SFR is used to control the 8051's power control modes. Certain operation modes of the 8051 allow the 8051 to go into a type of "sleep" mode which requires much less power. These modes of operation are controlled through PCON. Additionally, one of the bits in PCON is used to double the effective baud rate of the 8051's serial port.

TCON (Timer Control, Addresses 88h, Bit-Addressable): The Timer Control SFR is used to configure and modify the way in which the 8051's two timers operate. This SFR controls whether each of the two timers is running or stopped and contains a flag to indicate that each timer has overflowed.

Additionally, some non-timer related bits are located in the TCON SFR. These bits are used to configure the way in which the external interrupts are activated and also contain the external interrupt flags which are set when an external interrupt has occured.

TMOD (Timer Mode, Addresses 89h): The Timer Mode SFR is used to configure the mode of operation of each of the two timers. Using this SFR your program may configure each timer to be a 16-bit timer, an 8-bit autoreload timer, a 13-bit timer, or two separate timers. Additionally, you may configure the timers to only count when an external pin is activated or to count "events" that are indicated on an external pin.

TL0/TH0 (Timer 0 Low/High, Addresses 8Ah/8Ch): These two SFRs, taken together, represent timer 0. Their exact behavior depends on how the timer is configured in the TMOD SFR; however, these timers always count up. What is configurable is how and when they increment in value. TL1/TH1 (Timer 1 Low/High, Addresses 8Bh/8Dh): These two SFRs, taken together, represent timer 1. Their exact behavior depends on how the timer is configured in the TMOD SFR;

however, these timers always count up. What is configurable is how and when they increment in value. SCON (Serial Control, Addresses 98h, Bit-Addressable):

The Serial Control SFR is used to configure the behavior of the 8051's on-board serial port. This SFR controls the baud rate of the serial port, whether the serial port is activated to receive data, and also contains flags that are set when a byte is successfully sent or received..

SBUF (Serial Control, Addresses 99h): The Serial Buffer SFR is used to send and receive data via the on-board serial port. Any value written to SBUF will be sent out the serial port's TXD pin. Likewise, any value which the 8051 receives via the serial port's RXD pin will be delivered to the user program via SBUF. In other words, SBUF serves as the output port when written to and as an input port when read

from. IE (Interrupt Enable, Addresses A8h): The Interrupt Enable SFR is used to enable and disable specific interrupts. The low 7 bits of the SFR are used to enable/disable the specific interrupts, where as the highest bit is used to enable or disable ALL interrupts. Thus, if the high bit of IE is 0 all interrupts are disabled regardless of whether an individual interrupt is enabled by setting a lower bit.

IP (Interrupt Priority, Addresses B8h, Bit-Addressable): The Interrupt Priority SFR is used to specify the relative priority of each interrupt. On the 8051, an interrupt may either be of low (0) priority or high (1) priority. An interrupt may only interrupt interrupts of lower priority. For example, if we configure the 8051 so that all interrupts are of low priority except the serial interrupt, the serial interrupt will always be able to interrupt the system, even if another interrupt is currently executing.

However, if a serial interrupt is executing no other interrupt will be able to interrupt the serial interrupt routine since the serial interrupt routine has the highest priority.

PSW (Program Status Word, Addresses D0h, Bit-Addressable): The Program Status Word is used to store a number of important bits that are set and cleared by 8051 instructions. The PSW SFR contains the carry flag, the auxiliary carry flag, the overflow flag, and the parity flag. Additionally, the PSW register contains the register bank select flags which are used to select which of the "R" register banks are currently selected.

TYPES OF MEMORY
The 8051 has three very general types of memory. To effectively program the 8051 it is necessary to have a basic understanding

of these memory types. The memory types are illustrated in the following graphic. They are: On-Chip Memory, External Code Memory, and External RAM.

On-Chip Memory refers to any memory (Code, RAM, or other) that physically exists on the microcontroller itself. On-chip memory can be of several types, but we'll get into that shortly.

External Code Memory is code (or program) memory that resides off-chip. This is often in the form of an external EPROM.

External RAM is RAM memory that resides off-chip. This is often in the form of standard static RAM or flash RAM.

ADDRESSING MODES
An "addressing mode" refers to how you are addressing a given memory location. In summary, the addressing modes are as follows, with an example of each:

Immediate addressing Immediate addressing is so-named because the value to be stored in memory immediately follows the operation code in memory. That is to say, the instruction itself dictates what value will be stored in memory. For example, the instruction: MOV A,#20h This instruction uses Immediate Addressing because the Accumulator will be loaded with the value that immediately follows; in this case 20 (hexidecimal).Immediate addressing is very fast since the value to be loaded is included in the instruction. However, since the value to be loaded is fixed at compile-time it is not very flexible.

Direct Addressing Direct addressing is so-named because the value to be stored in memory is obtained by directly retrieving it from another memory location. For example:

MOV A,30h This instruction will read the data out of Internal RAM address 30 (hexidecimal) and store it in the Accumulator. Direct addressing is generally fast since, although the value to be loaded isnt included in the instruction, it is quickly accessable since it is stored in the 8051s Internal RAM. It is also much more flexible than Immediate Addressing since the value to be loaded is whatever is found at the given address-which may be variable. Also, it is important to note that when using direct addressing any instruction which refers to an address between 00h and 7Fh is referring to Internal Memory. Any instruction which refers to an address between 80h and FFh is referring to the SFR control registers that control the 8051 microcontroller itself.

Register addressing The register banks, containing registers R0 through R7, can be accessed by certain instructions which carry a 3-bit register specification within the opcode of the instruction. Instructions

that access the registers this way are code efficient, since this mode eliminates an address byte. When the instruction is executed, one of the eight registers in the selected bank is accessed. One of four banks is selected at execution time by the two bank select bits in the PSW.

Register indirect addressing Indirect addressing is a very powerful addressing mode which in many cases provides an exceptional level of flexibility. Indirect addressing is also the only way to access the extra 128 bytes of Internal RAM found on an 8052. Indirect addressing appears as follows: MOV A,@R0 This instruction causes the 8051 to analyze the value of the R0 register. The 8051 will then load the accumulator with the value from Internal RAM which is found at the address indicated by R0.

Indexed addressing Used in accessing data elements of look up table entries located

in the program ROM space of 8051 eg. MOVC A@A+DPTR

TIMERS
The 8051 comes equipped with two timers, both of which may be controlled, set, read, and configured individually. The 8051 timers have three general functions: 1) Keeping time and/or calculating the amount of time between events, 2) Counting the events themselves, or 3) Generating baud rates for the serial port. As mentioned before, the 8051 has two timers which each function essentially the same way. One timer is TIMER0 and the other is TIMER1. The two timers share two SFRs (TMOD and TCON) which control the timers, and each timer also has two SFRs dedicated solely to itself (TH0/TL0 and TH1/TL1).

13-bit Time Mode (mode 0) Timer mode "0" is a 13-bit timer. This is a relic that was kept around in the 8051 to maintain compatability with its predecesor, the 8048. Generally the 13-bit timer mode is not used in new development.When the timer is in 13-bit mode, TLx will count from 0 to 31. When TLx is incremented from 31, it will "reset" to 0 and increment THx. Thus, effectively, only 13 bits of the two timer bytes are being used: bits 0-4 of TLx and bits 0-7 of THx. This also means, in essence, the timer can only contain 8192 values. If you set a 13-bit timer to 0, it will overflow back to zero 8192 machine cycles later. 16-bit Time Mode (mode 1) Timer mode "1" is a 16-bit timer. This is a very commonly used mode. It functions just like 13-bit mode except that all 16 bits are used. TLx is incremented from 0 to 255. When TLx is incremented from 255, it resets to 0 and causes THx to be incremented by 1.

Since this is a full 16-bit timer, the timer may contain up to 65536 distinct values. If you set a 16-bit timer to 0, it will overflow back to 0 after 65,536 machine cycles. 8-bit Time Mode (mode 2) Timer mode "2" is an 8-bit auto-reload mode. What is that, you may ask? Simple. When a timer is in mode 2, THx holds the "reload value" and TLx is the timer itself. Thus, TLx starts counting up. When TLx reaches 255 and is subsequently incremented, instead of resetting to 0 (as in the case of modes 0 and 1), it will be reset to the value stored in THx. For example, lets say TH0 holds the value FDh and TL0 holds the value FEh. If we were to watch the values of TH0 and TL0 for a few machine cycles this is what wed see:As you can see, the value of TH0 never changed. In fact, when you use mode 2 you almost always set THx to a known value and TLx is the SFR that is constantly incremented. Split Timer Mode (mode 3) Timer mode "3" is a split-timer mode. When Timer 0 is placed in mode 3, it essentially becomes two separate 8-bit timers. That is to say, Timer 0 is TL0 and Timer 1 is TH0. Both timers count from 0 to 255 and overflow back to 0. All the bits that are related to Timer 1 will now be tied to TH0. While Timer 0 is in split mode, the real Timer 1 (i.e. TH1 and

TL1) can be put into modes 0, 1 or 2 normally--however, you may not start or stop the real timer 1 since the bits that do that are now linked to TH0. The real timer 1, in this case, will be incremented every machine cycle no matter what.

INTERRUPTS
As the name implies, an interrupt is some event which interrupts normal program execution. As stated earlier, program flow is always sequential, being altered only by those instructions which expressly cause program flow to deviate in some way. However, interrupts give us a mechanism to "put on hold" the normal program flow, execute a subroutine, and then resume normal program flow as if we had never left it. This subroutine, called an interrupt handler, is only executed when a certain event (interrupt) occurs. The event may be one of the timers "overflowing," receiving a character via the serial port, transmitting a character via the serial port, or one of two "external events." The 8051 may be configured so that when any of these events occur the main program is temporarily suspended and control passed to a special section of code which presumably would execute some function related to the event that occured. Once complete, control would be returned to the original program.

The main program never even knows it was interrupted. The ability to interrupt normal program execution when certain events occur makes it much easier and much more efficient to handle certain conditions. If it were not for interrupts we would have to manually check in our main program whether the timers had overflown, whether we had received another character via the serial port, or if some external event had occured. Besides making the main program ugly and hard to read, such a situation would make our program inefficient since wed be burning precious "instruction cycles" checking for events that usually dont happen. We can configure the 8051 so that any of the following events will cause an interrupt: Timer 0 Overflow. Timer 1 Overflow. Reception/Transmission of Serial Character. External Event 0. External Event 1. In other words, we can configure the 8051 so that when Timer 0 Overflows or when a character is sent/received, the appropriate interrupt handler routines are called.

Polling Sequence The 8051 automatically evaluates whether an interrupt should occur after every instruction. When checking for interrupt conditions, it checks them in the following order: External 0 Interrupt Timer 0 Interrupt External 1 Interrupt Timer 1 Interrupt Serial Interrupt This means that if a Serial Interrupt occurs at the exact same instant that an External 0 Interrupt occurs, the External 0 Interrupt will be executed first and the Serial Interrupt will be executed once the External 0 Interrupt has completed.

SERIAL PORT COMMUNICATION

One of the 8051s many powerful features is its integrated UART, otherwise known as a serial port. The fact that the 8051 has an integrated serial port means that you may very easily read and write values to the serial port. If it were not for the integrated serial port, writing a byte to a serial line would be a rather tedious process requring turning on and off one of the I/O lines in rapid succession to properly "clock out" each individual bit, including start bits, stop bits, and parity bits. However, we do not have to do this. Instead, we simply need to configure the serial ports operation mode and baud rate. Once configured, all we have to do is write to an SFR to write a value to the serial port or read the same SFR to read a value from the serial port. The 8051 will automatically let us know when it has finished sending the character we wrote and will also let us know whenever it has received a byte so that we can process it. We do not have to worry about transmission at the bit level-which saves us quite a bit of coding and processing time The first thing we must do when using the 8051s integrated serial port is, obviously, configure it. This lets us tell the 8051 how many data bits we want, the baud rate we will be using, and how the baud rate will be determined. First, lets present the "Serial Control" (SCON) SFR and define what each bit of the SFR represents:

INTRODUCTION TO ROBOTICS

DEFINITION:

A Robot is software-controllable mechanical device that Uses sensors to guide one or more end-effectors through programmed motions in workspace in order to manipulate physical objects. Many of today's robots are robotic arms. In this exhibit, we will focus on one very "flexible" kind of robot, which looks similar to a certain part of your body. It is called a jointed-arm robot.

ROBOT APPLICATION :- Robotic applications often involve simple, tedious, repetitive tasks such as the loading and unloading of machines. They also include tasks that must be performed in harsh or unhealthy environments such as spray panting and handling of toxic materials. MAIN PARTS OF ROBOT 1) CONTROLLER

2) SENSORS 3) ARM 4) END-EFFECTOR 5) DRIVE


CONTROLLER:-Every

robot is connected to a computer, which keeps the pieces of the arm working together. This computer is known as the controller. The controller functions as the "brain" of the robot. The controller also allows the robot to be networked to other systems, so that it may work together with other machines, processes, or robots. SENSORS: The sensor sends information; in the form of electronic signals back the state of the world around it. Sight, sound, touch, taste, and smell are the kinds of information we get from our world. Robots can be designed and programmed to get specific information that is beyond what our 5 senses can tell us. For instance, a robot sensor might "see" in the dark, detect tiny amounts of invisible radiation or measure movement that is too small or fast for the human eye to see.

Logical sensors: - One powerful abstraction of a sensor is a logical sensor, which is a unit of sensing or module that supplies a particular percept. It consists of the signal processing, from the physical sensor, and the software processing needed to extract the percept. Proprioceptive sensors: - Proprioception is dead reckoning, where the robot measures a signal originating within itself. Proximity sensors: - A proximity sensor measures the relative distance between the sensor and objects in the environment. Infrared (IR) sensors: - Another type of active proximity an infrared sensor. It emits near-infrared energy and measures whether any significant amount of the IR light is returned. Bump and feeler sensors: - Another popular class of robotic sensing is tactile, or touch-based, done with a bump and feeler sensor. Feelers or whiskers are constructed from sturdy wires. A bump sensor is usually a protruding ring around the robot consisting of two layers.

ARM The arm is the part of the robot that positions it do their preprogrammed business. Many (but not all) resemble human arms, and have shoulders, elbows, and wrists, even fingers. This gives the robot a lot of ways to position itself in its environment. Each joint is said to give the robot 1 degree of freedom. So, a simple robot arm with 3 degrees of freedom could move in 3 ways: up and down, left and right, forward and backward. Most working robots today have 6 degree of freedom. END- EFFECTOR The End- Effector is the "hand" connected to the robot's arm. It is often different from a human hand - it could be a tool such as a gripper, a vacuum pump, tweezers, scalpel, blowtorch - just about anything that helps it do its job. Some robots can change end-effectors, and be reprogrammed for a different set of tasks. If the robot has more than one arm there can be more than one end-effector on the same robot, each suited for a specific task. DRIVE The drive is the "engine" that drives the links (the sections

between the joints into their desired position. Without a drive, a robot would just sit there, which is not often helpful. Most drives are powered by air, water Pressure or electricity.

Driving Mechanism Gears and chains :-Gears and chains are mechanical platforms that provide a strong and accurate way to transmit rotary motion from one place to another, possibly changing it along the way. The speed change between two gears depends upon the number of teeth on each gear. When a powered gear goes through a full rotation, it pulls the chain by the number of teeth on that gear. Pulleys and belts :-Pulleys and belts, two other types of mechanical platforms used in robots, work the same way as gears and chains. Pulleys are wheels with a groove around the edge, and belts are the rubber loops that fit in that groove. Gearboxes :-A gearbox operates on the same principles as the gear and chain, without the chain. Gearboxes require closer tolerances, since instead of using a large loose chain to transfer force and adjust for misalignments, the gears mesh directly with each other. Examples of gearboxes can be found on the transmission in a car.

HOW ROBOT WORKS The inspiration for the design of a robot manipulator is the human arm, but with some differences. For example, a robot arm can extend by telescoping that is, by sliding cylindrical sections one over another to lengthen the arm. Robot arms also can be constructed so that they bend like an elephant trunk. Grippers, or end effectors, are designed to mimic the function and structure of the human hand. Many robots are equipped with special purpose grippers to grasp particular devices such as a rack of test tubes or an arc-welder. The joints of a robotic arm are usually driven by electric motors. In most robots, the gripper is moved from one position to another, changing its orientation. A computer calculates the joint angles needed to move the gripper to the desired position in a process known as inverse kinematics. Some multi-jointed arms are equipped with servo, or feedback, controllers that receive input from a computer. Each joint in the arm has a device to measure its angle and send that value to the controller. If the actual angle of the arm does not equal the computed angle for the desired position,

the servo controller moves the joint until the arm's angle matches the computed angle. Controllers and associated computers also must process sensor information collected from cameras that locate objects to be grasped, or they must touch sensors on grippers that regulate the grasping force. Any robot designed to move in an unstructured or unknown environment will require multiple sensors and controls, such as ultrasonic or infrared sensors, to avoid obstacles. Robots, such as the National Aeronautics and Space Administration (NASA) planetary rovers, require a multitude of sensors and powerful onboard computers to process the complex information that allows them mobility. This is particularly true for robots designed to work in close proximity with human beings, such as robots that assist persons with disabilities and robots that deliver meals in a hospital. Safety must be integral to the design of human service robots.

REFERENCES : Michael Barr. "Embedded Systems Glossary". Neutrino Technical Library. Retrieved 2007-04-21. Heath, Steve (2003). Embedded systems design. EDN series for design engineers (2 ed.). Newnes. p. 2. ISBN 9780750655460. "An embedded system is a microprocessor based system that is built to control a function or a range of functions." Michael Barr; Anthony J. Massa (2006). "Introduction". Programming embedded systems: with C and GNU development tools. O'Reilly. pp. 12. ISBN 9780596009830.

Giovino, Bill. "Micro controller.com - Embedded Systems supersite". Embedded.com - Under the Hood: Robot Guitar embeds autotuning By David Carey, TechOnline EE

Times (04/22/08, 11:10:00 AM EDT)Embedded Systems Design - Embedded.com Your System is secure? Prove it!, Gernot Heiser, December 2007, Vol. 2 No. 6 Page 35-38, ;login: The USENIX Magazine "Working across Multiple Embedded Platforms". clarinox. Retrieved 2010-08-17.

You might also like