51 MCU unconditional transfer instructions (4)

Publisher:码字奇才Latest update time:2017-10-17 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Control transfer instructions are used to control the flow of the program, and the controlled range is the program memory range. The MCS-51 series of microcontrollers have relatively rich control transfer instructions , including long call and long transfer instructions that can access 64kB program space address units, absolute call and absolute transfer instructions that can access 2kB bytes, short relative transfer within a page range and other unconditional transfer instructions. The execution of these instructions generally does not affect the flag bits.


[1]. Unconditional transfer instructions (4)


After this set of instructions is executed, the program will unconditionally transfer to the address pointed to by the instruction. The program memory space accessed by the long transfer instruction is 16 addresses and 64kB, and the program memory space accessed by the absolute transfer instruction is 11-bit address and 2kB space.


LJMP addr16; addr16 → (PC), assign a new value to the program counter (16-bit address)

AJMP addr11; (PC) + 2 → (PC), addr11 → (PC10-0) The program counter is assigned a new value (11-bit address), (PC15-11) is unchanged


SJMP rel; (PC) + 2 + rel → (PC) The current program counter is first added with 2 and then the offset to assign a new value to the program counter 


JMP @A+DPTR; (A) + (DPTR) → (PC), the value of the address unit pointed to by the accumulator plus the value of the data pointer assigns a new value to the program counter


If you want to analyze these instructions in detail, there are big differences. But for beginners, you can ignore so much and understand them all as LJMP labels, that is, jump to a label. But in fact, we have already come into contact with JMP labels in the previous routines, and we also know how to use them. The same is true for AJMP and SJMP. So what is the difference between these instructions? It lies in the different jump ranges. For example, for long jump, LJMP can jump 64K at a time (of course, it doesn't matter if it's closer). AJMP can only jump 2K at most, and SJMP can only jump 256 at most. In principle, all places where AJMP or SJMP is used can be replaced by LJMP. Therefore, for beginners, LJMP can be used when jumping.


However, be careful when looking up the table, as errors may occur because their machine cycles are different and the numbers obtained are also different.


Reference address:51 MCU unconditional transfer instructions (4)

Previous article:MCS-51 MCU Assembly Language Conditional Transfer Instructions (8) Programming Examples
Next article:MCS-51 series microcontroller bit control transfer instructions (5)

Recommended ReadingLatest update time:2024-11-16 20:57

51 MCU Introduction - UART Serial Port
For the single-chip microcomputer, communication is closely integrated with technologies such as sensors, storage chips, and peripheral control chips, becoming the "nerve center" of the entire single-chip microcomputer system. 1. Preliminary understanding   It is sent one bit at a time, and it takes 8 times to send
[Microcontroller]
51 MCU Introduction - UART Serial Port
Driving control of touch screen by C8051F020 microcontroller
The touch screen is currently the simplest, most convenient, natural input device suitable for China's multimedia information inquiry and national conditions. It has many advantages such as durability, fast response speed, space saving, and easy communication. Touch screen technology is considered to be one of the mai
[Microcontroller]
Driving control of touch screen by C8051F020 microcontroller
Design of two-way temperature controller based on 51 single chip microcomputer
  This paper proposes a design scheme of a two-way temperature controller based on a 51 single-chip microcomputer. The design scheme uses two DS18B20 temperature sensors to collect the temperature of two different places, and processes it through AT89C51. The measured temperature is displayed by a four-digit LED digit
[Microcontroller]
Design of two-way temperature controller based on 51 single chip microcomputer
Design of AT89C51 microcontroller digital logic non-circulating current reversible speed regulation system
1 Introduction There are many machinery in production that require both forward and reverse rotation, and often require quick starting and braking, which requires a reversible speed control system. The reversible speed regulation system implemented by analog circuits has complex circuits, difficult adjustment, low rel
[Microcontroller]
Design of AT89C51 microcontroller digital logic non-circulating current reversible speed regulation system
51 MCU - Simulate reversing radar alarm
1. Question requirements Based on the routine in Chapter 9, Lecture 3, we use the ultrasonic module to simulate the reversing radar alarm function. When the obstacle is less than or equal to 10cm away from the ultrasonic module, we use the buzzer to sound an alarm, and when it is greater than 10cm, no alarm will be
[Microcontroller]
51 MCU software SPI initialization ILI9488-DPI mode program
Hello everyone, the recent project uses the screen of ILI9488 chip, uses the IO port of 51 microcontroller to simulate SPI signal, sends initialization code to set it to DPI-18bitRGB mode. And uses LT768 chip to display pictures. The following is the program and ILI9488 data sharing: The display picture is 18bitR6G6B6
[Microcontroller]
51 MCU software SPI initialization ILI9488-DPI mode program
51 single chip microcomputer DC motor speed control source program
The microcontroller source program is as follows: #include  "reg52.h" sbit IN1=P1^1; sbit IN2=P1^2; sbit IN3=P1^3; sbit IN4=P1^4; unsigned char pwm_val_right=0; unsigned char push_val_right=0; unsigned int time=0; unsigned char pwm_val_left=0; unsigned char push_val_left=0; bit right_moto_stop=1; sbit right_moto_pwm=
[Microcontroller]
Design of Environmental Noise Measuring Instrument Based on 51 Single Chip Microcomputer
Environmental noise monitoring is an important part of improving the quality of life and strengthening environmental protection. In the busy streets and residential areas of major cities, large environmental noise displays have been erected on the streets. However, most of the portable noise testers in China are exp
[Microcontroller]
Design of Environmental Noise Measuring Instrument Based on 51 Single Chip Microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号