c51 1ms-6MHZ delay program

Publisher:恬淡如云Latest update time:2016-10-14 Source: eefocusKeywords:c51  1ms-6MHZ Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
#include

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.
   
 */

Keywords:c51  1ms-6MHZ Reference address:c51 1ms-6MHZ delay program

Previous article:c51 1ms-11.0592MHZ delay program
Next article:C51 INT0 mode 1 key multi-function program

Latest Microcontroller Articles
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号