[DELY]: General delay subroutine
[Address]: 7FEBH - FFEBH
[Function]: Delay
[Entry]: The delay constant is placed in the R2 register. The delay time corresponding to the time constant N (hexadecimal) (6MZH crystal oscillator) is shown in the following table:
[Export]: R2=0
[Register occupied]: R2
[Call]: None
Example: Delay 1 second subroutine
MOV R2,#18H
LCALL 7FEBH
RET
ORG 7FEBH ; General delay subroutine (07EBH & 0FEBH & ...)
L7FEB: PUSH 02H ; R2 (R2 is 02H after reset) stores the time constant, pushes the stack to protect
L7FED: PUSH 02H ; R2 pushes the stack to protect
L7FEF: PUSH 02H ; Pushes the stack
L7FF1: DJNZ R2,$ ; R2 is not zero, wait for
POP 02H ; Pop the stack
DJNZ R2,L7FEF ; R2 is not zero, transfer to
POP 02H ; Pop the stack
DJNZ R2,L7FED ; R2 is not zero, go
to POP 02H ; Pop the stack
DJNZ R2,L7FEB ; R2 is not zero, go to
RET ; Subroutine return
END
N (hexadecimal number) T (machine weeks) T (seconds) Subroutine address
1 11 0.000044
C 2728 0.010912
18 26323 0.105292 2800
1D 50838 0.203352 2808
21 80323 0.321292 2810
24 109666 0.438664 2818
26 133248 0.532992 2820
28 160431 0.641724 2828
29 175481 0.701024 2830
2E 267146 1.068584 2838
37 516836 2.067344 2840
3D 760366 3.041464 2848
42 1021681 4.086724 2850
4 6 1275016 5.100064 2858
54 2543878 10.175512 2860
65 5144436 20.577744 2868
70 7654053 30.616212 2870
78 9986491 39.945964 2878
7F 12432158 49.728632 2880
98 24956083 99.824332 2888
A9 37708623 150.83453
B6 50353668 201.41467 2890
CA 75697683 302.79 073 2898
D9 100218410 400.87365 28A0
E6 125909940 503.63974 28A8
F1 151248830 605.03532 28B0
FF 188839490 755.35794
0 191768000 767.072 28B8
Reference address:51 MCU general assembly delay subroutine
[Address]: 7FEBH - FFEBH
[Function]: Delay
[Entry]: The delay constant is placed in the R2 register. The delay time corresponding to the time constant N (hexadecimal) (6MZH crystal oscillator) is shown in the following table:
[Export]: R2=0
[Register occupied]: R2
[Call]: None
Example: Delay 1 second subroutine
MOV R2,#18H
LCALL 7FEBH
RET
ORG 7FEBH ; General delay subroutine (07EBH & 0FEBH & ...)
L7FEB: PUSH 02H ; R2 (R2 is 02H after reset) stores the time constant, pushes the stack to protect
L7FED: PUSH 02H ; R2 pushes the stack to protect
L7FEF: PUSH 02H ; Pushes the stack
L7FF1: DJNZ R2,$ ; R2 is not zero, wait for
POP 02H ; Pop the stack
DJNZ R2,L7FEF ; R2 is not zero, transfer to
POP 02H ; Pop the stack
DJNZ R2,L7FED ; R2 is not zero, go
to POP 02H ; Pop the stack
DJNZ R2,L7FEB ; R2 is not zero, go to
RET ; Subroutine return
END
N (hexadecimal number) T (machine weeks) T (seconds) Subroutine address
1 11 0.000044
C 2728 0.010912
18 26323 0.105292 2800
1D 50838 0.203352 2808
21 80323 0.321292 2810
24 109666 0.438664 2818
26 133248 0.532992 2820
28 160431 0.641724 2828
29 175481 0.701024 2830
2E 267146 1.068584 2838
37 516836 2.067344 2840
3D 760366 3.041464 2848
42 1021681 4.086724 2850
4 6 1275016 5.100064 2858
54 2543878 10.175512 2860
65 5144436 20.577744 2868
70 7654053 30.616212 2870
78 9986491 39.945964 2878
7F 12432158 49.728632 2880
98 24956083 99.824332 2888
A9 37708623 150.83453
B6 50353668 201.41467 2890
CA 75697683 302.79 073 2898
D9 100218410 400.87365 28A0
E6 125909940 503.63974 28A8
F1 151248830 605.03532 28B0
FF 188839490 755.35794
0 191768000 767.072 28B8
Previous article:Implementation of Simple Ping of 51 MCU
Next article:How to implement FSK caller ID decoding with a single chip microcomputer
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
Guess you like
- Performance Differences Between DC-DC Switching Power Supplies and DC-DC Integrated Modules
- Start broadcasting at 10:00 this morning | Supporting the "dual carbon" goal - ADI smart factory solution
- Power Issues
- BlueNRG2 sends 247 bytes at a time
- Urgently hiring a motor drive control engineer assistant
- 【Perf-V Review】Three-color LED
- CC3200-LAUNCHXL Development Board Evaluation Report
- STM32MP157A-DK1 Evaluation (6) Programming Environment under Cortex-A7 Linux
- MSP430 Learning Clock
- 【Silicon Labs Development Kit Review】+Development Environment Construction