您当前的位置: 首页 >  单片机

跋扈洋

暂无认证

  • 4浏览

    0关注

    221博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

延时函数、数码管显示头文件(单片机)

跋扈洋 发布时间:2019-10-30 20:56:10 ,浏览量:4

延时函数、数码管显示头文件(单片机)

在单片机程序的编写过程中,我们常常要写一段相同的代码,此时我们可以给它做成头文件封装起来,在使用的时候直接调用,在此文章中以常用的延时函数和数码管显示函数为例

数码管显示
typedef unsigned char shumaguan_dehaha;
sbit nageshumaguan_1=P2^2;
sbit nageshumaguan_2=P2^3;
sbit nageshumaguan_3=P2^4;
shumaguan_dehaha code shumaguan[18]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
     0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x38,0x80};
延时函数
#include
typedef unsigned int delaytime;
 delaytime     delaytime_1;
 void delay  (delaytime delaytime_1 )
{
 delaytime x,y;
 for(x=delaytime_1; x>0; x--)
 for(y=110; y>0; y--)
  {
   ;//???1ms
  }
}
关注
打赏
1663745539
查看更多评论
立即登录/注册

微信扫码登录

0.1167s