Micro Controller Embedded System

Embed Size (px)

Citation preview

  • 8/8/2019 Micro Controller Embedded System

    1/41

    1

    TABLE OF CONTENTS

    TITLE PAGE NO.

    Introduction To 8051..3

    Hardware Features......3

    Microcontroller V/S Microprocessor..3

    Microcontroller For The Embeded Systems...5

    8051 Pin-Diagram...6

    8051 Pin-Description..6

    Inside The 8051..11

    Memory Space Allocation......12

    Block Diagram of 8051..13

    Instruction Set of 8051 Microcontroller.14

    Boolean Variable Manipulation.....20

    Program Branching22

    Programs Based on Microcontroller..23

    Screenshots/Snapshots...28

    How To Use Compiler & Programmer.30

  • 8/8/2019 Micro Controller Embedded System

    2/41

    2

  • 8/8/2019 Micro Controller Embedded System

    3/41

    3

    INTRODUCTION TO 8051:-

    In 1981, Intel Corporation introduced an 8-bit microcontroller called the 8051. This

    microcontroller had 128 bytes of RAM, 4K bytes of on-chip ROM, two timers, one serial

    port, and four ports (8-bit) all on a single chip. The 8051 is an 8-bit processor, meaning the

    CPU can work on only 8- bit pieces to be processed by the CPU. The 8051 has a total of four

    I/O ports, each 8- bit wide. Although 8051 can have a maximum of 64K bytes of on-chip

    ROM, many manufacturers put only 4K bytes on the chip.

    The 8051 became widely popular after Intel allowed other manufacturers to make

    any flavor of the 8051 they please with the condition that they remain code compatible with

    the 8051. This has led to many versions of the 8051 with different speeds and amount of on-

    chip ROM marketed by more than half a dozen manufacturers. It is important to know that

    although there are different flavors of the 8051, they are all compatible with the original 8051

    as far as the instructions are concerned. This means that if you write your program for one, it

    will run on any one of them regardless of the manufacturer. The major 8051 manufacturers

    are Intel, Atmel, Dallas Semiconductors, Philips Corporation, Infineon.

    HARDWARE FEATURES:-

    40 pin Ic.

    4 Kbytes of Flash.

    128 Bytes of RAM.

    32 I/O lines.

    Two16-Bit Timer/Counters.

    Five Vector.

    Two-Level Interrupt Architecture.

    Full Duplex Serial Port.

    On Chip Oscillator and Clock Circuitry.

    MICROCONTROLLER V/S MICROPROCESSORS:-What is the difference between a microprocessor and microcontroller? The

    microprocessors (such as 8086, 80286, 68000 etc.) contain no RAM, no ROM and no I/O

    ports on the chip itself. For this reason they are referred as general- purpose microprocessors.

    A system designer using general- purpose microprocessor must add external RAM, ROM,

    I/O ports and timers to make them functional. Although the addition of external RAM, ROM,

  • 8/8/2019 Micro Controller Embedded System

    4/41

    4

    and I/O ports make the system bulkier and much more expensive, they have the advantage of

    versatility such that the designer can decide on the amount of RAM, ROM and I/O ports

    needed to fit the task at hand. This is the not the case with microcontrollers. A

    microcontroller has a CPU (a microprocessor) in addition to the fixed amount of RAM,

    ROM, I/O ports, and timers are all embedded together on the chip: therefore, the designer

    cannot add any external memory, I/O, or timer to it. The fixed amount of on chip RAM,

    ROM, and number of I/O ports in microcontrollers make them ideal for many applications in

    which cost and space are critical. In many applications, for example a TV remote control,

    there is no need for the computing power of a 486 or even a 8086 microprocessor. In many

    applications, the space it takes, the power it consumes, and the price per unit are much more

    critical considerations than the computing power. These applications most often require some

    I/O operations to read signals and turn on and off certain bits. It is interesting to know that

    some microcontrollers manufactures have gone as far as integrating an ADC and other

    peripherals into the microcontrollers.

    CPU

    General

    Purpose

    Micro

    processor

    RA RO I/O

    PortTimer

    Serial

    CO

    Port

    Data Bus

    Address Bus

    General Purpose Microprocessor ystem

    Microprocessors:

    CPU for Computers No RAM, ROM, I/O on CPU chip itself

    Example Intels x86, Motorolas 680x0

    Many chips on mothers board

    General-purpose microprocessor

  • 8/8/2019 Micro Controller Embedded System

    5/41

    5

    M M

    I ort

    imererial

    M

    ortMi r tr ll r

    CPU

    A s computer

    On-chip RA , RO , I/O ports...

    mpleMotorolas 6811, Intels 8051, Zilogs Z8 and PIC

    16X

    A single chip

    Microcontroller :

    MICROCONTROLLERS FOR EMBEDDED SYSTEMS:-

    In the literature discussing microprocessors, we often see a term embedded system.

    Microprocessors and microcontrollers are widely used in embedded system products. An

    embedded product uses a microprocessor (or microcontroller) to do one task and one task

    only. A printer is an example of embedded system since the processor inside it performs one

    task only: namely, get data and print it. Contrasting this with a IBM PC which can be used for

    a number of applications such as word processor, print server, network server, video game

    player, 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 and lets the CPU run it. In an

    embedded system, there is only one application software that is burned into ROM. A PC

    contains or is connected to various embedded products such as the keyboard, printer, modem,

    disk controller, sound card, CD-ROM driver, mouse and so on. Each one of these peripherals

    has a microcontroller inside it that performs only one task. For example, inside every mouse

    there is a microcontroller to perform the task of finding the mouse position and sending it to

    the PC.

  • 8/8/2019 Micro Controller Embedded System

    6/41

  • 8/8/2019 Micro Controller Embedded System

    7/41

    7

    by all embers fthe 1and 31 families. In ther w rds, they must beconnectedin

    order forthe systemto work, regardless of whether

    themicrocontrolleris ofthe 1orthe 31 family.Theothertwopins, PSEN andALE are

    usedmainly in 31 based systems.

    Vcc & Vss:-

    Pin 4 provides supply voltagetothechip.Thevoltage sourceis + V.

    Pin 2 is theground.

    OSCILLATOR CHARACTERISTICS:-

    TAL1and TAL2 are the inputandoutput, respectively, ofan invertingamplifier which

    can beconfigured foruseas anon-chiposcillator, as shownin Figure. Eithera quart crystal

    orceramic resonatormay beused.Todrivethedevice fromanexternalclock source, TAL2

    should beleftunconnected while TAL1is drivenas shownin Figure.

    OSCILLATOR CONNECTIONS

    It must be noted that there are various speeds of the 1 family. Speed refers to the

    maximumoscillator frequency connectedtothe TAL. Forexample, a12 M chipmust be

    connected toacrystal with12 M frequency or less.Likewise, a 2 M microcontroller

    requires a crystal frequency of no more than 2 M . When the 1 is connected to a

    crystaloscillatorand is poweredup, wecanobservethe frequency onthe TAL2 pinusing

    oscilloscope.

  • 8/8/2019 Micro Controller Embedded System

    8/41

    8

    RST:-

    Pin 9 is the reset pin. It is an input and is active high (normally low). Upon applying a high

    pulse to this pin, the microcontroller will reset and terminate all activities. This is often

    referred to as a power on reset. Activating a power-on reset will cause all values in the

    registers to be lost. Notice that the value of Program Counter is 0000 upon reset, forcing the

    CPU to fetch the first code from ROM memory location 0000. This means that we must place

    the first line of source code in ROM location 0000 that is where the CPU wakes up and

    expects to find the first instruction. In order to RESET input to be effective, it must have a

    minimum duration of 2 machine cycles. In other words, the high pulse must be high for a

    minimum of 2 machine cycles before it is allowed to go low.

    EA:-

    All the 8051 family members come with on-chip ROM to store programs. In such cases, the

    EA pin is connected to the Vcc. For family members such as 8031 and 8032 in which there is

    no on-chip ROM, code is stored on an external ROM and is fetched by the 8031/32.

    Therefore for the 8031 the EA pin must be connected to ground to indicate that the code is

    stored externally. EA, which stands for external access, is pin number 31 in the DIP

    packages. It is input pin and must be connected to either Vcc or ND. In other words, it

    cannot be left unconnected.

    PSEN :-

    This is an output pin. PSEN stands for program store enable. It is the read strobe to external

    program memory. When the microcontroller is executing from external memory, PSEN is

    activated twice each machine cycle.

    ALE:-

    ALE (Address latch enable) is an output pin and is active high. When connecting a

    microcontroller to external memory, port 0 provides both address and data. In other words the

    microcontroller multiplexes address and data through port 0 to save pins. The ALE pin is

    used for de-multiplexing the address and data by connecting to the pin of the 74LS373

    chip.

  • 8/8/2019 Micro Controller Embedded System

    9/41

    9

    I/O PORT PINS AND THEIR FUNCTIONS:-

    The four ports P0, P1, P2, and P3 each use 8 pins, making them 8-bit ports. All the ports

    upon RESET are configured as output, ready to be used as output ports. To use any of these

    as input port, it must be programmed.

    PORT 0:-

    Port 0 occupies a total of 8 pins (pins 32 to 39). It can be used for input or output. To use the

    pins of port 0 as both input and output ports, each pin must be connected externally to a 10K-

    ohm pull-up resistor. This is due to fact that port 0 is an open drain, unlike P1, P2 and P3.

    With external pull-up resistors connected upon reset, port 0 is configured as output port. In

    order to make port 0 an input port, the port must be programmed by writing 1 to all the bits of

    it. Port 0 is also designated as AD0-AD7, allowing it to be used for both data and address.

    When connecting a microcontroller to an external memory, port 0 provides both address and

    data. The microcontroller multiplexes address and data through port 0 to save pins. ALE

    indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but when ALE=1

    it has address A0-A7. Therefore, ALE is used for de-multiplexing address and data with the

    help of latch 74LS373.

    PORT 1:-

    Port 1 occupies a total of 8 pins (pins 1 to 8). It can be used as input or output. In contrast to

    port 0, this port does not require pull-up resistors since it has already pull-up resistors

    internally. Upon reset, port 1 is configures as an output port. Similar to port 0, port 1 can be

    used as an input port by writing 1 to all its bits.

    PORT 2:-

    Port 2 occupies a total of 8 pins (pins 21 to 28). It can be used as input or output. Just like P1,

    port 2 does not need any pull-up resistors since it has pull-up resistors internally. Upon reset

    port 2 is configured as output port. To make port 2 as input port, it must be programmed as

    such by writing 1s to it.

    PORT 3:-

    Port 3 occupies a total of 8 pins (pins 10 to 17). It can be used as input or output. P3 does not

    need any pull-up resistors, the same as P1 and P2 did not. Although port 3 is configured as

    output port upon reset, this is not the way it is most commonly used. Port 3 has an additional

  • 8/8/2019 Micro Controller Embedded System

    10/41

    10

    function of providing some extremely important signals such as interrupts. Some of the

    alternate functions of P3 are listed below:-

    y P3.0 RXD (Serial input)

    y P3.1 TXD (Serial output)

    y P3.2 INT0 (External interrupt 0)

    y P3.3 INT1 (External interrupt 1)

    y P3.4 T0 (Timer 0 external input)

    y P3.5 T1 (Timer 1 external input)

    y P3.6 WR (External memory write strobe)

    yP3.7 RD (External memory read strobe)

  • 8/8/2019 Micro Controller Embedded System

    11/41

    11

    INSIDETHE 8051:-

    SOME 8-BIT REGITERS IN 8051

    y Most widely used registers areA, B, R , R1, R2, R3, R4, R , R , R , DPTRand PC.

    y All registers are -bits, except DPTRandtheprogramcounter whichare16 bit.

    y RegisterAis used forallarithmeticandLogic Instructions.

  • 8/8/2019 Micro Controller Embedded System

    12/41

    12

    MEMORY SPACE ALLOCATION:-

    1. INTERNAL ROM:-The 9C 1 has 4K bytes of on-chip R M. This 4K bytes R M memory has memory

    addresses of to FFFh. Programaddresses higherthan FFFh, whichexceedtheinternal

    R Mcapacity, willcausethemicrocontrollertoautomatically fetchcode bytes fromexternal

    memory. Code bytes can also be fetched exclusively from an externalmemory, addresses

    h to FFFFh, by connecting the external access pin to ground. Theprogram counter

    doesntcare wherethecodeis:thecircuitdesignerdecides whetherthecodeis foundtotally

    ininternalR M, totally inexternalR MorinacombinationofinternalandexternalR M.

    2. INTERNAL RAM:-The12 9 bytes ofRAM inside the 1areassignedaddresses to 7Fh.These12 bytes

    can bedividedintothreedifferentgroups as follows:-

    y A totalof 32 bytes from locations to1Fhare setaside for register banks and the

    stack.

    y A total of 16 bytes from locations 2 h to 2Fh are set aside for bit addressable

    read/writememory andinstructions.Atotalof bytes fromlocations 3 hto 7Fhare

    used for read and write storage, or what is normally calleda scratchpad.These

  • 8/8/2019 Micro Controller Embedded System

    13/41

    13

    locations ofRAMare widely used forthepurposeof storingdataandparameters by

    1programmers.

    BLOCK DIAGRAM OF 8051:-

  • 8/8/2019 Micro Controller Embedded System

    14/41

    14

    INSTRUCTION SET OF 8051 MICROCONTROLLER:-

    MNEMONIC DESCRIPTION BYTE OSCILLATOR

    PERIODARITHMETIC OPERATIONS:-

    ADD A,Rn Add register to 1 12

    Accumulator

    ADD A,direct Add direct byte to 2 12

    Accumulator

    ADD A,@Ri Add indirect RAM to 1 12

    Accumulator

    ADD A,#data Add immediate data to 2 12

    Accumulator

    ADDC A,Rn Add register to 1 12

    Accumulator with Carry

    ADDC A,direct Add direct byte to 2 12

    Accumulator with Carry

    ADDC A,@Ri Add indirect RAM to 1 12

    Accumulator with Carry

    ADDC A,#data Add immediate data to 2 12

    Acc with Carry

    SUBB A,Rn Subtract Register from 1 12

    Acc with borrow

    SUBB A,direct Subtract direct byte from 2 12

  • 8/8/2019 Micro Controller Embedded System

    15/41

    15

    Acc with borrow

    SUBB A,@Ri Subtract indirect RAM 1 12

    from ACC with borrow

    SUBB A,#data Subtract immediate data 2 12

    from Acc with borrow

    INC A Increment Accumulator 1 12

    INC Rn Increment register 1 12

    INC direct Increment direct byte 2 12

    INC @Ri Increment direct RAM 1 12

    DEC A Decrement Accumulator 1 12

    DEC Rn Decrement Register 1 12

    DEC direct Decrement direct byte 2 12

    DEC @Ri Decrement indirect RAM 1 12

    INC DPTR Increment Data Pointer 1 24

    MUL AB Multiply A & B 1 48

    DIV AB Divide A by B 1 48

    DA A Decimal Adjust 1 12

    Accumulator

  • 8/8/2019 Micro Controller Embedded System

    16/41

    16

    MNEMONIC DESCRIPTION BYTE OSCILLATOR

    PERIOD

    LOGICAL OPERATIONS:-

    ANL A,Rn AND Register to 1 12

    Accumulator

    ANL A,direct AND direct byte to 2 12

    Accumulator

    ANL A,@Ri AND indirect RAM to 1 12

    Accumulator

    ANL A,#data AND immediate data to 2 12

    Accumulator

    ANL direct,A AND Accumulator to 2 12

    direct byte

    ANL direct,#data AND immediate data to 3 24

    direct byte

    ORL A,Rn OR register to 1 12

    Accumulator

    ORL A,direct OR direct byte to 2 12

    Accumulator

    ORL A,@Ri OR indirect RAM to 1 12

    Accumulator

    ORL A,#data OR immediate data to 2 12

    Accumulator

  • 8/8/2019 Micro Controller Embedded System

    17/41

    17

    ORL direct,A OR Accumulator to 2 12

    direct byte

    ORL direct,#data OR immediate data to 3 24

    direct byte

    XRL A,Rn Exclusive-OR register to 1 12

    Accumulator

    XRL A,direct Exclusive-OR direct byte 2 12

    to Accumulator

    XRL A,@Ri Exclusive-OR indirect 1 12

    RAM to Accumulator

    XRL A,#data Exclusive-OR immediate 2 12

    data to Accumulator

    XRL direct,A Exclusive-OR 2 12

    Accumulator to direct

    byte

    XRL direct,#data Exclusive-OR immediate 3 24

    data to direct byte

    CLR A Clear Accumulator 1 12

    CPL A Complement 1 12

    Accumulator

    RL A Rotate Accumulator Left 1 12

    RLC A Rotate Accumulator Left 1 12

    through the Carry

  • 8/8/2019 Micro Controller Embedded System

    18/41

    18

    MNEMONIC DESCRIPTION BYTE OSCILLATOR

    PERIOD

    DATA TRANSFER:-

    MOV A,Rn

    Move register to 1 12

    Accumulator

    MOV A,direct Move direct byte to 2 12

    Accumulator

    MOV A,@Ri Move indirect RAM to 1 12

    Accumulator

    MOV A,#data Move immediate data to 2 12

    Accumulator

    MOV Rn,A Move Accumulator to 1 12

    register

    MOV Rn,direct Move direct byte to 2 24

    register

    MOV Rn,#data Move immediate data to 2 12

    register

    MOV direct,A Move Accumulator to 2 12

    direct byte

    MOV direct,Rn Move register to direct 2 24

    byte

    MOV direct,direct Move direct byte to direct 3 24

    MOV direct,@Ri Move indirect RAM to 2 24

  • 8/8/2019 Micro Controller Embedded System

    19/41

    19

    direct byte

    MOV direct,#data Move immediate data to 3 24

    direct byte

    MOV @Ri,A Move Accumulator to 1 12

    indirect RAM

    MOV @Ri,direct Move direct byte to 2 24

    indirect RAM

    MOV @Ri,#data Move immediate data to 2 12

    indirect RAM

    MOV DPTR,#data16 Load Data Pointer with a 3 24

    16-bit constant

    MOVC A,@A+DPTR Move Code byte relative 1 24

    to DPTR to Acc

    MOVC A,@A+PC Move Code byte relative 1 24

    to PC to Acc

    MOVX A,@Ri Move External RAM (8- 1 24

    bit addr) to Acc.

  • 8/8/2019 Micro Controller Embedded System

    20/41

    20

    MNEMONIC DESCRIPTION BYTE OSCILLATOR

    PERIOD

    MOVX @Ri,A Move Acc to External 1 24

    RAM (8-bit addr)

    MOVX @dptr,a Move Acc to External 1 24

    RAM (16-bit addr)

    PUSH direct Push direct byte onto 2 24

    stack

    POP direct Pop direct byte from 2 24

    stack

    XCH A,Rn Exchange register with 1 12

    Accumulator

    XCH A,direct Exchange direct byte 2 12

    with Accumulator

    XCH A,@Ri Exchange indirect RAM 1 12

    with Accumulator

    XCHD A,@Ri Exchange low-order 1 12

    Digit indirect RAM with

    Acc.

    BOOLEAN VARIABLE MANIPULATION:-

    CLR C Clear Carry 1 12

    CLR bit Clear direct bit 2 12

    SETB C Set Carry 1 12

  • 8/8/2019 Micro Controller Embedded System

    21/41

    21

    SETB bit Set direct bit 2 12

    CPL C Complement Carry 1 12

    CPL bit Complement direct bit 2 12

    ANL C,bit AND direct bit to CARRY 2 24

    ANL C,/bit AND complement of 2 24

    direct bit to Carry

    ORL C,bit OR direct bit to Carry 2 24

    ORL C,/bit OR complement of direct 2 24

    bit to Carry

    MOV C,bit Move direct bit to Carry 2 12

    MOV bit,C Move Carry to direct bit 2 24

    JC rel Jump if Carry is set 2 24

    JNC rel Jump if Carry not set 2 24

    JB bit,rel Jump if direct Bit is set 3 24

    JNB bit,rel Jump if direct Bit is Not 3 24

    set

    JBC bit,rel Jump if direct Bit is set & 3 24

    clear bit

  • 8/8/2019 Micro Controller Embedded System

    22/41

    22

    PROGRAM BRANCHING:-

    ACAL addr11 Absolute Subroutine Call 2 24

    LCALL addr16 Long Subroutine Call 3 24

    RET Return from Subroutine 1 24

    JZ rel Jump if Accumulator is 2 24

    Zero

    JNZ rel Jump if Accumulator is 2 24

    Not Zero

    CJNE A,direct,rel Compare direct byte to 3 24

    Acc and Jump if Not

    Equal

    CJNE A,#data,rel Compare immediate to 3 24

    Acc and Jump if Not

    Equal

    CJNE Rn,#data,rel Compare immediate to 3 24

    register and Jump if Not

    Equal

    CJNE @Ri,#data,rel Compare immediate to 3 24

    indirect and Jump if Not

    Equal

    DJNZ Rn,rel Decrement register and 2 24

    Jump if Not Zero

    DJNZ direct,rel Decrement direct byte 3 24

    and Jump if Not Zero

  • 8/8/2019 Micro Controller Embedded System

    23/41

  • 8/8/2019 Micro Controller Embedded System

    24/41

    24

    mov dph,a

    PROGRAM 4:- F nd h 1s c mp m n f h numb .

    setb rs0

    clr rs1

    mov a,#05h

    Cpl a

    Mov r3,a

    mov a,r3

    PROGRAM 5:- F nd h 2s c mp m n f h numb .

    setb rs0

    clr rs1

    mov a,#05h

    Cpl a

    ADD A, #01H

    Mov r3,a

    mov a,r3

    PROGRAM 6:- Add w 8 b numb s.

    mov a,#30h

    mov b,#44h

    add a,b

    PROGRAM 7:- Mu p y w 8 b numb s.

    mov a,#09h

    mov b,#02h

    mul ab

  • 8/8/2019 Micro Controller Embedded System

    25/41

    25

    PROGRAM 8:- Mu p y w 16 b numb s.

    mov dptr,#0902h

    mov a,#09

    mov b,dpl

    mul ab

    mov dpl,a

    mov a,#02h

    mov b,dph

    mul ab

    mov dph,a

    PROGRAM 9:- Sub c w 8 b numb s.

    mov a,#10h

    mov b,#01h

    subb a,b

    PROGRAM 10:- Sub c w 16 b numb s.

    mov dptr,#1234h

    mov a,#56h

    mov b,#78h

    subb a,dpl

    mov dpl,a

    mov a,b

    subb a,dph

    mov dph,a

  • 8/8/2019 Micro Controller Embedded System

    26/41

    26

    PROGRAM 10:- Ch ck wh h h numb s dd v n.

    mov a,#09h

    anl a,#01h

    PROGRAM 11:- P g m unp ck h p ck d BCD numb .

    clr rs1

    clr rs0

    mov a,#92h

    mov b,a

    anl a,#0fh

    mov r0,a

    mov a,b

    swap a

    anl a,#0fh

    mov r1,a

    PROGRAM 12:- S v n S gm n D sp y

    back: mov a,#0f9h

    mov p1,a

    mov p3,#0ffh

    lcall delay

    lcall delay

    lcall delay

    mov p3,#0f0h

    lcall delay

    lcall delay

    lcall delay

    mov p3,#0fh

    lcall delay

  • 8/8/2019 Micro Controller Embedded System

    27/41

    27

    lcall delay

    lcall delay

    mov p3,#00h

    lcall delay

    lcall delay

    lcall delay

    delay:

    ret

    sjmp back

    PROGRAM 13:- 7S gm n

    back: mov a,#0f9h

    mov p1,a

    lcall delay

    mov p1,#0b0h

    lcall delay

    mov p1,#0bh

    lcall delay

    delay:mov p3,#0ffh

    mov p3,#0f0h

    mov p3,#0fh

    mov p3,#00h

    ret

    sjmp back

  • 8/8/2019 Micro Controller Embedded System

    28/41

    28

    SCREENSHOTS / SNAPSHOTS

    SIMULATOR(EDSIM51):-

  • 8/8/2019 Micro Controller Embedded System

    29/41

    29

  • 8/8/2019 Micro Controller Embedded System

    30/41

    30

    USE OF COMPILER AND PROGRAMMER:-

    Compiler:- KEIL

    Programming Tool:- ECE FLASH MAGIC

    1. Double Click on t e icon present on t e desktop.

    2. T e following window will be popped-up

  • 8/8/2019 Micro Controller Embedded System

    31/41

    31

    3. Go to t e project & click on new project

    4. Make a folder on desktop & give file name.

  • 8/8/2019 Micro Controller Embedded System

    32/41

    32

    5. When you click on the save button ,following window opens

  • 8/8/2019 Micro Controller Embedded System

    33/41

    33

    6. SelectPhilips & 89v51RD2xx

    7.Then select NO on the pop-up given below.

  • 8/8/2019 Micro Controller Embedded System

    34/41

    34

    8. Then make a New File.

    9.Write or copy your code there & save it with extension .c or .asm

    depending on your coding.

  • 8/8/2019 Micro Controller Embedded System

    35/41

    35

    10.Go to target & then source group, right click on there & click on theoption add files to the project.

    11.Select your asm or c file which you wantto add.

    Example is with .c extension file

  • 8/8/2019 Micro Controller Embedded System

    36/41

    36

    12.Go to the option for target, click on output &tick on create hex fileoption

  • 8/8/2019 Micro Controller Embedded System

    37/41

    37

    13.Now build target.(Click on the pointed option)..

    14.It will show you0 errors & 0 warningon OutputWindow.

  • 8/8/2019 Micro Controller Embedded System

    38/41

    38

    Afterperformingallthese steps thechip will beconfiguredthrough FlashMagic.Letus hand

    onthe steps of chipconfigurationthrough FlashMagic

    Special Notes: -

    y Makeallthe DIP switches inoffposition before burningtheprograminthe

    controller.

    y Connectthe ProgrammingCableon your Kit (prog.Conn.)Andother sideofcable

    withtheC M PortoftheComputer.

    y Burnthe Programinthemicrocontroller withhelpof FLASH MAGICor ECE

    FLASH as explainedinthenext section.

    Flash window will appear as shown below.

  • 8/8/2019 Micro Controller Embedded System

    39/41

    39

    Set baud rate 9600 ,select working comport of PC to hardware and

    software communication as shown below.

    Now selecthex file to burn in chip through browse option as shown below.

  • 8/8/2019 Micro Controller Embedded System

    40/41

    40

    Now main window will appear as shown below.

  • 8/8/2019 Micro Controller Embedded System

    41/41

    Click on flash option resethardware will appear .

    Now press reset switch on hardware board and flash will burn

    with

    5-6

    Seconds.

    Again press reset switch on hardware board to run your program or to see

    output.