Question

In: Electrical Engineering

What are the pseudo instructions commonly used in the MCS-51 assembly language? What effect does each...

What are the pseudo instructions commonly used in the MCS-51 assembly language? What effect does each directive have?
6. Provided data area from 1000H to 10FFH in external RAM, transfer the data to the area starting at 2500H in external RAM. Please write the program.
11. The crystal oscillator frequency of system is 12MHz. Write the delay subroutine with delay time of 50ms.

Solutions

Expert Solution

Answer :- Assembler directives in MCS_51 is also known as Pseudo Instructions. These instructions are used for giving direction to the assembler.

Example :- DB, EQU, ORG, END etc. These directives does not take machine cycles. This is same as #define macros in C programming.

/*****************************************************************************/

MOV R0, #00h ;R0 = 00

MOV DPTR, #0000h ;DPTR = 0000h

Loop1:

MOV DPH, #10h ;lower byte of DPTR i.e. DPL = 10h

MOVX A, @DPTR ;read the value from address in DPTR, keep it in A

MOV DPH, #25h ;higher byte of DPTR i.e. DPH = 25h

MOVX @DPTR, A ;write value in A to address in DPTR

INC DPTR ;DPTR = DPTR + 1

INC R0 ;R0 = R0 + 1

JNZ R0, Loop1 ;goto label Loop1 if R0 not zero

END

/********************************************************************************/

Frequency = 12 Mhz, T = 1/12 us .
Count value = delay / T = 0.05*12*1000000 = 600000 = 84 x 84 x 85, nearly same as 600000, so the subroutine is-

Delay50ms: ;subroutine name
MOV R0, #84 ;R0 = 84

LoopOut:
MOV R1, #84 ;R1 = 84
MOV R2, #85 ;R2 = 85
AJMP LoopIn ;goto LoopIn
Redo:
DJNZ R0, LoopOut ;R0 = R0 – 1
AJMP SubEnd

LoopMid:
MOV R2, #85 ;R2 = 85
DJNZ R1, LoopIn ;R1 = R1 – 1 and if not zero goto LoopIn
AJMP Redo ;if R1 = 0, goto label LoopOut

LoopIn:
DJNZ R2, LoopIn
AJMP LooMid

SubEnd :
END


Related Solutions

1. Convert the machine language instructions into assembly language instructions: 7976C1 06
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
Write a sequence of assembly language instructions to subtract each entry of an array A of...
Write a sequence of assembly language instructions to subtract each entry of an array A of five two’s complement 16-bit binary integers from the corresponding entry of an array B of five two’s complement 16-bit binary integers and construct a third array C of two’s complement 16-bit binary integers. i.e. C[i] = A[i] - B[i]. Use the following data for the arrays A and B. A: 10, -15, 20, 4, -5 B: 25, -5, -30, 6, 10 please answer in...
Write a MIPS assembly language program that implements the following pseudo-code operation: result = x +...
Write a MIPS assembly language program that implements the following pseudo-code operation: result = x + y – z + A[j] x and y should be in reserved memory words using the .word directive and labeled as x and y. Initialize x=10 and y=200. Read in z from the console. Input the value -8. This is the value for z, not for –z. Store this value in memory with the label z. To begin, you could just initialize z to...
In assembly 1.What is the effect of the following instructions executing on a modern x86 64-bit...
In assembly 1.What is the effect of the following instructions executing on a modern x86 64-bit system (describe what happens and the final contents of the registers involved)? Can you obtain the same end result using only two instructions, and no other registers? PUSH RAX PUSH RBX PUSH RCX XOR RAX,RAX XOR RBX,RBX XOR RCX,RCX POP RAX POP RAX POP RBX 2. What is the purpose of a segment register in protected mode memory addressing? 3. For a 32-bit Pentium4...
Translate following pseudo-code to MIPS assembly language cout << “\n Please input a number for $s0”;...
Translate following pseudo-code to MIPS assembly language cout << “\n Please input a number for $s0”; cin >> $s0; cout << “\n Please input a number for $s1”; cin >> $s1; cout << “\n Please input a number for $s2”; cin >> $s2; $t0 = $s0 / 8 - 2 * $s1 + $s2; cout << “\n the Value of the expression “$s0 / 8 - 2 * $s1 + $s2” is ”; cout >> $t0; return;
For the PIC16F887, using the execution delay of instructions, write assembly language commands to implement a...
For the PIC16F887, using the execution delay of instructions, write assembly language commands to implement a delay of 3 seconds
Write a possible assembly language instruction or set of instructions to accomplish the following: a) Compare...
Write a possible assembly language instruction or set of instructions to accomplish the following: a) Compare the byte stored at the memory location pointed to by register R4 to the upper (higher) byte stored in register R5 b) Branch to instruction at label ‘ZERO’ if the lower byte of register R6 is zero c) Jump to the instruction at label ‘EVEN’ if the value in register R7 is an even number
The language is Assembly Language. Thank you! Assignment 3: Run the following code. Record what each...
The language is Assembly Language. Thank you! Assignment 3: Run the following code. Record what each of the flag changes are for each command. INCLUDE Irvine32.inc .data .code main PROC mov al,255 add al,1 call DumpRegs sub al,1 call DumpRegs sub al,1 call DumpRegs exit main ENDP END main
Suppose the target assembly language for a compiler has these five instructions for integers: load address,...
Suppose the target assembly language for a compiler has these five instructions for integers: load address, reg add reg, reg, reg sub reg, reg, reg mul reg, reg, reg store reg, address In these instructions, an address is the name of a static variable (whose actual address will be filled in by the loader). A reg is the name of an integer register,
a special extra-fast memory location inside the processor. The target assembly language has three integer registers: r1,...
MIPS assembly language. Why do "la label" instructions always need to be translated into 2 lines...
MIPS assembly language. Why do "la label" instructions always need to be translated into 2 lines of pseudo code? What about "lw label" instructions? Explain the similarities and differences in how they are implemented in MARS.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT