void delay(unsigned char n) //about n(ms) delay
{ unsigned char i,j,k;
for(k=0;k
for(j=0;j<5;j++) //about 1ms delay
{
for(i=0;i<31;i++) //about 0.1ms delay
{;}
}
}
}
main()
{ while(1)
{
delay(15);
}
}
/*About 15ms delay, need more accurate delay:
1. Fill in c51 frequency in keil uvision3\project\options for target\target\xtal.
2. Set 2 breakpoints before and after the delay statement.
3. Enter debug, record the time to run to 2 breakpoints in the sec item of the project workspace window, and get the delay time.
4. Adjust the delay() parameter as needed.
*/
Previous article:c51 1ms-11.0592MHZ delay program
Next article:C51 INT0 mode 1 key multi-function program
- 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
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- CCS Installation and Use Tutorial
- 【EVK-NINA-B400 Evaluation Kit】+Building Environment and Small Test
- Omron E6A2
- ADI Think Tank Secrets New Release丨High Speed Circuit Design Guide is now available for download
- 【LAUNCHXL-CC1350-4】- 1: Install CCS on Ubuntu 20.04
- Review summary: RTT & Renesas high-performance CPK-RA6M4 development board
- Two methods of chip unpacking
- MSP430FR25x2 Capacitive Touch Sensing Mixed-Signal Microcontrollers
- Analog circuit basics: from system level to circuit level
- HyperLynx High-Speed Circuit Design and Simulation (II) Reflection due to unequal transmission line impedance and power supply impedance