51 MCU general assembly delay subroutine

Publisher:asdfrewqppLatest update time:2012-10-12 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
[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

Previous article:Implementation of Simple Ping of 51 MCU
Next article:How to implement FSK caller ID decoding with a 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号