AIM: To exhibit the RAM direct addressing and bit addressing schemes of 8051 microcontroller.
ALGORITHM:
- For Bit addressing, Select Bank 1 of RAM by setting 3rd bit of PSW
- Using Register 0 of Bank 1 and accumulator perform addition
- For direct addressing provide the address directly (30 in this case)
- Use the address and Accumulator to perform addition
- Verify the results
PROGRAM:
SETB PSW.3
MOV R0,#data1
MOV A,#data2
ADD A,R0
MOV DPTR,#4500
MOVX @DPTR,A
HERE: SJMP HERE
Direct Addressing:
MOV 30,#data1
MOV A,#data2
ADD A,30
MOV DPTR,#4500
MOVX @DPTR,A
HERE: SJMP HERE
OBSERVATION:
Bit addressing:
Input: | 54 |
25 | |
Output: | 79 (4500) |
Direct addressing:
Input: | 54 |
25 | |
Output: | 79 (4500) |
RESULT:
Thus the program to exhibit the different RAM addressing schemes of 8051 was executed.