- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program branch group in 8051
In 8051 Microcontroller there is 17 different instructions under the Logical Group. In total there are 46 opcodes. These instructions do not affect the flag bits but the CJNE affects the CY flag. In these instructions, the 11-bit address and 16-bit addresses are used.
In the following table, we will see the Mnemonics, Lengths, Execution Time in terms of the machine cycle, Number of Opcodes etc.
|Mnemonics||Byte Count||ExecutionTime||Opcode Count|
|CJNE A, a8, rel||3||2||1|
|CJNE A, #d8, rel||3||2||1|
|CJNE Rn, #d8, rel||3||2||8|
|CJNE @Ri, #d8, rel||3||2||2|
|DJNE Rn, rel||2||2||8|
|DJNZ a8, rel||3||2||1|
|Sr.No||Instruction & Description|
This is an example of LJMP addr16. The LJMP stands for the long jump. It can jump to the symbolic location label. The address is generated by assembler from the value of label. Using this instruction, we can jump anywhere in the program.
This is an instruction of ACALLa ddr11 type. The ACALL is the absolute call. Using this instruction, it calls a subroutine from the symbolic location SUBR. Before call, it stores the value of Program Counter, at the top of the stack.
This instruction is like SJMP rel.SJMP means Short jump. Here the LABEL is an 8-bit address generated by the assembler. Using this instruction we can halt the program in8051.
This instruction is of like JZ rel instruction. When the value of A register is 00h, then only it jumps to LABEL, otherwise, it will be ignored. The assembler generates 8-bit signed displacement from the instruction.
This is return instruction. When it is executed, the next address of the program counter is popped from the stack top, and the value of SP is decremented by 2.
This is Return from Interrupt. This is also like RET instruction. But it restores the interrupt logic also. So after restoring it can accept additional interrupts at the same priority level.
|7||DJNZ 80H, LABEL|
This is like DJNZ a8, rel. It means Decrement and Jump if not zero. So the port P0 contents are decremented by 1. When the value is not 00H after the decrement, the branch instruction takes place. Here the LABEL is a signed8-bit number.
|8||CJNE R5, #90H, LABEL|
This is like the instruction CJNE Rn, #d8, rel. The CJNE stands for Compare and Jump if not Equal. So itis a combined instruction of compare and jump. Here the content ofR5 is compared with 90H. When the values are not same it jumps to a label. The LABEL is 8-bit signed number.
During execution of ACALL or AJMP, we can think that the program memory is divided into 2K byte block. From the 16-bit address, the first five bits are fixed. Further the block of 2K memory that can be divided into 256-byte pages. So we need 3 bits to select the pages.
There are three kinds of unconditional jumps. The SJMP, LJMP, and AJMP, but two kinds of unconditional call instruction ACALL, LCALL. No SCALL is present.
- Related Articles
- Arithmetic group in 8051
- Logical Group in 8051
- Data transfer group in 8051
- Bit-processing group in 8051
- Bit manipulation program in 8051
- Program memory structure of Intel 8051
- Program to Subtract two 8 Bit numbers in 8051 Microprocessor
- Program to Multiply two 8 Bit numbers in 8051 Microprocessor
- Program to Divide two 8 Bit numbers in 8051 Microprocessor
- 8051 Program to Add two 8 Bit numbers
- 8051 Program to Subtract two 8 Bit numbers
- 8051 Program to Multiply two 8 Bit numbers
- 8051 Program to Divide two 8 Bit numbers
- Interrupt handing in 8051
- 8051 Microcontroller