Sei sulla pagina 1di 68

MEMS BASED WHEEL CHAIR

MEMS BASED WHEEL CHAIR

MEMS BASED WHEEL CHAIR

Technical Specifications
Title of the project Domain Software Microcontroller Power Supply Display Crystal Software Developed By Phone : : : : : : : : : : MEMS Based Wheel Chair For Handicapped People Embedded Systems Design Embedded C, Keil AT89s52 +5V, 500mA Regulated Power Supply LED 5mm, 16 X 2 LCD 11.0592 MHz Keil, Ucflash CMC Limited, Dilsukhnagar 8099050333,cmc.yesprojects@gmail.com

MEMS BASED WHEEL CHAIR

ABSTRACT
Keep Ur Abstract

MEMS BASED WHEEL CHAIR


INTRODUCTION TO EMBEDDED SYSTEMS

An embedded system is a computer system designed for specific control functions within a larger system. Often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range of end-user needs. Embedded systems control many devices in common use today. Embedded systems contain processing cores that are typically either microcontrollers or digital signal processors (DSP). The key characteristic, however, is being dedicated to handle a particular task. They may require very powerful processors and extensive communication, for example air traffic control systems may usefully be viewed as embedded, even though they involve mainframe computers and dedicated regional and national networks between airports and radar sites (each radar probably includes one or more embedded systems of its own).Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. In general, "embedded system" is not a strictly definable term, as most systems have some element of extensibility or programmability. For example, handheld computers share some elements with embedded systems such as the operating systems and microprocessors that power them, but they allow different applications to be loaded and peripherals to be connected. Moreover, even systems that do not expose programmability as a primary feature generally need to support software updates. On a continuum from "general purpose" to "embedded", large application systems will have subcomponents at most points even if the system as a whole is "designed to perform one or a few dedicated functions", and is thus appropriate to call embedded.

MEMS BASED WHEEL CHAIR Embedded systems are especially suited for use in transportation, fire safety, safety and security, medical applications and life critical systems as these systems can be isolated from hacking and thus be more reliable. For fire safety, the systems can be designed to have greater ability to handle higher temperatures and continue to operate. In dealing with security, the embedded systems can be self-sufficient and be able to deal with cut electrical and communication systems. The purpose of this project is to provide the security in four ways: automatic gate opening/closing system at track crossing, signaling for the train driver, tracking the signals, and the track protection. The railroad industrys own desire to maintain their ability to provide safe and secure transport of their customers hazardous materials, has introduced new challenges in rail security. Addressing these challenges is important, as railroads, and the efficient delivery of their cargo, play a vital role in the economy of the country. The automatic gate opening/closing system is provided with the IR sensors placed at a distance of few kilometers on the both sides from the crossing road. These sensors give the train reaching and leaving status to the embedded controller at the gate to which they are connected. The controller operates (open/close) the gate as per the received signal from the IR sensors. MICROCONTROLLERS FOR EMBEDDED SYSTEM In the Literature discussing microprocessors, we often see the term Embedded System. Microprocessors and Microcontrollers are widely used in embedded system products. An embedded system product uses a microprocessor (or Microcontroller) to do one task only. A printer is an example of embedded system since the processor inside it performs one task only; namely getting the data and printing it. Contrast this with a Pentium based PC. A PC can be used for any number of applications such as word processor, print-server, bank teller terminal, Video game, network server, or Internet terminal. Software for a variety of applications can be loaded and run. Of course the reason a pc can perform myriad tasks is that it has RAM memory and an operating system that loads the application software into RAM memory and lets the CPU run it. In an Embedded system, there is only one application software that is typically burned into ROM. An x86 PC contains or is connected to various embedded products such as keyboard, printer, modem, disk controller, sound card, CD-ROM drives, mouse, and so on. Each one of these peripherals has a Microcontroller inside it that performs only one task. For example, inside

MEMS BASED WHEEL CHAIR every mouse there is a Microcontroller to perform the task of finding the mouse position and sending it to the PC. APPLICATIONS OF EMBEDDED SYSTEMS i. Military and aerospace ii. Communications applications iii. Electronics applications and consumer devices

MEMS BASED WHEEL CHAIR

LITERATURE SURVEY
Literature review is needed before any project is begun. The review will help to understanding the scope of the project and also the need to build the project. The review comes from the reading on the websites and also from the books. The information from the review will be used to start the project with an excellent idea. The review is also obtained from the sample of the existing project in the websites. EXISTING SYSTEM In order to take the old people from one particular place to another particular place any one should accompany them or they must have any particular person in order to move them .

PROPOSED SYSTEM In this proposed system we are implementing the wheel chair for the handicapped people or the old age people ,an MEMS sensor is attached to that particular chair ,if the handicapped people want to move forward, backward, left, right then if he tilts the sensor in accordance of the directions then vehicle moves in the particular direction.

MEMS BASED WHEEL CHAIR BLOCK DIAGRAM

POWER SUPPLY

H-Bridge

AT89s52 Robotic Platform

MEMS Sensor

MEMS BASED WHEEL CHAIR BLOCK DIAGRAM DESCRIPITION Microcontroller The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with 8Kbytes of in-system programmable Flash memory. The device is manufactured. Using Atmels high-density non-volatile memory technology and is compatible with the industry-standard 80C51 micro controller. Power Supply The power supply are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. A d.c power supply which maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is known as Regulated D.C Power Supply H-Bridge DC motors are typically controlled by using a transistor configuration called an "H-bridge". This consists of a minimum of four mechanical or solid-state switches, such as two NPN and two PNP transistors. One NPN and one PNP transistor are activated at a time. Both NPN and PNP transistors can be activated to cause a short across the motor terminals, which can be useful for slowing down the motor from the back EMF it creates. DC Motor Motors are the devices that provide the actual speed and torque in a drive system. This family includes AC motor types (single and multiphase motors, universal, servo motors, induction, synchronous, and gear motor) and DC motors (brush less, servo motor, and gear motor) as well as linear, stepper and air motors, and motor contactors and starters. In any electric motor, operation is based on simple electromagnetism. A current-carrying conductor generates a magnetic field; when this is then placed in an external magnetic field, it will experience a force proportional to the current in the conductor, and to the strength of the external magnetic field. As you are well aware of from playing with magnets as a kid, opposite

MEMS BASED WHEEL CHAIR (North and South) polarities attract, while like polarities (North and North, South and South) repel. The internal configuration of a DC motor is designed to harness the magnetic interaction between a current-carrying conductor and an external magnetic field to generate rotational motion..

Basic Theory
H-bridge. Sometimes called a "full bridge" the H-bridge is so named because it has four switching elements at the "corners" of the H and the motor forms the cross bar. The key fact to note is that there are, in theory, four switching elements within the bridge. These four elements are often called, high side left, high side right, low side right, and low side left (when traversing in clockwise order). The switches are turned on in pairs, either high left and lower right, or lower left and high right, but never both switches on the same "side" of the bridge. If both switches

MEMS BASED WHEEL CHAIR

HARDWARE DESCRIPTION
MICROCONTROLLER The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with 8Kbytes of in-system programmable Flash memory. The device is manufactured. Using Atmels high-density non-volatile memory technology and is compatible with the industrystandard 80C51 micro controller. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable flash one monolithic chip; the Atmel AT89S52 is a powerful micro controller, which provides a highly flexible and cost-effective solution to many embedded control applications.[3] Major Features of AT89S52 Compatible with MCS-51 Products 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256K Internal RAM 32 Programmable I/O Lines 3 16-bit Timer/Counters Eight Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Now we may be wondering about the non-mentioning of memory space meant for the program storage, the most important part of any embedded controller. Originally this 8051 architecture was introduced with on-chip, one time programmable version of

MEMS BASED WHEEL CHAIR Program Memory of size 4K X 8. Intel delivered all these microcontrollers (8051) with users program fused inside the device. Architecture of microcontroller AT89S52

Block Diagram of the AT89S52. So, very soon Intel introduced the 8052 devices with re-programmable type of Program Memory using built-in EPROM of size 4K X 8. Like a regular EPROM, this memory can be re-programmed many times. Later on Intel started manufacturing these 8031 devices without any on chip Program Memory.

MEMS BASED WHEEL CHAIR PIN DIAGRAM & DESCRIPTION

Pin diagram of the AT89S52 The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. Pin description of microcontroller 89s52 VCC - Supply voltage. GND - Ground.

MEMS BASED WHEEL CHAIR Port 0 Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification. Port 1 Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 Output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification. Port 2 Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various

MEMS BASED WHEEL CHAIR special features of the AT89S52, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification.

Port pins and their Alternative functions RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG Address Latch Enable (ALE) 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 of1/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 micro controller is in external execution mode. PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each

MEMS BASED WHEEL CHAIR machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. A should be strapped to VCC for internal program executions. This pin also receives the 12-voltProgramming enables voltage (VPP) during Flash programming. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier.

Oscillator Connections REGISTERS

External Clock

A number of 8052 registers can be considered "basic." Very little can be done without them and a detailed explanation of each one is warranted to make sure the reader understands these registers before getting into more complicated areas of

MEMS BASED WHEEL CHAIR The Accumulator If you've worked with any other assembly language you will be familiar with the concept of an accumulator register. 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 8052 has due to the sheer number of instructions that make use of the accumulator. More than half of the 8052's 255 instructions manipulate or use the Accumulator in some way. For example, if you want to add the number 10 and 20, the resulting 30 will be stored in the Accumulator. Once you have a value in the Accumulator you may continue processing the value or you may store it in another register or in memory. The B registers 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 implicitly by two 8052 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 are often used as yet another temporary storage register much like a ninth "R" register. The Program Counter The Program Counter (PC) is a 2-byte address that tells the 8052 where the next instruction to execute is found in memory. When the 8052 is initialized PC always starts at 0000h and is incremented each time an instruction is executed. It is important to note that PC isn't always incremented by one. Since some instructions are 2 or 3 bytes in length 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. That is to say, you can't do something like PC=2430h. On the other hand, if you execute LJMP 2430h you've effectively accomplished the same thing. The data pointer The Data Pointer (DPTR) is the 8052s only user-accessible 16-bit (2-byte) register. The Accumulator, "R" registers, and "B" register are all 1-byte values. The PC just described is a 16bit value but isn't directly user-accessible as a working register. DPTR, as the name suggests, is

MEMS BASED WHEEL CHAIR used to point to data. It is used by a number of commands that allow the 8052 to access external memory. The program counter and stack pointer The program counter (PC) is a 2-byte address, which tells the 8051 where the next instruction to execute is found in memory. The stack pointer like all registers except DPTR and PC may hold an 8-bit (1-Byte) value Addressing modes An addressing mode refers that you are addressing a given memory location. In summary, the addressing modes are as follows, with an example of each: Each of these addressing modes provides important flexibility. Immediate Direct Indirect Indexed Addressing Addressing Addressing Addressing MOVX A, @DPTR MOVC A, @A+DPTR MOV A, #20 H MOV A, 30 H MOV A, @R0

a. External Direct b. Code In direct 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(hexadecimal). 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

MEMS BASED WHEEL CHAIR This instruction will read the data out of internal RAM address 30(hexadecimal) 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 accessible 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 variable. Also it is important to note that when using direct addressing any instruction that refers to an address between 00h and 7Fh is referring to the SFR control registers that control the 8051 micro controller itself. 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 the 8052. Indirect addressing appears as follows: MOV A, @R0: This instruction causes the 8051 to analyze Special Function Register (SFR) Memory: Special Function Registers (SFRs) are areas of memory that control specific functionality of the 8051 processor. For example, four SFRs permit access to the 8051s 32 input/output lines. Another SFR allows the user to set the serial baud rate, control and access timers, and configure the 8051s interrupt system. Special Function Registers (SFRs) SFRs are areas of memory that control specific functionality of the 8051 processor. For example, four SFRs permit access to the 8051s 32 input/output lines. Another SFR allows the user to set the serial baud rate, control and access timers, and configure the 8051s interrupt system. Interrupt Registers The individual interrupt enable bits are in the IE register . Two priorities can be set for each of the six interrupt sources in the IP register Timer 2 Timer 2 is a 16-bit Timer / Counter that can operate as either a timer or an event counter. The type of operation is selected by bit C/T2 in the SFR T2CON . Timer 2 has

MEMS BASED WHEEL CHAIR three operating Modes : capture , auto-reload ( up or down Counting ) , and baud rate

generator . The modes are selected by bits in T2CON . Timer 2 consists of two 8-bit registers , TH2 and TL2 . In the Timer function , the TL2 register is incremented every machine cycle . Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. In the Counter function , the register is incremented in response to a 1-to-0 transition at its corresponding external input pin , T2 .When the

samples show a high in one cycle and a low in the next cycle, the count is incremented . Since two machine cycles (24 Oscillator periods ) are required to recognize 1-to-0

transition , the maximum count rate is 1 / 24 of the oscillator frequency . To ensure that a given level is sampled at least once before it changes , the level should be held for at least one full machine cycle .

Capture Mode In the capture mode , two options are selected by bit EXEN2 in T2CON . If EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON . This bit can then be used to generate an interrupt. If EXEN2 = 1 , Timer 2 performs the same operation , but a 1-to-0 transition at external input T2EX also causes the current value respectively Auto-reload (Up or Down Counter) Timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload mode. This feature is invoked by the DCEN (Down Counter Enable) bit located in the SFR T2MOD . Upon reset , the DCEN bit is set to 0 so that timer 2 will default to count up. When DCEN in TH2 and TL2 to be captured into RCAP2H and RCAP2L ,

is set , Timer 2 can count up or down , depending on the value of the T2EX pin . In this mode , two options are selected by bit EXEN2 in T2CON . If EXEN2 = 0 , Timer 2 counts up to 0FFFFH and then sets the TF2 bit upon overflow . If EXEN2 = 1 , a 16bit reload can be triggered either by an overflow or by a 1-to-0 transition at external input T2EX. Baud Rate Generator Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON . Note that the baud rates for transmit and receive can be different if Timer

MEMS BASED WHEEL CHAIR 2 is used for the receiver or transmitter and Timer 1 is used for the other function .The baud rates in Modes 1 and 3 are determined by Timer 2s over flow rate according to the following equation . Modes 1 and 3 Baud Rates =Timer 2 Overflow Rate/16 The timer operation is different for Timer 2 when it is used as a baud rate generator .Normally ,as a timer , it increments every machine cycle (at 1/12 the oscillator frequency).As a baud rate generator , however, it increments every state time ( at 1/2 the oscillator frequency ) . Timer 0 Timer 0 functions as either a timer or event counter in four modes of operation . Timer 0 is controlled by the four lower bits of the TMOD register and bits 0, 1, 4 and 5 of the TCON register Mode 0 (13-bit Timer) Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit timer (TH0 register) with a modulo 32 prescaler implemented with the lower five bits of the TL0 register . The upper three bits of TL0 register are indeterminate and should be ignored . Prescaler overflow increments the TH0 register. Mode 1 ( 16-bit Timer ) Mode 1 is the same as Mode 0, except that the Timer register is being run with all 16 bits . Mode 1 configures timer 0 as a 16-bit timer with the TH0 and TL0 registers connected in cascade . The selected input increments the TL0 register . Mode 2 (8-bit Timer with Auto-Reload) Mode 2 configures timer 0 as an 8-bit timer ( TL0 register ) that automatically reloads from the TH0 register . TL0 overflow sets TF0 flag in the TCON register and reloads TL0 with the contents of TH0 , which is preset by software .

Mode 3 ( Two 8-bit Timers ) Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8bit timers. This mode is provided for applications requiring an additional 8-bit timer or counter .

MEMS BASED WHEEL CHAIR Timer 1 Timer 1 is identical to timer 0 , except for mode 3 , which is a hold-count mode . Mode 3 ( Halt ) Placing Timer 1 in mode 3 causes it to halt and hold its count . This can be used to halt Timer 1 when TR1 run control bit is not available i.e. , when Timer 0 is in mode 3 . SERIAL COMMUNICATION Serial data communication uses two methods, asynchronous and synchronous. The

synchronous method transfers a block of data at a time, while the asynchronous method transfers a single byte at a time. Data transfer rate The rate of data transfer in serial data communication is stated in bps (bits per second). Another widely used terminology for bps is baud rate. However, the baud and bps rates are not necessarily equal. This is due to the fact that baud rate is the modem terminology and is defined as the number of signal changes per second. In modems a single change of signal, sometimes transfers several bits of data. As far as the conductor wire is concerned, the baud rate and bps are the same, and for this reason we use the bps and baud interchangeably.

DB-9 pin connector

DB-9 pin connector

MEMS BASED WHEEL CHAIR

TXD

RXD TXD

2 3 5

Embedded Controller

RXD GND

MAX 232

Interfacing of MAX-232

INTERRUPTS An Interrupt is a planned diversion from the program flow. Up on occurrence of an interrupt the controller vectors the control to the Interrupt Service Routine Interrupt Service Routine For every interrupt, there must be an interrupt service routine (ISR), or interrupt handler. When an interrupt is invoked, the micro controller runs theISR. For every interrupt, there is a fixed location in memory that holds the address of its ISR. The group of memory location set aside to hold the addresses of ISRs is interrupt vector table. Interrupt Vector Table for the 8051 INTERRUPT ROM (HEX) Reset Interrupt 0 0000 0003 9 P3.2(12) PIN

Timers 0 interrupt (TF0)

000B P3.3 (13)

External hardware Interrupt 0013 1(INT1)

Timers 1 interrupt (TF1) Serial COM (RI and TI)

001B 0023

Interrupts

MEMS BASED WHEEL CHAIR Six Interrupts in the 8051 In reality, only five interrupts are available to the user in the 8051, but many manufacturers data sheets state that there are six interrupts since they include reset .the six interrupts in the 8051 are allocated as above. 1. Reset. When the reset pin is activated, the 8051 jumps to address location 0000.this is the power-up reset. 2.Two interrupts are set aside for the timers: one for Timer 0 and one for Timer 1.Memory location 000BH and 001BH in the interrupt vector table belong to Timer 0 and Timer 1, respectively. 3.Two interrupts are set aside for hardware external harder interrupts. Pin number 12(P3.2) and 13(P3.3) in port 3 is for the external hardware interrupts INT0 and INT1, respectively. These external interrupts are also referred to as EX1 and EX2.Memory location 0003H and 0013H in the interrupt vector table are assigned to INT0 and INT1, respectively. 4.Serial communication has a single interrupt that belongs to both receive and transmit. The interrupt vector table location 0023H belongs to this interrupt.

MEMS BASED WHEEL CHAIR

POWER SUPPLY
The power supply are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. A d.c power supply which maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is known as Regulated D.C Power Supply For example a 5V regulated power supply

Functional Block Diagram of Power supply

TRANSFORMER A transformer is an electrical device which is used to convert electrical power from one electrical circuit to another without change in frequency. Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. Step-up transformers increase in output voltage, step-down transformers decrease in output voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains

MEMS BASED WHEEL CHAIR voltage to a safer low voltage. 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. Transformers waste very little power so the

power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. 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.

An Electrical Transformer Turns ratio = Vp/ VS = Np/NS Power Out= Power In VS X IS=VP X IP Vp = primary (input) voltage Np = number of turns on primary coil Ip = primary (input) current RECTIFIER A circuit, which is used to convert a.c to dc, is known as RECTIFIER. The process of conversion a.c to d.c is called rectification TYPES OF RECTIFIERS Half wave Rectifier Full wave rectifier 1. Center tap full wave rectifier.

MEMS BASED WHEEL CHAIR 2. Bridge type full bridge rectifier. Comparison of rectifier circuits Type of Rectifier Parameter Number of diodes 1 PIV of diodes Vm 2Vm Vm 2 3 Half wave Full wave Bridge

D.C output voltage

Vm/

2Vm/

2Vm/

Vdc, at no-load

0.318Vm

0.636Vm

0.636Vm

Ripple factor Ripple frequency Rectification efficiency RMS voltage Vrms

1.21

0.482

0.482

2f

2f

0.406 Vm/2

0.812 Vm/2

0.812 Vm/2

Comparison of rectifier circuits

MEMS BASED WHEEL CHAIR Full-wave Rectifier From the above comparisons we came to know that full wave bridge rectifier as more advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier circuit. Bridge Rectifier A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig(a) to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.

Operation During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction is shown in the fig (b) with dotted arrows.

MEMS BASED WHEEL CHAIR During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction is shown in the fig (c) with dotted arrows.

Filter A Filter is a device, which removes the a.c component of rectifier output but allows the d.c component to reach the load. Capacitor Filter We have seen that the ripple content in the rectified output of half wave rectifier is 121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is not acceptable for most of the applications. Ripples can be removed by one of the following methods of filtering: (a) A capacitor, in parallel to the load, provides an easier by pass for the ripples voltage though it due to low impedance. At ripple frequency and leave the d.c.to appears the load. (b) An inductor, in series with the load, prevents the passage of the ripple current (due to high impedance at ripple frequency) while allowing the d.c (due to low resistance to d.c) (c) various combinations of capacitor and inductor, such as L-section filter section filter,

multiple section filter etc. which make use of both the properties mentioned in (a) and (b) above. Two cases of capacitor filter, one applied on half wave rectifier and another with full wave rectifier. Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The capacitor charges quickly near the peak of the varying DC, and then

MEMS BASED WHEEL CHAIR discharges as it supplies current to the output. Filtering significantly increases the average DC voltage to almost the peak value (1.4 RMS value). To calculate the value of capacitor(C), C = *3*f*r*Rl Where, f = supply frequency, r = ripple factor, Rl = load resistance Note: In our circuit we are using 1000microfarads. Regulator Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output voltages. The maximum current they can pass also rates them. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulator ICs have 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn on the power, you get a 5 volt supply from the output pin.

A Three Terminal Voltage Regulator 78XX The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The LM78XX offer several fixed output voltages making them useful in wide range of applications. When used as a zener diode/resistor combination replacement, the LM78XX usually results in an

MEMS BASED WHEEL CHAIR effective output impedance improvement of two orders of magnitude, lower quiescent current. The LM78XX is available in the TO-252, TO-220 & TO-263packages, Features Output Current of 1.5A Output Voltage Tolerance of 5% Internal thermal overload protection Internal Short-Circuit Limited No External Component Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V Offer in plastic TO-252, TO-220 & TO-263 Direct Replacement for LM78XX

H-BRIDGE

DC motors are typically controlled by using a transistor configuration called an "H-bridge". This consists of a minimum of four mechanical or solid-state switches, such as two NPN and two

MEMS BASED WHEEL CHAIR PNP transistors. One NPN and one PNP transistor are activated at a time. Both NPN and PNP transistors can be activated to cause a short across the motor terminals, which can be useful for slowing down the motor from the back EMF it creats.

Basic Theory
H-bridge. Sometimes called a "full bridge" the H-bridge is so named because it has four switching elements at the "corners" of the H and the motor forms the cross bar. The key fact to note is that there are, in theory, four switching elements within the bridge. These four elements are often called, high side left, high side right, low side right, and low side left (when traversing in clockwise order). The switches are turned on in pairs, either high left and lower right, or lower left and high right, but never both switches on the same "side" of the bridge. If both switches on one side of a bridge are turned on it creates a short circuit between the battery plus and battery minus terminals. If the bridge is sufficiently powerful it will absorb that load and your batteries will simply drain quickly. Usually however the switches in question melt. To power the motor, you turn on two switches that are diagonally opposed. In the picture to the right, imagine that the high side left and low side right switches are turned on. The current flows and the motor begins to turn in a "positive" direction. Turn on the high side right and low side left switches, then Current flows the other direction through the motor and the motor turns in the opposite direction. Actually it is just that simple, the tricky part comes in when you decide what to use for switches. Anything that can carry a current will work, from four SPST switches, one DPDT switch, relays, transistors, to enhancement mode power MOSFETs. One more topic in the basic theory section, quadrants. If each switch can be controlled independently then you can do some interesting things with the bridge, some folks call such a bridge a "four quadrant device" (4QD get it?). If you built it out of a single DPDT relay, you can really only control forward or reverse. You can build a small truth table that tells you for each of the switch's states, what the bridge will do. As each switch has one of two states, and there are four switches, there are 16 possible states. However, since any state that turns both switches on one side on is "bad" (smoke issues forth: P), there are in fact only four useful states (the four quadrants) where the transistors are turned on.

MEMS BASED WHEEL CHAIR

High Side Left High Side Right Low Side Left Low Side Right Quadrant Description On Off On Off Off On On Off Off On Off On On Off Off On Forward Running Backward Running Braking Braking

The last two rows describe a maneuver where you "short circuit" the motor which causes the motors generator effect to work against itself. The turning motor generates a voltage which tries to force the motor to turn the opposite direction. This causes the motor to rapidly stop spinning and is called "braking" on a lot of H-bridge designs. Of course there is also the state where all the transistors are turned off. In this case the motor coasts freely if it was spinning and does nothing if it was doing nothing. Implementation 1. Using Relays A simple implementation of an H Bridge using four SPST relays is shown. Terminal A is High Side Left, Terminal B is High Side Right, Terminal C is Low Side Left and Terminal D is Low Side Right. The logic followed is according to the table above. Warning: Never turn on A and C or B and D at the same time. This will lead to a short circuit of the battery and will lead to failure of the relays due to the large current.

MEMS BASED WHEEL CHAIR

2.

Using Transistors We can better control our motor by using transistors or Field Effect Transistors (FETs).

Most of what we have discussed about the relays H-Bridge is true of these circuits. See the diagram showing how they are connected. You should add diodes across the transistors to catch the back voltage that is generated by the motor's coil when the power is switched on and off. This fly back voltage can be many times higher than the supply voltage!

MEMS BASED WHEEL CHAIR Transistors, being a semiconductor device, will have some resistance, which causes them to get hot when conducting much current. This is called not being able to sink or source very much power, i.e.: Not able to provide much current from ground or from plus voltage. Mosfets are much more efficient, they can provide much more current and not get as hot. They usually have the fly back diodes built in so you don't need the diodes anymore. This helps guard against fly back voltage frying your ICs. To use Mosfets in an H-Bridge, you need P-Channel Mosfets on top because they can "source" power, and N-Channel Mosfets on the bottom because then can "sink" power. It is important that the four quadrants of the H-Bridge circuits be turned on and off properly. When there is a path between the positive and ground side of the H-Bridge, other than through the motor, a condition exists called "shoot through". This is basically a direct short of the power supply and can cause semiconductors to become ballistic, in circuits with large currents flowing. There are H-bridge chips available that are much easier, and safer, to use than designing your own H-Bridge circuit. 1. Using H-Bridge Devices

The L293 has 2 H-Bridges (actually 4 Half H-Bridges), can provide about 1 amp to each and occasional peak loads to 2 amps. The L298 has 2 h-bridges on board, can handle 1amp and peak current draws to about 3amps. The LMD18200 has one h-bridge on board, can handle about 2 or 3 amps and can handle a peak of about 6 amps. There are several more commercially designed H-Bridge chips as well. Once a Half H-bridge is enabled, it truth table is as follows: INPUT OUTPUT A L H Y L H

So you just give a High level when you want to turn the Half H-Bridge on and Low level when you want to turn it off. When the Half H-Bridge is on, the voltage at the output is equal to

MEMS BASED WHEEL CHAIR Vcc2.If you want to make a Full H-Bridge, you connect the motor (or the load) between the outputs of two Half H-Bridges and the inputs will be the two inputs of the Half H-Bridges. Suppose we have connected Half H-Bridges 1 and 2 to form a Full H-Bridge. Now the truth table is as follows:

INPUT 1A

INPUT 2A

OUTPUT 1Y

OUTPUT 2Y

Description

Braking (both terminals of motor are Gnd) Forward Running Backward Running Braking (both terminals of motor at Vcc2

L H

H L

L H

H L

2) L293D Motor Driver IC Since two motors are used to drive The back wheels of the robot independently, there is a need for Two H-bridges. Instead of implementing the above H-bridge controlCircuit twice, an alternative is to use an integrated circuit (IC), which Provides more than one H-bridges. One such IC is L293D, which has 2 H-Bridges in it. It can supply 600Ma continuous and 1.2A peak Currents. It is suitable for switching applications up to 5 kHz. These Features make it ideal for our application. Another option is to use IC L298, which can drive 2A continually and 3A peak currents. The Diagram of L293D is shown in Figure 2It can be observed from the figure that L293D has a similar configuration to the circuit in Figure 1.

MEMS BASED WHEEL CHAIR

Figure 1 3) Motor Driver Connections: The motor driver requires 2 control inputs for each motor. Since we drive 2 motors, we need 4 controls Inputs from the microcontroller.

Since it has many pins which can be configured as outputs, there are many options for implementation.For example, in our robot the last 4 bits of Port B (RB4, RB5, RB6,RB7 - Pins 37 to 40) are used to control the rotation direction of the motors . The enable pins of the motor driver are connected to the PWM outputs of the microcontroller (Pins 16and 17). This is because, as was mentioned above, by changing the width of the pulse (implying changing the enable time of the driver) one can change the speed of the motor. The truth table for motor driver is as shown in Table II, where H = high, L = low, and Z =high output impedance state. Since the motors are reverse aligned, in order to have the robot Move forward they must be configured such that one of them turns forward and the other one turns backward. In case of any requirement for the robot to move backward, it is sufficient to just reverse the Outputs of the control pins. For example, in our robot while moving forward, inputs of the motor driver have states shown in the first row Of Table III, whereas for backward movement, the states shown in the second row of Table III is applied.

MEMS BASED WHEEL CHAIR TABLE II THE TRUTH TABLE OF THE MOTOR DRIVER Input H L H L enable H H L L output H L z z

TABLE III DRIVER CONTROL INPUTS Direction Forward Backward Input 1 H L Input 2 L H Input 3 L H Input 4 H L

DC Motor
DC motors are configured in many types and sizes, including brush less, servo, and gear motor types. A motor consists of a rotor and a permanent magnetic field stator. The magnetic field is maintained using either permanent magnets or electromagnetic windings. DC motors are most commonly used in variable speed and torque. Motion and controls cover a wide range of components that in some way are used to generate and/or control motion. Areas within this category include bearings and bushings, clutches and brakes, controls and drives, drive components, encoders and resolves, Integrated motion control, limit switches, linear actuators, linear and rotary motion components, linear position sensing, motors (both AC and DC motors), orientation position sensing, pneumatics and pneumatic components, positioning stages, slides and guides, power transmission (mechanical), seals, slip rings, solenoids, springs.

Motors are the devices that provide the actual speed and torque in a drive system. This family includes AC motor types (single and multiphase motors, universal, servo motors,

MEMS BASED WHEEL CHAIR induction, synchronous, and gear motor) and DC motors (brush less, servo motor, and gear motor) as well as linear, stepper and air motors, and motor contactors and starters. In any electric motor, operation is based on simple electromagnetism. A current-carrying conductor generates a magnetic field; when this is then placed in an external magnetic field, it will experience a force proportional to the current in the conductor, and to the strength of the external magnetic field. As you are well aware of from playing with magnets as a kid, opposite (North and South) polarities attract, while like polarities (North and North, South and South) repel. The internal configuration of a DC motor is designed to harness the magnetic interaction between a current-carrying conductor and an external magnetic field to generate rotational motion.

Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet or winding with a "North" polarization, while green represents a magnet or winding with a "South" polarization).

Block Diagram of the DC motor Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field magnet(s), and brushes. In most common DC motors (and all that Beamers will see), the external magnetic field is produced by high-strength permanent magnets1. The stator is the stationary part of the motor -- this includes the motor casing, as well as two or more permanent magnet pole pieces. The rotor (together with the axle and attached commutator) rotates with respect to the stator. The rotor consists of windings (generally on a core), the windings being electrically connected to the commutator. The above diagram shows a common motor layout -with the rotor inside the stator (field) magnets. The geometry of the brushes, commutator contacts, and rotor windings are such that when power is applied, the polarities of the energized winding and the stator magnet(s) are

MEMS BASED WHEEL CHAIR misaligned, and the rotor will rotate until it is almost aligned with the stator's field magnets. As the rotor reaches alignment, the brushes move to the next commutator contacts, and energize the next winding. Given our example two-pole motor, the rotation reverses the direction of current through the rotor winding, leading to a "flip" of the rotor's magnetic field, and driving it to continue rotating. In real life, though, DC motors will always have more than two poles (three is a very common number). In particular, this avoids "dead spots" in the commutator. You can imagine how with our example two-pole motor, if the rotor is exactly at the middle of its rotation (perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile, with a two-pole motor, there is a moment where the commutator shorts out the power supply (i.e., both brushes touch both commutator contacts simultaneously). This would be bad for the power supply, waste energy, and damage motor components as well. Yet another disadvantage of such a simple motor is that it would exhibit a high amount of torque ripple" (the amount of torque it could produce is cyclic with the position of the rotor).

Block Diagram of the DC motor having two poles only So since most small DC motors are of a three-pole design, let's tinker with the workings of one via an interactive animation (JavaScript required):

Block Diagram of the DC motor having Three poles

MEMS BASED WHEEL CHAIR You'll notice a few things from this -- namely, one pole is fully energized at a time (but two others are "partially" energized). As each brush transitions from one commutator contact to the next, one coil's field will rapidly collapse, as the next coil's field will rapidly charge up (this occurs within a few microsecond). We'll see more about the effects of this later, but in the meantime you can see that this is a direct result of the coil windings' series wiring:

Internal Block Diagram of the Three pole DC motor There's probably no better way to see how an average dc motor is put together, than by just opening one up. Unfortunately this is tedious work, as well as requiring the destruction of a perfectly good motor. This is a basic 3-pole dc motor, with 2 brushes and three commutator contacts.

LCD MODULE
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: 1. Dynamic-scattering LCDs and 2. Field-effect LCDs

MEMS BASED WHEEL CHAIR

Field-effect LCDs are normally used in such applications where source of energy is a prime factor (e.g., watches, portable instrumentation etc.).They absorb considerably less power than the light-scattering type. However, the cost for field-effect units is typically higher, and their hoight is limited to 2 inches. On the other hand, light-scattering units are available up to 8 inches in height. Field-effect LCD is used in the project for displaying the appropriate information.

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. HARDWARE DIAGRAM:

16 x 2 Char LCD
A K D7 D0 EN RW RS Vf GND

ACK Vcc D0 D7 R1

R2

RS (Command / Data): This bit is to specify weather received byte is command or data. So that LCD can recognize the operation to be performed based on the bit status.

MEMS BASED WHEEL CHAIR RS RS = 0 = 1 => => Command Data

RW (Read / Write):RW bit is to specify weather controller wants READ from LCD or WRITE to LCD. The READ operation here is just ACK bit to know weather LCD is free or not. RW RW EN (Enable LCD):EN bit is to ENABLE or DISABLE the LCD. When ever controller wants to write some thing into LCD or READ acknowledgment from LCD it needs to enable the LCD. EN = 0 EN = 1 ACK (LCD Ready):=> => High Impedance Low Impedance = 0 = 1 => => Write Read

ACK bit is to acknowledge the MCU that LCD is free so that it can send new command or data to be stored in its internal Ram locations ACK = 1 ACK = 0 => => Not ACK ACK

MEMS BASED WHEEL CHAIR FLOWCHART:


START

Configure port pins for all hardware connections

Copy command in to Accumulator

Wait No
Is LCD Free

Yes

Clear RS Bit Enable LCD Send Command Disable LCD

No

Is Command Count Zero

MEMS BASED WHEEL CHAIR

Copy Data in to Accumulator

Wait No
Is LCD Free

Yes

Set RS Bit Enable LCD Send Data Disable LCD

No

Is Data Count Zero

STOP

MEMS

Pin Name Description Pin Status


1 RESERVED Connect to AVSS Input

MEMS BASED WHEEL CHAIR 2 N/C No Internal Connection, leave unconnected or connect to Ground Input 3 AVDD Device Power Input 4 AVSS Device Ground Input 5 INT Interrupt/Data Ready Output 6 SCL I2C Serial Clock Input 7 SDA I2C Serial Data Open Drain 8 DVSS Digital I/O Ground Input 9 DVDD Digital I/O Power Input 10 RESERVED Connect to AVSS Input PRINCIPLE OF OPERATION The Free scale Accelerometer consists of a MEMS capacitive sensing g-cell and a signal conditioning ASIC contained in a single package. The sensing element is sealed hermetically at the wafer level using a bulk micro machined cap wafer. The g-cell is a mechanical structure formed from semiconductor materials (poly silicon) using masking and etching processes. The sensor can be modeled as a movable beam that moves between two mechanically fixed beams Two gaps are formed; one being between the movable beam and the first stationary beam and the second between the movable beam and the second stationary beam. The ASIC uses switched capacitor techniques to measure the g-cell capacitors and extract the acceleration data from the difference between the two capacitors. The ASIC also signal conditions and filters (switched capacitor) the signal, providing a digital output that is proportional to acceleration.

. Orientation Detection Logic in 3-Dimensional Space

MEMS BASED WHEEL CHAIR

Tap Detection
The MMA7660FC also includes a Tap Detection feature that can be used for a number of different customer applications such as button replacement. For example, a single tap can stop a song from playing and a double tap can play a song. This function detects a fast transition that exceeds a user-defined threshold (PDET (0x09) register) for a set duration (PD (0x0A) register).

Tap Detection Setup


In order to enable Tap detection in the device the user must enable the Tap Interrupt in the INTSU (0x06) register and AMSR [2:0] = 000 in the SR (0x08) register. In this mode, TILT (0x03) register, XOUT (0x00), YOUT (0x01), and ZOUT (0x02) registers will update at the 120 samples/second. The user can configure Tap Detection to be detected on X and/or Y and/or Z axes. The customer can configure this by changing the XDA, YDA, and/or ZDA bit in the PDET (0x09) register. Detection for enabled axes is decided on an OR basis: If the PDINT bit is set in the INTSU (0x06) register, the device reports the first axis for which it detects a tap by the Tap bit in the TILT (0x03) register. When the Tap bit in the TILT (0x03) register is set, tap detection ceases, but the device will continue to process orientation detection data. Tap detection will resume when the TILT (0x03) register is read. NOTE: Delta G is available with any AMSR setting, when XDA = YDA = ZDA = 1 (PDET = 1). When the sampling rate is less than 120 samples/second, the device can not detect tapping, but can detect small tilt angles (30 angle change) which can not be detected by orientation detection. Shake Detection The shake feature can be used as a button replacement to perform functions such as scrolling through images or web pages on a Mobile Phone/PMP/PDA. The customer can enable the shake interrupt on any of the 3 axes, by enabling the SHINTX, SHINTY, and/or SHINTZ in the INTSU (0x06) register. MMA7660FC detects shake by examining the current 6-bit measurement for each axis in XOUT, YOUT, and ZOUT. The axes that are tested for shake detection are the ones enabled by SHINTX, SHINTY, and/or SHINTZ. If a selected axis measures greater that 1.3 or less than -1.3

MEMS BASED WHEEL CHAIR g, then a shake is detected for that axis and an interrupt occurs. All three axes are checked independently, but a common Shake bit in the TILT register is set when shake is detected in any one of the selected axes. Therefore when all three (SHINTX, SHINTY, and/or SHINTZ) are selected the sensor will not know what axis the shake occurred. When the TILT register is read the Shake bit is cleared during the acknowledge bit of the read access to that register and shake detection monitoring starts again. Auto-Wake/Sleep The MMA7660FC has the Auto-Wake/Sleep feature that can be enabled for power saving. In the Auto-Wake function, the device is put into a user specified low samples per second (1 sample/second, 8 samples/second, 16 samples/second, or 32 samples/second) in order to minimize power consumption. When the Auto-Wake is enabled and activity is detected such as a change in orientation, pulse event, Delta G acceleration or a shake event, then the device wakes up. Auto-Wake will automatically enable Auto-Sleep when the device is in wake mode and can therefore be configured to cause an interrupt on wake-up, by configuring the part to either wakeup with a change in orientation, shake, or if using the part at 120 samples/second tap detection. When the device is in Auto-Wake mode, the MODE (0x07) register, bit AWE is high. When the device has detected a change in orientation, a tap shake, or Delta G (change in acceleration), the device will enter Auto-Sleep mode. In the Auto- Sleep function, the device is put into any of the following user specified samples per seconds (1 sample/second, 2 samples/second, 4 samples/second, 8 samples/second, 16 samples/second, 32 samples/second, 64 samples/second, and 120 samples/ second). In the Auto-Sleep mode, if no change in the orientation, shake or tap has occurred and the sleep counter has elapsed, the device will go into the Auto-Wake mode. When the device is in the Auto-Sleep mode, the MODE (0x07) register, bit ASE is high. The device can be programmed to continually cycle between Auto-Wake/Sleep.

MEMS BASED WHEEL CHAIR

SOFTWARE USED INTRODUCTION TO EMBEDDED C Data Types


U people have already come across the word Data types in C- Language. Here also the functionality and the meaning of the word is same except a small change in the prefix of their labels. Now we will discuss some of the widely used data types for embedded C- programming.

Data Types unsigned char signed char unsigned int signed int sbit Bit Sfr

Size in Bits 8-bit 8-bit 16-bit 16-bit 1-bit 1-bit 8-bit data types

Data Range/Usage 0-255 -128 to +127 0 to 65535 -32,768 to +32,767 SFR bit addressable only RAM bit addressable only RAMaddresses80-FFH only

Unsigned Char
The unsigned char is an 8-bit data type that takes a value in the range of 0-255(00-FFH). It is used in many situations, such as setting a counter value, where there is no need for signed data we should use the unsigned char instead of the signed char. Remember that C compilers use the signed char as the default if we do not put the key word.

Signed char
The signed char is an 8-bit data type that uses the most significant bit (D7 of D7-D0) to represent the or + values. As a result, we have only 7 bits for the magnitude of the signed

MEMS BASED WHEEL CHAIR number, giving us values from -128 to +127. In situations where + and are needed to represent a given quantity such as temperature, the use of the signed char data type is a must.

Unsigned Int
The unsigned int is a 16-bit data type that takes a value in the range of 0 to 65535 (0000FFFFH).It is also used to set counter values of more than 256. We must use the int data type unless we have to. Since registers and memory are in 8-bit chunks, the misuse of int variables will result in a larger hex file. To overcome this we can use the unsigned char in place of unsigned int.

Signed Int
Signed int is a 16-bit data type that uses the most significant bit (D15 of D15-D0) to represent the or + value. As a result we have only 15 bits for the magnitude of the number or values from -32,768 to +32,767.

Sbit (single bit)


The sbit data type is widely used and designed specifically to access single bit addressable registers. It allows access to the single bits of the SFR registers.

I/O PROGRAMMING IN EMBEDDED C


In this topic we look at C- programming of the I/O ports and also both byte and bit I/O programming.

Byte Size I/O


As we know that ports P0-P3 are byte accessible, we use the P0-P3 labels as defined in the header file.

Bit Addressable I/O Programming


The I/O ports of P0-P3 are bit- addressable, so we can access a single bit without disturbing the rest of the port. We use the sbit data type to access a single bit of P0-P3.the format is Px^y where x is the port and y is the bit.

Accessing SFR addresses 80-FFH


Another way to access the SFR RAM space 80-FFH is to use the sfr data type. This is shown in the below example .Both the bit and byte addresses for the P0-P3 ports are given in the

MEMS BASED WHEEL CHAIR table. Notice in the given example that there is no #include<reg51.h> statement which allows us to access any byte of the SFR RAM space 80-FFH.

About Software
Softwares used are *Keil software for C programming What's New in Vision3? Vision3 adds many new features to the Editor like Text Templates, Quick Function Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based startup and debugger setup. Vision3 is fully compatible to Vision2 and can be used in parallel with Vision2. What is Vision3? Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components: To A project manager. A make facility. Tool configuration. Editor. A powerful debugger. help you get started, several example programs (located in the

C51\Examples\C251\Examples\C166\Examples, and \ARM\...\Examples) are provided. HELLO is a simple program that prints the string "Hello World" using the Serial Interface.

Building an Application in Vision2 To build (compile, assemble, and link) an application in Vision2, you must: 1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2). 2. Select Project - Rebuild all target files or Build target. Vision2 compiles, assembles, and links the files in your project. Creating Your Own Application in Vision2 To create a new project in Vision2, you must: 1. Select Project - New Project. 2. Select a directory and enter the name of the project file.

MEMS BASED WHEEL CHAIR 3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device Database 4. Create source files to add to the project. 5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project. 6. Select Project - Options and set the tool options. Note when you select the target device from the Device Database all special options are set automatically. You typically only need to configure the memory map of your target hardware. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target. Debugging an Application in Vision2 To debug an application created using Vision2, you must: 1. Select Debug - Start/Stop Debug Session. 2. Use the Step toolbar buttons to single-step through your program. You may enter G, main in the Output Window to execute to the main C function. 3. Open the Serial Window using the Serial #1 button on the toolbar. Debug your program using standard options like Step, Go, Break, and so on. Starting Vision2 and Creating a Project Vision2 is a standard Windows application and started by clicking on the program icon. To create a new project file select from the Vision2 menu Project New Project. This opens a standard Windows dialog that asks you for the new project file name. We suggest that you use a separate folder for each project. You can simply use the icon Create New Folder in this dialog to get a new empty folder. Then select this folder and enter the file name for the new project, i.e. Project1. Vision2 creates a new project file with the name PROJECT1.UV2 which contains a default target and file group name. You can see these names in the Project. Window Files. Now use from the menu Project Select Device for Target and select a CPU for your project. The Select Device dialog box shows the Vision2 device database. Just select the micro controller you use. We are using for our examples the Philips 80C51RD+ CPU. This selection

MEMS BASED WHEEL CHAIR sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool Configuration. Building Projects and Creating a HEX Files Typical, the tool settings under Options Target are all you need to start a new application. You may translate all source files and line the application with a click on the Build Target toolbar icon. When you build an application with syntax errors, Vision2 will display errors and warning messages in the Output Window Build page. A double click on a message line opens the source file on the correct location in a Vision2 editor window. Once you have successfully generated your application you can start debugging. After you have tested your application, it is required to create an Intel HEX file to download the software into an EPROM programmer or simulator. Vision2 creates HEX files with each build process when Create HEX files under Options for Target Output is enabled. You may start your PROM programming utility after the make process when you specify the program under the option Run User Program #1. CPU Simulation Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write, or code execution access. The Vision2 simulator traps and reports illegal memory accesses. In addition to memory mapping, the simulator also provides support for the integrated peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are configured from the Device. Database selection You have made when you create your project target. Refer to page 58 for more Information about selecting a device. You may select and display the on-chip peripheral components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes. Start Debugging You start the debug mode of Vision2 with the Debug Start/Stop Debug Session command. Depending on the Options for Target Debug Configuration, Vision2 will load the application program and run the startup code Vision2 saves the editor screen layout and restores the screen layout of the last debug session. If the program execution stops, Vision2 opens an editor window with the source text or shows CPU instructions in the disassembly

MEMS BASED WHEEL CHAIR window. The next executable statement is marked with a yellow arrow. During debugging, most editor features are still available. For example, you can use the find command or correct program errors. Program source text of your application is shown in the same windows. The Vision2 debug mode differs from the edit mode in the following aspects: _ The Debug Menu and Debug Commands described on page 28 are Available. The additional debug windows are discussed in the following. _ the project structure or tool parameters cannot be modified. All build Commands are disabled. Disassembly Window The Disassembly window shows your target program as mixed source and assembly program or just assembly code. A trace history of previously executed instructions may be displayed with Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace Recording. If you select the Disassembly Window as the active window all program step commands work on CPU instruction level rather than program source lines. You can select a text line and set or modify code breakpoints using toolbar buttons or the context menu commands. You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allows you to correct mistakes or to make temporary changes to the target program you are debugging.

Steps for executing the Keil programs

1. 2.

Click on the Keil uVision Icon on Desktop The following fig will appear

MEMS BASED WHEEL CHAIR

3. 4.

Click on the Project menu from the title bar Then Click on New Project

5.

Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\

MEMS BASED WHEEL CHAIR

6. 7. 8.

Then Click on Save button above. Select the component for u r project. i.e. Atmel Click on the + Symbol beside of Atmel

9.

Select AT89C51 as shown below

MEMS BASED WHEEL CHAIR

10. 11.

Then Click on OK The Following fig will appear

12. 13. 14.

Then Click either YES or NOmostly NO Now your project is ready to USE Now double click on the Target1, you would get another option Source group 1 as shown in next page.

MEMS BASED WHEEL CHAIR

15.

Click on the file option from menu bar and select new

16.

The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.

MEMS BASED WHEEL CHAIR

17. 18.

Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C

19.

Now right click on Source group 1 and click on Add files to Group Source

MEMS BASED WHEEL CHAIR

20.

Now you will get another window, on which by default C files will appear.

21. 22. 23.

Now select as per your file extension given while saving the file Click only one time on option ADD Now Press function key F7 to compile. Any error will appear if so happen.

MEMS BASED WHEEL CHAIR

24. 25.

If the file contains no error, then press Control+F5 simultaneously. The new window is as follows

26. 27.

Then Click OK Now Click on the Peripherals from menu bar, and check your required port as shown in fig below

MEMS BASED WHEEL CHAIR

28.

Drag the port a side and click in the program file.

29.

Now keep Pressing function key F11 slowly and observe. You are running your program successfully

MEMS BASED WHEEL CHAIR

SOURCE CODE #include<reg52.h> #include"mems.h" #include"lcddisplay.h" sbit m0a = P0^0; sbit m0b = P0^1; sbit m1a = P0^2; sbit m1b = P0^3; void motor0(unsigned char x, unsigned char y) { m0a=x; m0b=y; } void motor1(unsigned char p, unsigned char q) { m1a=p; m1b=q; } void delay_ms(int cnt) { int i; while(cnt--) for(i=0;i<500;i++); } main() { unsigned char memsdata; lcd_init(); lcdcmd(0x01); msgdisplay("finger based ");

MEMS BASED WHEEL CHAIR

lcdcmd(0xc0); msgdisplay("wheel chair"); delay(100); write_mems(7,0x00); delay_ms(500); write_mems(7,0x01); delay_ms(500); write_mems(8,0x3F); delay_ms(500); while(1) { memsdata=read_mems(3)&0x3f; if(memsdata == 21 || memsdata == 5) { lcdcmd(0x01); msgdisplay(" **stop**"); //P2=0xf5; // str("stable "); motor0(0,0); motor1(0,0); } if(memsdata == 10 ) { lcdcmd(0x01); msgdisplay(" **go left**"); //left //P2=0xf3; motor0(0,1); motor1(1,0); }

MEMS BASED WHEEL CHAIR

if (memsdata == 6) { lcdcmd(0x01); msgdisplay(" **go right**");//right motor0(1,0); motor1(0,1); } if( memsdata == 26) { lcdcmd(0x01); msgdisplay(" **go front**"); //front motor0(1,0); motor1(1,0); } if( memsdata == 22 ) { lcdcmd(0x01); msgdisplay(" **go back**"); motor0(0,1); motor1(0,1); } } } //back

MEMS BASED WHEEL CHAIR

FUTURE ENHANCEMENT
This project is to design a robotic wheel chair system for the handicapped people so old people or an handicapped doesnt need any kind of requirement or any help in order move from one particular place to the another particular place they can just have the movement of the MEMS sensor so the vehicle moves automatically.

MEMS BASED WHEEL CHAIR .

CONCLUSION
The project PROJECT CLASS has been successfully designed and tested. It has been developed by integrating features of all the hardware components used. Presence of every module has been reasoned out and placed carefully thus contributing to the best working of the unit. Secondly, using highly advanced ICs and with the help of growing technology the project has been successfully implemented.

MEMS BASED WHEEL CHAIR

BIBILOGRPAHY

[1] Furber Arm System-On-Chip Architecture, 2/E, Pearson Education. [2] 8051-DATASHEET. [3] Arm Architecture Reference Manual-David Seal [4] Fundamentals of Micro processors and Micro computers-B.Ram [5] Micro processor Architecture, Programming& Applications-Ramesh S.Gaonkar [6] Electronic Components-D.V.Prasad [7] Wireless Communications- Theodore S. Rappaport [8] Mobile Tele Communications- William C.Y. Lee WEBSITES [1] www.atmel.com [2] www.wikipedia.org [3] www.8051projects.net [4] www.engineersgarage.com [5] www.keil.com [6] www.educypedia.org [7] www.howstuffworks.com [8] www.instructables.com [9] www.8051projects.info [10] www.projectguidance.com [11] www.national.com [12] www.microsoftsearch.com

Potrebbero piacerti anche