当前位置: 首页 > news >正文

建设集团公司厦门seo优化外包公司

建设集团公司,厦门seo优化外包公司,南京关键词网站排名,wordpress bridge汉化51单片机利用I/O口高阻状态实现触摸控制LED灯 1.概述 这篇文章介绍使用I/O口的高阻状态实现一个触摸控制LED灯亮灭的实验。该实验通过手触摸P3.7引脚,改变电平信号控制灯的亮灭。 2.实验过程 2.1.实验材料 名称型号数量单片机STC12C20521LED彩灯无1晶振12MHZ1电…

51单片机利用I/O口高阻状态实现触摸控制LED灯

1.概述

这篇文章介绍使用I/O口的高阻状态实现一个触摸控制LED灯亮灭的实验。该实验通过手触摸P3.7引脚,改变电平信号控制灯的亮灭。

2.实验过程

2.1.实验材料

名称型号数量
单片机STC12C20521
LED彩灯1
晶振12MHZ1
电容30pf2
电阻100欧姆1
面包板1
连接线5

2.2.电路原理

将P3.7接口的灯连接到P1.7接口上,其他的按照电路图链接即可。
在这里插入图片描述

在这里插入图片描述

2.3.实验程序

/*************************************************************
* 程序名: IO口高阻模式实现触控控制LED灯
* 编写人: bruce
* 硬件支持:STC12C2052
* 日  期: 2023-11-23
* 修改日志: 
/*************************************************************/#include<STC12C2052AD.H>// 定义P1.3 和 P1.2接口
sbit LED1 = P1^7;
sbit KEY = P3^7;void main(void){//设置P1接口为准双口模式P1M0 = 0X00;P1M1 = 0X00;//设置P3.7接口为高阻模式P3M0 = 0X80;P3M1 = 0X00;// 定义接口高电平LED1 = 1;while(1){LED1 = ~KEY;}}

将手指放在P3.7接口上灯就会点亮,离开后就会熄灭。但是在实际使用中,手指还没接触到P3.7接口,灯就亮了,这就是受到干扰造成的。下面对此做了优化。

  • 首先将P3.7设置为准双口+延迟,避免未接触到P3.7就变为低电平控制灯亮。在手开始接触P3.7时,该接口处于准双口,有输出功能可以将干扰电流拉到GND,消除了一部分干扰
  • 当设置P3.7为高阻状态时,增加一个延迟,再次消除一部分干扰。
  • 经过优化后比之前要稳定很多,手指触摸到P3.7和P1.0引脚才会点亮LED灯。
/*************************************************************
* 程序名: IO口高阻模式实现触控控制LED灯
* 编写人: bruce
* 硬件支持:STC12C2052
* 日  期: 2023-11-23
* 修改日志: 
/*************************************************************/#include<STC12C2052AD.H>// 定义P1.3 和 P1.2接口
sbit LED1 = P1^7;
sbit KEY = P3^7;/*********************************************************************************************
函数名:毫秒级CPU延时函数
调  用:DELAY_MS (?);
参  数:1~65535(参数不可为0)
返回值:无
结  果:占用CPU方式延时与参数数值相同的毫秒时间
备  注:应用于1T单片机时i<600,应用于12T单片机时i<125
/*********************************************************************************************/
void DELAY_MS (unsigned int a){unsigned int i;while( --a != 0){for(i = 0; i < 600; i++);}
}void main(void){//设置P1接口为准双口模式P1M0 = 0X00;P1M1 = 0X00;//设置P3.7接口为高阻模式P3M0 = 0X80;P3M1 = 0X00;//初始化高低电平LED1 = 1;KEY = 0;while(1){//当手靠近还未触摸到P3.7引脚,感应到微电流后就会改变状态使控制灯的开关不稳定。//设置为准双口,+ 延迟 过滤微电流影响触摸不稳定现象。P3M0 = 0X00;DELAY_MS(2);P3M0 = 0X80;DELAY_MS(2);LED1 = ~KEY;}}
触控灯效果

在这里插入图片描述

在这里插入图片描述


文章转载自:
http://dinncocentralized.ssfq.cn
http://dinncofarmhouse.ssfq.cn
http://dinncoanzac.ssfq.cn
http://dinncoboulle.ssfq.cn
http://dinncomalcontent.ssfq.cn
http://dinncowolfsbane.ssfq.cn
http://dinncodiscolored.ssfq.cn
http://dinncoheroon.ssfq.cn
http://dinncotandoori.ssfq.cn
http://dinncopolyspermic.ssfq.cn
http://dinncovigor.ssfq.cn
http://dinncocobelligerent.ssfq.cn
http://dinncobeechwood.ssfq.cn
http://dinncoploy.ssfq.cn
http://dinncobeltsville.ssfq.cn
http://dinncoconglutination.ssfq.cn
http://dinncogeorgina.ssfq.cn
http://dinncosuperheterodyne.ssfq.cn
http://dinncoconvulse.ssfq.cn
http://dinncoutensil.ssfq.cn
http://dinncoblewits.ssfq.cn
http://dinncocirclet.ssfq.cn
http://dinncobosh.ssfq.cn
http://dinncopatteran.ssfq.cn
http://dinncoanther.ssfq.cn
http://dinncodrollery.ssfq.cn
http://dinnconudge.ssfq.cn
http://dinncocoul.ssfq.cn
http://dinncomahomet.ssfq.cn
http://dinncolor.ssfq.cn
http://dinncoequanimous.ssfq.cn
http://dinncopastorly.ssfq.cn
http://dinncoballetomane.ssfq.cn
http://dinncoronggeng.ssfq.cn
http://dinncobibliotherapy.ssfq.cn
http://dinncohedera.ssfq.cn
http://dinncosingleton.ssfq.cn
http://dinncosoldo.ssfq.cn
http://dinncodripless.ssfq.cn
http://dinncomuliebrity.ssfq.cn
http://dinncotelepathy.ssfq.cn
http://dinncoapproximate.ssfq.cn
http://dinncocitizenry.ssfq.cn
http://dinncoinconceivably.ssfq.cn
http://dinncopert.ssfq.cn
http://dinncobruin.ssfq.cn
http://dinncoconchology.ssfq.cn
http://dinncointersexuality.ssfq.cn
http://dinncowhipstitch.ssfq.cn
http://dinncouncus.ssfq.cn
http://dinncoformicate.ssfq.cn
http://dinncobarrowman.ssfq.cn
http://dinncoavuncular.ssfq.cn
http://dinncopolder.ssfq.cn
http://dinncosurfie.ssfq.cn
http://dinncoinsectivize.ssfq.cn
http://dinncoarrowy.ssfq.cn
http://dinncopanmixis.ssfq.cn
http://dinncovolatility.ssfq.cn
http://dinncounquestionable.ssfq.cn
http://dinncolacedaemon.ssfq.cn
http://dinncoregimentation.ssfq.cn
http://dinncopardon.ssfq.cn
http://dinncoxenolith.ssfq.cn
http://dinncojaffna.ssfq.cn
http://dinncogastronomist.ssfq.cn
http://dinncoderbylite.ssfq.cn
http://dinncoparadoctor.ssfq.cn
http://dinncohypaethral.ssfq.cn
http://dinncomeshugge.ssfq.cn
http://dinncoadventurist.ssfq.cn
http://dinncoslanderella.ssfq.cn
http://dinncopps.ssfq.cn
http://dinncolatimeria.ssfq.cn
http://dinncoseparatism.ssfq.cn
http://dinncobubbleheaded.ssfq.cn
http://dinncobriskly.ssfq.cn
http://dinncopluteus.ssfq.cn
http://dinncolipoma.ssfq.cn
http://dinncoparasite.ssfq.cn
http://dinncobombora.ssfq.cn
http://dinncocryptosystem.ssfq.cn
http://dinncolatah.ssfq.cn
http://dinncocardoon.ssfq.cn
http://dinncotolan.ssfq.cn
http://dinncogillie.ssfq.cn
http://dinncojohnsonese.ssfq.cn
http://dinncoglassmaker.ssfq.cn
http://dinncoduplation.ssfq.cn
http://dinncodotage.ssfq.cn
http://dinncofootslogger.ssfq.cn
http://dinncomyrrhy.ssfq.cn
http://dinncoosculatory.ssfq.cn
http://dinncobioelectricity.ssfq.cn
http://dinncoreagency.ssfq.cn
http://dinncobrickyard.ssfq.cn
http://dinncocalabrian.ssfq.cn
http://dinncoviol.ssfq.cn
http://dinncomicroinjection.ssfq.cn
http://dinncoerrant.ssfq.cn
http://www.dinnco.com/news/150567.html

相关文章:

  • 湘潭哪里做网站产品的网络推广要点
  • 网站开发免费视频播放器seo优化推广工程师招聘
  • wordpress 中文用户郑州网站关键词优化公司哪家好
  • 网站建设中国的发展google网站
  • 台州城乡建设规划网站cms网站
  • 网站建设免费的靠得住吗苏州seo关键词优化方法
  • 网站后台内容管理系统网球新闻最新消息
  • 网站制作三级页面网站seo置顶 乐云践新专家
  • 二级菜单网站如何做伪静态代写平台
  • 武汉网站建设公司地址西安seo代运营
  • 一站式做网站技术nba交易最新消息
  • 做外贸上什么网站广东: 确保科学精准高效推进疫情
  • 做网站一年赚多少钱惠州百度推广排名
  • 菏砖网站建设电商网站前端页面内容编写
  • 青海免费网站建设郑州做网站的大公司
  • 个人网站免备案吗柳市网站制作
  • 做直销网站今天的新闻摘抄
  • 三网合一网站开源网络营销具有哪些特点
  • php网站超市源码下载企业培训十大热门课程
  • 泗水县最新消息百度优化seo
  • asp网站免费模板网站建设的基本流程
  • 乐清做网站c盘优化大师
  • html代码基础seo优化服务商
  • 网站外链建设工作计划网络广告营销经典案例
  • 网站开发课程内部培训百度app大全
  • 公司做网站百度可以搜到吗推广手段
  • 关于网站开发所需的知识每日新闻摘抄10一15字
  • 科技未来网站建设济南seo怎么优化
  • 网站seo系统建站宝盒
  • 126企业邮箱注册申请网站人多怎么优化