Expt Addition and Subtraction 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

HARDWARE SPECIFICATIONS

i. Processor, Clock Frequency


Intel 8051/89C51 at 11.059 MHz (89C51 max upto 33MHz).
ii. Memory
System EPROM : 0000 - 3FFFH & C000 - FFFFH
System RAM : 4000 - BFFFH
Additional RAM : 0000 - 3FFFH & C000 - FF00
Monitor Buffer : 4000 - 40FFH
User Program / Data RAM area : 4100 - BFFFH
User Data RAM area : 0000 - 3FFFH & C000 - FF00
Memory mapped I/O : FF00 - FF2FH, FFC0 - FFFFH
Memory mapped I/O expansion : FF20 FFBFH
Note
The RAM area is from 4000 - 40FF should not be accessed by the user since it is used by the
monitor program.
iii. Input / Output
Serial : 1 Number of RS232 Serial Interface using 8051 Serial Port.
Timer : Timer 0 and Timer1 terminated in P7 Connector
Interrupt : 8051 provides 5 interrupt sources. Among them two are external
interrupts called INT 0 and INT 1.
iv. LCD Interface
(20 4) or (16 2) Alphanumeric LCD display Module
v. IBM PC Keyboard Interface
vi. 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 Specifications
Model : SMPS
Main : 230 Volts AC at 50Hz
Outputs : i. +5V, 3 Amps Regulated.
ii. +12V 500mA Regulated.
iii. -12V, 500mA Regulated.
ix. Physical Characteristics
Vi-89C51 SB PCB : 261.65mm X 185.42mm
Weight : Kg




SOFTWARE SPECIFICATIONS
Vi-89C51 SB contains a high performance 32K bytes monitor program. It is designed to respond
to user input, RS232C serial communications etc. The following is a simple description of the
commands in the Vi-89C51 SB.
1. Substitute Memory Command
Syntax:
#SP <Addr> <CR> - for Program Memory
#SD <Addr> <CR> - for Data Memory
2. Register View / Modify
#R <CR>
3. GO Command
GO <Addr> <CR>
4. GO with break point
GO <Start Addr> <End Addr> <CR>
5. Trace Command
#TR <Addr> <CR>
6. Fill Command
#FP <Start Addr> <End Addr> <Data> <CR> - for program memory
#FD <Start Addr> <End Addr> <Data> <CR> - for data memory
7. Block Move Command
#MP <Start Addr> <End Addr> <Dest Addr> <CR> - for Program Memory
#MD <Start Addr> <End Addr> <Dest Addr> <CR> - for Data Memory
8. Block Compare Command
#CP <Start Addr> <End Addr> <Dest Addr> <CR> - for program memory
#CD <Start Addr> <End Addr> <Dest Addr> <CR> - for data memory
9. Insert Command
#IP <Insert Addr> <Program End Addr> <No. of Bytes> <CR>
#ID <Insert Addr> <Data Mem End Addr> <No. of Bytes> <CR>
10. Delete Command
#EP <Start Addr> <End Addr> <Program End Addr> <CR>
#ED <Start Addr> <End Addr> <Data mem End Addr> <CR>
11. Input Command
#IN <Port Addr> <CR>
12. Output Command
#O <Port Addr> <Data> <CR>
13. Serial Input Command
#PI <Start Addr> <CR> - for program memory
#DI <Start Addr> <CR> - for data memory
14. Serial Output Command
#PO <Start Addr> <End Addr> <CR> for Program Memory
#DO <Start Addr> <End Addr> <CR> for Data Memory
15. Print Command
#PP <Start Addr> <End Addr> <CR> for Program Memory
#PD <Start Addr> <End Add> <CR> for Data Memory
16. Dump Memory Contents
#DP <Start Addr> <End Addr> <CR> for Program Memory


#DD <Start Addr> <End Addr> <CR> for Data Memory
17. Internal command
#IR <Addr> <CR>
To view that bytes in the internal RAM location (00 - 7F).
18. Assemble
#A <CR>
19. Unassemble
#U <CR>
20. EPROM Programmer
#E <CR>
To program the EPROMs like 2716, 2732, etc.
21. Serial Mode
#SM <CR>
To access the kit via serial port.

RESULT
Familiarized with Intel 8051 microcontroller, its salient features, architecture and the microcontroller
developer kit.





16 BIT ADDITION





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 store
the result in memory.

THEORY
As there is only one 16-bit Register in 89C51, 16-bit addition is performed by using ADDC
instruction 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 subb
instruction.
PROGRAM
16 BIT ADDITION
ADDRESS LABEL OPCODE MNEMONICS COMMENTS
4100 ORG 4100 Initialization
MOV 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 memory
E SJMP E Jump from the program to finish operation.





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:



16 BIT SUBTRACTION
ADDRESS LABEL OPCODE MNEMONICS COMMENTS
4100 ORG 4100 Initialization
MOV DPTR,#4203 Point LSB of second data to DPTR
MOVX A,@DPTR Copy LSB of second data to Accumulator
MOV 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. Enter
the 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 command
followed by memory address where result is stored.
RESULT
Successfully executed the program and obtained the results of 16 bit addition and subtraction.

You might also like