Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assembly Coding 8051 Write an assembler program using MultiSim which populates R

ID: 3677924 • Letter: A

Question

Assembly Coding 8051

Write an assembler program using MultiSim which populates R0 – R7 of bank 0 and bank 1 with the RAM address of each register. Use register addressing for your code. (include comments)

Append to your program code and define the location of the stack to start placing data to 31H. Then utilize a subroutine which takes the SUM the values in all the registers in a specific bank.The sum of the registers from bank 0 and bank 1 must each be placed on the stack.

Append to your program code to include another subroutine to determine the SUM of banks 0 and 1 which results in the total SUM. Place the total SUM in R7 of bank 3.

Modify the above program and use the EQU directive to reference R7 of bank 3 to hold the total SUM of bank 0 and bank 1.

Explanation / Answer

; start timer 1 and then start serial rx in mode 1 CLR RCLK ; rx uses timer 1 MOV TMOD, #020H ; 8-bit auto reload MOV TH1, #0E5H ; 1.2K baud rate MOV TL1, #0E5H SETB TR1 ; start timer 1 CLR SM0 ; set serial mode to 1 SETB SM1 CLR RI

CLR TI SETB REN The MCU is also configured to use serial interrupts to notify it whenever a whole character has been received from the virtual terminal. SETB ES ; enable serial interrupt SETB EA ; enable interrupts in general When a serial interrupt occurs, the MCU executes an interrupt service routine whose purpose is to echo the character back to the virtual terminal. This is achieved by sending the character out through the TxD pin of the UART at the same 1.2 Kbps baud rate. The virtual terminal displays everything that it receives in the virtual terminal window. After the interrupt service routine finishes transmitting the character to the virtual terminal, it returns from the routine and waits in a loop until the next character is received and the whole process of echoing the character back is repeated. ORG 0023H ; serial ISR address LJMP int_serial
int_serial: PUSH PSW PUSH ACC
JNB RI, exit_int ; check whether RI was set ; received data on pin RxD MOV A, SBUF ; SBUF contains received data CLR RI ; reset RI bit in order to receive more data
; echo data received on RxD through TxD MOV SBUF, A JNB TI, $ CLR TI
exit_int: POP ACC POP PSW RETI ; return from interrupt service routine

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote