Expt Addition and Subtraction 1

Embed Size (px)

Citation preview

  • 8/12/2019 Expt Addition and Subtraction 1

    1/7

    HARDWARE SPECIFICATIONSi. Processor, Clock Frequency

    Intel 8051/89C51 at 11.059 MHz (89C51 max upto 33MHz).ii. Memory

    System EPROM : 0000 - 3FFFH & C000 - FFFFHSystem RAM : 4000 - BFFFHAdditional RAM : 0000 - 3FFFH & C000 - FF00Monitor Buffer : 4000 - 40FFHUser Program / Data RAM area : 4100 - BFFFHUser Data RAM area : 0000 - 3FFFH & C000 - FF00Memory mapped I/O : FF00 - FF2FH, FFC0 - FFFFHMemory mapped I/O expansion : FF20 FFBFH

    NoteThe RAM area is from 4000 - 40FF should not be accessed by the user since it is used by themonitor program.

    iii. Input / OutputSerial : 1 Number of RS232 Serial Interface using 8051 Serial Port.Timer : Timer 0 and Timer1 terminated in P7 ConnectorInterrupt : 8051 provides 5 interrupt sources. Among them two are externalinterrupts called INT 0 and INT 1.

    iv. LCD Interface(20 4) or (16 2) Alphanumeric LCD display Module

    v. IBM PC Keyboard Interfacevi. Onboard Battery Backup (Optional)

    Onboard Battery backup facility is provided for 64KB RAM 4100 - BFFF, 0000 - 3FFF& C000 - FF00.

    vii. System Power Consumption+ 5V : 1 amp+12V : 200mA-12V : 100mA

    viii. Power Supply SpecificationsModel : SMPSMain : 230 Volts AC at 50HzOutputs : i. +5V, 3 Amps Regulated.ii. +12V 500mA Regulated.

    iii. -12V, 500mA Regulated.ix. Physical Characteristics

    Vi-89C51 SB PCB : 261.65mm X 185.42mmWeight : Kg

  • 8/12/2019 Expt Addition and Subtraction 1

    2/7

    SOFTWARE SPECIFICATIONSVi-89C51 SB contains a high performance 32K bytes monitor program. It is designed to respondto user input, RS232C serial communications etc. The following is a simple description of thecommands in the Vi-89C51 SB.

    1. Substitute Memory Command

    Syntax :#SP - for Program Memory#SD - for Data Memory

    2. Register View / Modify#R

    3. GO CommandGO

    4. GO with break pointGO

    5. Trace Command#TR

    6. Fill Command#FP - for program memory#FD - for data memory

    7. Block Move Command#MP - for Program Memory#MD - for Data Memory

    8. Block Compare Command#CP - for program memory#CD - for data memory

    9. Insert Command#IP

    #ID 10. Delete Command#EP #ED

    11. Input Command#IN

    12. Output Command#O

    13. Serial Input Command#PI - for program memory#DI - for data memory

    14. Serial Output Command#PO for Program Memory#DO for Data Memory

    15. Print Command#PP for Program Memory#PD for Data Memory

    16. Dump Memory Contents#DP for Program Memory

  • 8/12/2019 Expt Addition and Subtraction 1

    3/7

    #DD for Data Memory17. Internal command

    #IR To view that bytes in the internal RAM location (00 - 7F).

    18. Assemble

    #A 19. Unassemble#U

    20. EPROM Programmer#E To program the EPROMs like 2716, 2732, etc.

    21. Serial Mode#SM To access the kit via serial port.

    RESULTFamiliarized with Intel 8051 microcontroller, its salient features, architecture and the microcontrollerdeveloper kit.

  • 8/12/2019 Expt Addition and Subtraction 1

    4/7

    16 BIT ADDITION

  • 8/12/2019 Expt Addition and Subtraction 1

    5/7

    EXPERIMENT 2

    ADDITION AND SUBTRACTION OF 16 BIT NUMBERS USING 8051

    AIM

    To perform 16-bit addition and subtraction of two 16-bit data using indirect addressing and storethe result in memory.

    THEORY As there is only one 16-bit Register in 89C51, 16-bit addition is performed by using ADDCinstruction twice, i.e. adding LSB first and MSB next.

    As there is only one 16-bit Register in 89C51, 16-bit subtraction is performed by using subbinstruction.

    PROGRAM

    16 BIT ADDITION

    ADDRESS LABEL OPCODE MNEMONICS COMMENTS

    4100 ORG 4100 InitializationMOV DPTR,#4201 Point LSB of first data to DPTR

    MOVX A,@DPTR Copy LSB of first data to Accumulator

    MOV B,A Copy data from A to B register

    MOV DPTR,#4203 Point LSB of second data to DPTR

    MOVX A,@DPTR Copy LSB of second data to Accumulator

    ADDC A,B Add the two numbers

    MOV DPTR,#4501 Point the location where LSB of result is to be stored

    MOVX @DPTR,A Transfer LSB of result to external memory

    MOV DPTR,#4200 Point MSB of first data to DPTR

    MOVX @DPTR,A Copy MSB of first data to Accumulator

    MOV B,A Copy data from A to B register

    MOV DPTR,#4202 Point MSB of second data to DPTR

    MOVX @DPTR,A Copy MSB of second data to Accumulator

    ADDC A,B Add the two numbers

    MOV DPTR,#4500 Point the location where MSB of result is to be stored

    MOVX @DPTR,A Transfer LSB of result to external memoryE SJMP E Jump from the program to finish operation.

  • 8/12/2019 Expt Addition and Subtraction 1

    6/7

    16 BIT SUBTRACTION

    OBSERVATION

    16 BIT ADDITION

    INPUT OUTPUT

    4200: 4500:4201: 4501:4202:4203:16 BIT SUBTRACTION

    INPUT OUTPUT

    4200: 4500:4201: 4501:4202:4203:

  • 8/12/2019 Expt Addition and Subtraction 1

    7/7

    16 BIT SUBTRACTION

    ADDRESS LABEL OPCODE MNEMONICS COMMENTS

    4100 ORG 4100 InitializationMOV DPTR,#4203 Point LSB of second data to DPTR

    MOVX A,@DPTR Copy LSB of second data to AccumulatorMOV B,A Copy data from A to B register

    MOV DPTR,#4201 Point LSB of first data to DPTR

    MOVX A,@DPTR Copy LSB of first data to Accumulator

    SUBB A,B Subtract the two numbers

    MOV DPTR,#4501 Point the location where LSB of result is to be stored

    MOVX @DPTR,A Transfer LSB of result to external memory

    MOV DPTR,#4202 Point MSB of second data to DPTR

    MOVX @DPTR,A Copy MSB of second data to Accumulator

    MOV B,A Copy data from A to B register

    MOV DPTR,#4200 Point MSB of first data to DPTR

    MOVX @DPTR,A Copy MSB of first data to Accumulator

    SUBB A,B Subtract the two numbers

    MOV DPTR,#4500 Point the location where MSB of result is stored

    MOVX @DPTR,A Transfer LSB of result to external memory

    E SJMP E Jump from the program to finish operation.

    PROCEDURE

    1. Switch on the microcontroller trainer kit. Then a command window appears on the display. Enterthe assembler command (a), press enter.

    2. Then enter the origin address.3. Type the program from starting address and press enter. Then corresponding opcode will be

    displayed. After entering full program, enter dot (.) and press enter to go back to command prompt.

    4. Enter the substitute memory command (sd) followed by the location where data is to be entered.Enter the input data. To estimate this command press dot (.) followed by enter.

    5. To execute the program enter go command with staring address and press enter. Then the program will be executed.

    6. Press reset key in the kit to reset. Check the result by entering the substitute memory commandfollowed by memory address where result is stored.

    RESULT

    Successfully executed the program and obtained the results of 16 bit addition and subtraction.