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

1-) Write a program in assembly to copy the value of 0x95 into memory location 0

ID: 3579336 • Letter: 1

Question

1-) Write a program in assembly to copy the value of 0x95 into memory location 0x0190 through 0x0197 using:
a-) direct addressing mode
b-) register indirect addressing mode without a loop

c-) register indirect addressing mode with a loop

2-) Write a program in assembly to get the status of a switch connected to pin PC3 and save it in D4 of internal RAM location 0x193.

3-) Write a program in assembly to read the content of location 0x0139 of EEPROM into Port D.

1- Write a program in assembly to copy the value of 0x95 into memory location 0x0190 through 0x0197 using: (6 points). a-) direct addressing mode b-) register indirect addressing mode without a loop c-) register indirect addressing mode with a loop 2-) Write a program in assembly to get the status of a switch connected to pin PC3 and save it in D4 of internal RAM location 0x193 (2 points). 3- Write a program in assembly to read the content of location 0x0139 of EEPROM into Port D. (2 points

Explanation / Answer

Write a program in assembly to copy the value of 0x95 into memory location 0x0190 through 0x0197 using:
a-) direct addressing mode
b-) register indirect addressing mode without a loop

c-) register indirect addressing mode with a loop

(a)

MOV A, 0x95

MOV 0x0190,A             ;COPY A INTO RAM LOCATION 0x0190

MOV 0x0191,A

MOV 0x0192,A

MOV 0x0193,A

MOV 0x0194,A

MOV 0x0195,A

MOV 0x0196,A

MOV 0x0197,A             ;COPY A INTO RAM LOCATION 0x0197

(B)

MOV A, 0x95

MOV R0, 0x0190                   ;LOAD THE POINTER . R0=0x0190

MOV@R0,A                  ;COPY A TO RAM LOCATION R0 POINTS TO

INC RO                         ;INCREMENT POINTER

MOV@R0,A                  ;COPY A TO RAM LOCATION R0 POINTS TO

INC RO                         ;INCREMENT POINTER

MOV@R0,A                  ;COPY A TO RAM LOCATION R0 POINTS TO

INC RO                         ;INCREMENT POINTER

MOV@R0,A                  ;COPY A TO RAM LOCATION R0 POINTS TO

INC RO                         ;INCREMENT POINTER

MOV@R0,A                  ;COPY A TO RAM LOCATION R0 POINTS TO

INC RO                         ;INCREMENT POINTER

MOV@R0,A                  ;COPY A TO RAM LOCATION R0 POINTS TO

INC RO                         ;INCREMENT POINTER

MOV@R0,A                  ;COPY A TO RAM LOCATION R0 POINTS TO

INC RO                         ;INCREMENT POINTER

MOV@R0,A

(C)

MOV A, 0x95

MOV R0, 0x0190                   ;LOAD POINTER

MOV R2,#07                 ;LOAD COUNTER, R2=7

AGAIN:               MOV @R0,A

                   INC RO

                   DJNZ AGAIN                ;LOOP UNTILL COUNTER =ZERO

Write a program in assembly to get the status of a switch connected to pin PC3 and save it in D4 of internal RAM location 0x193.

MYBITREG EQU 0x193                           SET ASIDE LOC 0x193. REG

          BSF TRISB,0

AGAIN: BTFSS PORTB,0

                   GOTO OVER

                   BEF MYBITREG,0

                   GOTO AGAIN

OVER:BCF MYBITREG,0

                   GOTO AGAIN