Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - MCU program delay time, crystal oscillator is 12Mhz
MCU program delay time, crystal oscillator is 12Mhz

The entry parameter of the function, when you call the delay function,... delayms (10);...

The purpose is to delay 10ms, which is the parameter of this uint The symbolic integer variable xms is assigned a value of 10.

After entering the delayms(); function, i=xms, that is, i=10, and then do a for loop,

According to the system clock The cycle is delayed by the corresponding time. If there is no xms,

your delay function can only be written as a fixed delay, that is, the value of i is determined inside delayms, which is very inconvenient.

With the entry parameters, you can delay at will as mentioned above

(The value range must be within the definition of uint, that is, less than 65536).