AIM
To perform 16-bit addition of two 16-bit data using immediate 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 LSD first and MSD next.
DATAM1 – 12; DATAM2 = 56.
DATAM1 – MSD OF DATA1,
DATAM2 – MSD OF DATA2,
DATAL1 – LSD OF DATA1,
DATAL2 – LSD OF DATA2.
ASSEMBLY PROGRAM TO ADD TWO 16 BIT NUMBER
| ADDRESS | OPCODE | MNEMONICS |
| 8500 | 90 85 01 | MOV DPTR,#8501H |
| 8503 | E0 | MOVX A,@DPTR |
| 8504 | F5 F0 | MOV B,A |
| 8506 | 90 85 03 | MOV DPTR,#8503H |
| 8509 | E0 | MOVX A,@DPTR |
| 850A | 35 F0 | ADDC A,B |
| 850C | 90 8601 | MOV DPTR,#8601H |
| 850F | F0 | MOVX @DPTR,A |
| 8510 | 90 85 00 | MOV DPTR,#8500H |
| 8513 | E0 | MOVX A,@DPTR |
| 8514 | F5 F0 | MOV B,A |
| 8516 | 90 85 02 | MOV DPTR,#8502H |
| 8519 | E0 | MOVX A,@DPTR |
| 851A | 35 F0 | ADDC A,B |
| 851C | 90 86 00 | MOV DPTR,#8600H |
| 851F | F0 | MOVX @DPTR,A |
| 8520 | 80 FE | E: SJMP E |
PROCEDURE
Enter the above opcodes from 8500 in the trainer.
☞Execute the program.
☞Check for the result at 8550 and 8551.
☞Change data and see if the result at 8550 changes accordingly.
EXAMPLE:
The program is to add the 16-bit data 1234 with the data 5678 and store the result at the locations RESULT: [8550] = AC (LSB); [8551] = 68 (MSB). DATAL1 – 34; DATAL2 = 78.
RESULT
Thus the Addition of two 16 bit numbers is stored in the resultant memory
This program is done thru 8051 Lab Trainer Kit




it is very useful