Delay module: The question mark represents the number to be filled in. Find the data in the table and fill it in. Be careful not to reverse the order of the three FOR statements.
void Delay()
{
unsigned char a,b,c;
for(a=0;a;a++)
for(b=0;b;b++)
for(c=0;c;c++);
}
50us 1 1 61 0 0 50us 1 1 1 -0.5
20us
1 1 8 0 30us 1
1 15
+0.5
40us 2 1 9 0
50us 1 1 28 0
60us 1 1 35 +0.5
70us 1 1 42 +1
80us 1 1 48 0
90us 1 1 55 +0.5
100us 1 1 61 -0.5
200us 1 1 128 0
300us 3 1 63 +1.5
400us 2 1 128 0
500us 5 1 64 +0.5
600us 6 1 65 0
700us 7 1 63 -0.5
800us 1 3 175 +0.5
900us 9 1 63 -1.5
1ms 1 3 219 -1.5
2ms 2 3 220 +3
3ms 3 3 220 +3
Xms X 3 220 +3
(the range of X is 2 to 255)
Basically, all the delays we usually use are here. The error of each delay is very small, and the maximum is no more than 3us. Some even have no error, which is already very precise. If you want to delay for 1 second, you can call the 250ms delay program 4 times in succession, with a total delay error of 12us. This error is no longer considered an error, and it cannot be achieved to this extent when written in assembly language.
Now you no longer have to worry about inaccurate delays. Just write the delay according to the data in the table and you can set the delay as much as you want.
Once again, I would like to reiterate: this table is written based on my delay module, which is also a module that most of my friends are accustomed to using. If you use other modules or modify my module, the delay will not be accurate. If you don’t believe it, you can try it!!!
Previous article:A method of generating accurate delay in embedded single chip microcomputer
Next article:How to use the nop function and delay calculation in the C language of the microcontroller
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- [RISC-V MCU CH32V103 Review] - 2: Making an LED flash is not easy
- SensorTile.box uses air pressure sensors to analyze environmental changes
- When using an oscilloscope probe to measure the AC waveform between the two ends of a component, how should the probe ground wire be connected?
- 【ST NUCLEO-H743ZI Review】(2)Ethernet Test
- TI.com Online Purchasing Special (Smart Building) has a limited time offer, with discounts as low as 30%!
- DLP Lightcrafter 4500 EVM FAQ Summary
- NRF24L01 module usage
- AD 20.2.4 x64
- Design and implementation of high-speed SRIO interface of TMS320C6455
- When the frequency of PWM square wave signal is low, voltage overshoot and ringing will occur?