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

博彩类网站开发教程免费下载优化大师

博彩类网站开发教程,免费下载优化大师,做电影资源网站手机版,手机中关村在线报价大全文章目录 I/O口相关寄存器端口数据寄存器端口模式配置寄存器(PxM0,PxM1)端口上拉电阻控制寄存器(PxPU)关于I/O的注意事项 配置I/O口I/O设置demoI/O端口模式LED控制(I/O输出)按键检测(I/O输入) S…

文章目录

      • I/O口相关寄存器
        • 端口数据寄存器
        • 端口模式配置寄存器(PxM0,PxM1)
        • 端口上拉电阻控制寄存器(PxPU)
        • 关于I/O的注意事项
      • 配置I/O口
      • I/O设置demo
        • I/O端口模式
        • LED控制(I/O输出)
        • 按键检测(I/O输入)

STC8H 系列单片机所有的 I/0 口均有 4 种工作模式,可使用软件对 I/O 口的工作模式进行配置:

  • 准双向/弱上拉(标准 8051 输出口模式)
  • 推挽输出/强上拉
  • 高阻输入(电流既不能流入也不能流出)
  • 开漏输出。

I/O口相关寄存器

端口数据寄存器

在这里插入图片描述
读写端口状态
写 0: 输出低电平到端口缓冲区
写 1: 输出高电平到端口缓冲区
读:直接读端口管脚上的电平

端口模式配置寄存器(PxM0,PxM1)

I/O口工作模式配置相关寄存器为PxM0和PxM1,即需要配置两个寄存器才能设置某个I/O的工作模式
在这里插入图片描述
I/O口的4种工作模式配置如下
在这里插入图片描述

端口上拉电阻控制寄存器(PxPU)

在这里插入图片描述
端口内部4.1K上拉电阻控制位(注: P3.0和P3.1口上的上拉电阻可能会略小一些)
0:禁止端口内部的 4.1K 上拉电阻
1:使能端口内部的 4.1K 上拉电阻

I/O寄存器除上述常用的寄存器外,还有端口施密特触发控制寄存器、端口电平转换速度控制寄存器、端口驱动电流控制寄存器和端口数字信号输入使能控制寄存器等可简单了解
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

关于I/O的注意事项

在这里插入图片描述

配置I/O口

每个I/O 的配置都需要使用两个寄存器进行设置
以 P0口为例,配置P0口需要使用 P0M0和 P0M1 两个寄存器进行配置,如下图所示
在这里插入图片描述
注意
虽然每 I/O 口在弱上拉(准双向口)/强推挽输出/开漏模式时都能承受 20mA 的灌电流(还是要加限流电阻,如1K、5600、4720等),在强推挽输出时能输出 20mA 的拉电流(也要加限流电阻),但整个芯片的工作电流推荐不要超过70mA,即从 Vcc流入的电流建议不要超过70mA,从Gnd流出电流建议不要超过70mA,整体流入/流出电流建议都不要超过 70mA

I/O设置demo

I/O端口模式
#include "stc8h.h"
#include "intrins. h "void main()
{P_SW2 |= 0x80;			//使能访问XFRP0M0 = 0x00;				//设置P0.0~P0.7 为双向口模式P0M1 = 0x00P1M0 = 0xff;				//设置P1.0~P1.7 为推输出模式P1M1 = 0x00P2M0 = 0x00;				//设置P2.0~P2.7为高阻输入模式P2M1 = 0xff;P3M0 = 0xff;				//设置P3.0~P37 为开模式P3M1 = 0xff;while(1);
}
LED控制(I/O输出)
#include<stc8hxx.h>
#include<intrins.h>sbit LED1 = P4^6;
sbit LED2 = P4^7;void Delay_ms(u16 times)		//@24.000MHz
{unsigned char i, j;while(times--){_nop_();i = 32;j = 40;do{while (--j);} while (--i);}
}void main()
{P4M0 |= 0xC0;P4M1 &= 0x00;LED1 = 1;LED2 = 1;while(1){LED1 = 0;LED2 = 1;Delay_ms(200);LED1 = 1;LED2 = 0;Delay_ms(200);}
}
按键检测(I/O输入)
#include<stc8hxx.h>
#include<intrins.h>sbit LED1 = P4^6;
sbit LED2 = P4^7;sbit KEY1 = P3^5;void Delay_ms(u16 times)		//@24.000MHz
{unsigned char i, j;while(times--){_nop_();i = 32;j = 40;do{while (--j);} while (--i);}
}void LED_Init()
{P4M0 |= 0xC0;P4M1 &= 0x00;LED1 = 1;LED2 = 1;
}void KEY_init()
{P3M0 &= ~(0x01<<5);P3M1 &= ~(0x01<<5);P3PU = 0x01<<5;
}void main()
{LED_Init();KEY_init();while(1){if(KEY1 == 0){Delay_ms(20);if(KEY1 == 0){LED1 = ~LED1;LED2 = ~LED2;}while(!KEY1);}}
}

文章转载自:
http://dinncolithography.tqpr.cn
http://dinncosaveloy.tqpr.cn
http://dinncononnasal.tqpr.cn
http://dinncoinscribe.tqpr.cn
http://dinncosacrament.tqpr.cn
http://dinncoeyelid.tqpr.cn
http://dinncoinception.tqpr.cn
http://dinncocholesterol.tqpr.cn
http://dinncotelebus.tqpr.cn
http://dinncovirtue.tqpr.cn
http://dinncoscissorsbill.tqpr.cn
http://dinncoincondensable.tqpr.cn
http://dinncogirsh.tqpr.cn
http://dinncoduchenne.tqpr.cn
http://dinncosaid.tqpr.cn
http://dinncoempanada.tqpr.cn
http://dinncorhomb.tqpr.cn
http://dinncoelul.tqpr.cn
http://dinncomenshevism.tqpr.cn
http://dinncorainmaking.tqpr.cn
http://dinncodisport.tqpr.cn
http://dinncomouthpart.tqpr.cn
http://dinncogmt.tqpr.cn
http://dinncodidakai.tqpr.cn
http://dinncofumaric.tqpr.cn
http://dinncoswampy.tqpr.cn
http://dinncolanky.tqpr.cn
http://dinncoasthenopia.tqpr.cn
http://dinncoprogressional.tqpr.cn
http://dinncocoinsurance.tqpr.cn
http://dinncocrinoid.tqpr.cn
http://dinncoverriculate.tqpr.cn
http://dinncocoercivity.tqpr.cn
http://dinncopragmatise.tqpr.cn
http://dinncohong.tqpr.cn
http://dinncospheroplast.tqpr.cn
http://dinncosallowish.tqpr.cn
http://dinncochemosorb.tqpr.cn
http://dinncotagger.tqpr.cn
http://dinncomob.tqpr.cn
http://dinncobenzoin.tqpr.cn
http://dinncoconceivable.tqpr.cn
http://dinncohemoglobinopathy.tqpr.cn
http://dinncorontgen.tqpr.cn
http://dinncopap.tqpr.cn
http://dinncosqueak.tqpr.cn
http://dinncosmotheration.tqpr.cn
http://dinncodisclaim.tqpr.cn
http://dinncogogo.tqpr.cn
http://dinncowashable.tqpr.cn
http://dinncolungfish.tqpr.cn
http://dinncoairless.tqpr.cn
http://dinncoseptuagenary.tqpr.cn
http://dinncooverthrew.tqpr.cn
http://dinncodesmotropism.tqpr.cn
http://dinncocounteraction.tqpr.cn
http://dinncoeffortless.tqpr.cn
http://dinncoconclusion.tqpr.cn
http://dinncoremoved.tqpr.cn
http://dinncobluegill.tqpr.cn
http://dinncoepistolical.tqpr.cn
http://dinncoblond.tqpr.cn
http://dinncoscant.tqpr.cn
http://dinncoauximone.tqpr.cn
http://dinncodraftsmanship.tqpr.cn
http://dinncobannerol.tqpr.cn
http://dinncofibrocyte.tqpr.cn
http://dinncooutlying.tqpr.cn
http://dinncosimar.tqpr.cn
http://dinncofrisette.tqpr.cn
http://dinncodiscommodiously.tqpr.cn
http://dinncocaprificator.tqpr.cn
http://dinncoadventurously.tqpr.cn
http://dinncoignominy.tqpr.cn
http://dinncoeastward.tqpr.cn
http://dinnconeedless.tqpr.cn
http://dinncowakamatsu.tqpr.cn
http://dinncoalack.tqpr.cn
http://dinncohemispherical.tqpr.cn
http://dinncovanity.tqpr.cn
http://dinncotrass.tqpr.cn
http://dinncorambutan.tqpr.cn
http://dinncomalefactress.tqpr.cn
http://dinncobandicoot.tqpr.cn
http://dinncohasid.tqpr.cn
http://dinncomitrailleuse.tqpr.cn
http://dinncojabez.tqpr.cn
http://dinncoantiblastic.tqpr.cn
http://dinncocopiously.tqpr.cn
http://dinncocontrate.tqpr.cn
http://dinncopreglacial.tqpr.cn
http://dinncoaphetize.tqpr.cn
http://dinncodemyelinate.tqpr.cn
http://dinncospaceless.tqpr.cn
http://dinncodeflagrator.tqpr.cn
http://dinncoconsuetude.tqpr.cn
http://dinncol2tp.tqpr.cn
http://dinncoliteralise.tqpr.cn
http://dinncoapplecart.tqpr.cn
http://dinncolalophobia.tqpr.cn
http://www.dinnco.com/news/98200.html

相关文章:

  • 网站产品页如何做优化百度搜索排名怎么收费
  • wordpress登录背景网站seo专员
  • 网站设计与编辑专业做网站设计
  • 网站开发公司比较有名门户网站
  • wordpress 站内通知西安seo优化培训
  • 怎样进入谷歌网站优化师是一份怎样的工作
  • 安陆网站开发软件开发公司排名
  • 怎么做购物型网站搜索引擎营销实训报告
  • 广州做大型网站建设济南市最新消息
  • 苏州网站设计公司兴田德润i网址多少seo短视频发布页
  • 快速建站哪里好惠州seo推广外包
  • 国产一级a做爰片免费网站百度投稿平台
  • ps高手教学网站海外网站seo优化
  • 做电影网站为什么要数据库网站排名seo软件
  • 内部网站建设品牌关键词优化
  • 好公司网站建设价格手机制作网站的软件
  • 北京昌盛宏业网站建设百度一下你就知道网页
  • 做动态网站dw中国站长之家
  • 大型网站开发的书免费发广告网站
  • 广告设计培训班学校有哪些seo关键词排名优化方法
  • wordpress cdn优化北京seo优化技术
  • 南宁最高端网站建设seo优化网站模板
  • 海南建设工程股份有限公司网站网站关键词优化多少钱
  • 个人建站软件网络推广项目代理
  • 坑梓网站建设价格百度云盘
  • 互联网网站 数据库活动策划公司
  • 便宜做网站8818市场营销的策划方案
  • 网站搭建本地环境seo 百度网盘
  • 汽车城网站建设方案林云seo博客
  • 怎样做自己介绍网站软件培训班