2.
3. The page is not set properly for program jumps, table lookups, etc.
4. Different uses of GOTO and CALL instructions In the PIC assembly program, the CALL and GOT0 instructions are used in different places. CALL is used to call a subroutine, and after calling the subroutine, it returns to the program before the call; while GOTO is an unconditional transfer, that is, it enters another state from this state without returning. In order to make the program more readable and the process clearer and more reasonable, the program usually adopts modular programming, that is, the program is divided into different subroutines according to function, and the main program is quite simple, and only the CALL instruction is used to call the subroutine. Since the stack of the PIC microcontroller is limited, the GOTO instruction cannot be used endlessly in the program, otherwise it will cause the stack to overflow and the program cannot run normally. But sometimes, such as when the program branches, the GOTO instruction has to be used. For the PICl6F7x series of microcontrollers, when a program branches, it can only be judged by the Z bit or C bit of the STATUS register. At this time, in the first of the two situations, the GOTO instruction must be used to transfer; otherwise, after executing the first situation, the second situation will be executed immediately. The program is as follows: BTFSS STATUS, Z GOTO A GOTO B When jumping to A, the GOTO instruction must be used; otherwise, after executing this statement, GOTO B will be executed immediately. In this way, no matter what the value of Z is, the program will jump to B. For GOT0 B, the GOTO instruction does not need to be used. In the above case, since GOTO only jumps within the subroutine, the internal loop of the small program occupies a small number of stack levels, so it is feasible to use the GOTO instruction. However, when using the GOTO instruction in a large program, it may not be possible to return to the next instruction before the call. Therefore, the author recommends that when using assembly language for programming, the program should be
Previous article:Network port literacy 2: Simple analysis of the composition principle of Mac and Phy
Next article:In-depth analysis of local variables and global variables in MCU compiler
- Popular Resources
- Popular amplifiers
- Introduces the CAN interrupt structure function of C167CR and the application of the standard CAN interrupt structure
- Multithreading in LabVIEW
- Infrared remote control receiving and sending source program Interrupt for IR subroutine external interrupt source INT0
- Watchdog software code, development environment KEIL, including the main program and \"Weigou\" subrou
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Does anyone know what circuit this is and what function it has?
- Two new TI boards
- How to observe the PWM output of DSPF2812 through graph in CCS?
- Improve the clarity of the R329 development board camera
- Analysis of the three most commonly used communication protocols in single-chip microcomputer systems
- MSP-EXP430F5529LP Development Board 001-GPIO
- Chip type and model
- Several modes of Bluetooth devices
- Acknowledgements | EEWorld’s 15th anniversary, thank you!
- How to set subdivision of stepper motor driver