SAMPLE PROGRAM: 

mov a,#10h; 

mov r2,#10h; 

mov r0,a; 

mov r1,#30h; 

mov r1,r0; 

mov 10h,#FFh; 


     1.    Write down the hex code for the instructions and differentiate opcodes and operands.

 

Ans:-

 

Instruction

Hex Code

Mov a, #10h

74

Mov r2, #10h

7A

Mov r0, a

F8

Mov r1, #30h

79

Mov 10h, FFh#

75

 

Opcode is the first instruction that the CPU reads after turn on.

Operand is a variable that stores data.

 

       2.     What is size of registers in program?

 

Ans:   a: 8-bit

            R0: 8-bit

            R1: 8-bit

            R2: 8-bit

 

       3.     What will be the contents of the PC at the instruction mov r0, a?

 

Ans: 05h

 

       4.     Mention addressing mode of each instruction.

 

Ans:

 

mov a,#10h;   immediate
mov r2,#10h;  
direct
mov r0,a;  
register
mov r1,#30h;  
direct
mov r1,r0;   
register
mov 10h,#FFh;  
direct

 

      5.     Write instructions to transfer the value 10H to internal RAM location 8H, external ram location 0008H and 0100H.

 

Ans:

Mov a, #10h

Mov dptr, #8h

Mov @dptr, a

 

Movx @dptr, a

 

Mov dptr, #100h

Movx @dptr, a

 

      6.      Write an instruction or a set of instructions to transfer a byte from internal RAM location 7H to external RAM location 0007H, 0010H and 0100H.

 

Ans:

Mov a, 7h

Mov dptr, #7h

Movx @dptr, a

 

Mov dptr, #10h

Movx @dptr, a

 

Mov dptr, #100h

Movx @dptr, a

 

     7.      Do inverse of program 6.

 

Ans:

Mov r0, #7h

Movx a, @r0

Mov 7h, a

 

Mov r0, #10h

Movx a, @r0

Mov 7h, a

 

Mov r0, #100h

Movx a, @r0

Mov 7h, a

 

     8.      Write a program to transfer byte from code memory to internal RAM and external RAM

 

Ans:

Mov a, #5h

Mov dptr, #4h

Movc a,@a+dptr

Mov 10h, a

Mov r0, #12h

Mov @r0, a

 

     10.   Write a program to transfer byte from external RAM to external ROM

 

Ans:

Mov dptr, #20h

Movx a, @dptr

Movc a, @a+dptr

 

     11.   Write a program to transfer byte from internal RAM to internal ROM.  

 

Ans:

Mov a, 20h

Mov dptr, 10h

Movc a, @a+dptr


Post a Comment

Previous Post Next Post