Friday, 12 June 2020

Assembly programming and Instruction of 8051

✏️Assembly programming and Instruction of 8051

๐Ÿ‘‰Subroutine
๐Ÿ‘‰Call instruction
๐Ÿ‘‰Nested loop

✏️SUBROUTINE 
๐Ÿ“ŒIn assembly language programming it is common to have one main program and many sub routines that are called from the main program.
๐Ÿ“ŒThe is allows to make separate module of program known as subroutine. 
๐Ÿ“ŒEach module can be tested separately and brought together in main program.
๐Ÿ“ŒMore importantly, in a large program the modules can be assigned to different programmers to shorten development time.


✏️CALL INSTRUCTIONS

๐Ÿ‘‰LCALL (long call)
๐Ÿ‘‰ACALL (absolute call)


๐Ÿ“ŒLCALL (LONG CALL)
 ๐Ÿ‘‰It is a 3 byte instruction. 
๐Ÿ‘‰The first byte is the opcode and second and third are used address of  target subroutine.
๐Ÿ‘‰This can be used to call subroutines located anywhere within the 64K-byte address space of 8051.
๐Ÿ‘‰When a subroutine is called, control is transferred to that subroutine, processor saves the program counter and begins to fetch instructions from new location.
๐Ÿ‘‰ After execution the subroutine, thee instruction RET (return) control back to the caller. 
Syntax : LCALL LABEL


✏️ACALL (ABSOLUTE CALL) 
๐Ÿ‘‰ACALL is a 2-byte instruction. 
๐Ÿ‘‰Only 11 bits are used as address. 
๐Ÿ‘‰While the target address of ACALL must be within a 2K-byte range. In variation of the 8051,  on-chip ROM is as low as 1K byte.
๐Ÿ‘‰ In such cases, the use of ACALL instead of LCALL can save a number of bytes of ROM space.
Syntax : ACALL LABEL


✏️NESTED LOOPS

๐Ÿ‘‰A loop within a loop, an inner loop within the outer one 
๐Ÿ‘‰The first pass of outer loop triggers the inner loop which executes to completion. 
๐Ÿ‘‰Then the second pass of outer loop of outer loop triggers inner loop again
๐Ÿ‘‰This repeats till outer loop FINISHES. 


๐Ÿ“ŒSYNTAX

for (initialize counter; test condition; ++ or –)
{
for (initialize counter; test condition; ++ or --)
{
.// inner loop
}
.//outer loop
}


No comments:

Post a Comment

If you have any doubts or clarification you need in my blog topics, I would ๐Ÿ’ฏ try to clear it in an efficient manner as possible. I will also accept your suggestions.

๐Ÿ’‍♂️ARTIFICIAL SUN CREATED BY CHINA ๐Ÿ‘ˆ

๐ŸŒž ARTIFICIAL SUN MADE BY CHINA ๐ŸŒž ☀️China successfully powered up its “artificial sun” nuclear fusion reactor for the first ti...