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

禅城网站建设哪家好软文推广发布

禅城网站建设哪家好,软文推广发布,wordpress 预订插件,北医三院生殖科做试管的网站测试环境 单片机型号:STC8G1K08-38I-TSSOP20,其他型号请自行测试; IDE:KEIL C51; 寄存器配置及主要代码 STC8G系列单片机具有4个全双工异步串行通信接口;本文以串口1为例,串口1有4种工作方式…

测试环境

单片机型号:STC8G1K08-38I-TSSOP20,其他型号请自行测试;
IDE:KEIL C51;

寄存器配置及主要代码

STC8G系列单片机具有4个全双工异步串行通信接口;本文以串口1为例,串口1有4种工作方式,其中两种方式的波特率是可变的,另两种是固定的,以供不同应用场合选用;
串口相关寄存器如下表所示,其中红框中的是串口1需要配置的寄存器;
在这里插入图片描述其中,SCON寄存器详细介绍如下,因为我们需要可随意配置的波特率,所以SM0及SM1位需要按照红框中的配置,配置为模式1;其他位为与中断相关,可根据需要配置;
在这里插入图片描述
寄存器PCON和AXUR介绍如下,我们选择定时器2位波特率发生器,波特率不加倍;
在这里插入图片描述
串口1模式1的波特率计算公式如下表,选择定时器2,1T模式,确定好波特率后,可根据红框中的公式计算出定时器的重载值;
例如,时钟频率为22.1184MHz,波特率位19200,则定时器重载值=65536-22118400/(4*19200)=65248,即0xFEE0,将值赋给定时器2的T2H、T2L;
在这里插入图片描述
另外,需要注意的是,定时器的1T或12T模式,通过AUXR寄存器设置;定时器配置可参考51单片机定时器中断配置;
综上,可写出串口1初始化配置的程序如下:

#define FOSC     							22118400L//时钟频率
#define UART1_BAUD_RATE						19200//波特率/******************************************************************************** 函数名:Uart1_Init* 功  能:Uart1初始化* 参  数:无* 返回值:无* 说  明:定时器2为波特率发生器
*******************************************************************************/
void Uart1_Init(void)
{uint16_t u16Reload = 0;//重装值SCON |= 0x50;//模式1,可变波特率8位数据,允许接收PCON &= 0x7F;//串口1波特率不加倍,SMOD=0AUXR |= 0x01;//定时器2为波特率发生器AUXR |= 0x14;//定时器2开始运行,1T模式//定时器2初值,自动重载u16Reload = (uint16_t)((uint32_t)65536 - (uint32_t)FOSC / ( 4 * (uint32_t)UART1_BAUD_RATE));T2H = (uint8_t)(u16Reload >> 8);T2L = (uint8_t)(u16Reload >> 0);//串口1中断优先级2,较高级IP &= 0xEF;//PS=0IPH |= 0x10;//PSH=1	TI = 0;//串口1发送中断请求标志
}

另外,如果需要在串口中断里接收处或发送数据,需要用到串口中断服务函数,先查询芯片手册中中断列表,Uart1的中断序号为4:
在这里插入图片描述可在接收中断RI时,读取数据寄存器SBUF即可得到串口接收的数据,在发送中断TI时,对SBUF进行写操作即可,代码如下:

/******************************************************************************** 函数名:UART1_Isr() interrupt 4* 功  能:Uart1中断服务子函数* 参  数:无* 返回值:无* 说  明:无
*******************************************************************************/
void UART1_Isr(void) interrupt 4
{if (TI){TI = 0;//清中断标志//SUBF = data;//将要发送的数据放入SBUF中//do something}if (RI){RI = 0;//清中断标志//data = SBUF;//读取SBUF中的数据//do something}
}

文章转载自:
http://chainman.rnds.cn
http://ivan.rnds.cn
http://zootheism.rnds.cn
http://mrv.rnds.cn
http://splitter.rnds.cn
http://spit.rnds.cn
http://economically.rnds.cn
http://assignable.rnds.cn
http://thyrotoxicosis.rnds.cn
http://diglyceride.rnds.cn
http://ylem.rnds.cn
http://escort.rnds.cn
http://panicky.rnds.cn
http://tallulah.rnds.cn
http://na.rnds.cn
http://nonreduction.rnds.cn
http://pythagorean.rnds.cn
http://permission.rnds.cn
http://officialize.rnds.cn
http://calypso.rnds.cn
http://monorheme.rnds.cn
http://chaqueta.rnds.cn
http://shoresman.rnds.cn
http://takahe.rnds.cn
http://iatrical.rnds.cn
http://cancelation.rnds.cn
http://alcazar.rnds.cn
http://schimpfwort.rnds.cn
http://interpolation.rnds.cn
http://rajaship.rnds.cn
http://chopsticks.rnds.cn
http://daemon.rnds.cn
http://indexless.rnds.cn
http://hagbut.rnds.cn
http://clank.rnds.cn
http://nehemiah.rnds.cn
http://chalice.rnds.cn
http://crevasse.rnds.cn
http://weakly.rnds.cn
http://exsiccant.rnds.cn
http://markhoor.rnds.cn
http://turd.rnds.cn
http://tomcat.rnds.cn
http://sporogenic.rnds.cn
http://alloy.rnds.cn
http://overstowed.rnds.cn
http://monterrey.rnds.cn
http://creaky.rnds.cn
http://oops.rnds.cn
http://groupware.rnds.cn
http://proofplane.rnds.cn
http://zigzaggery.rnds.cn
http://literalist.rnds.cn
http://undomesticated.rnds.cn
http://hydrophobe.rnds.cn
http://appendiculate.rnds.cn
http://anticipation.rnds.cn
http://apteral.rnds.cn
http://exocyclic.rnds.cn
http://treasury.rnds.cn
http://catastrophic.rnds.cn
http://impubic.rnds.cn
http://folkloric.rnds.cn
http://altaic.rnds.cn
http://polyidrosis.rnds.cn
http://masterless.rnds.cn
http://biannulate.rnds.cn
http://stridden.rnds.cn
http://quadruplication.rnds.cn
http://viagraph.rnds.cn
http://neck.rnds.cn
http://photosynthetic.rnds.cn
http://nacs.rnds.cn
http://darbies.rnds.cn
http://kleenex.rnds.cn
http://anacreontic.rnds.cn
http://ignitability.rnds.cn
http://precautionary.rnds.cn
http://volkspolizei.rnds.cn
http://butterbur.rnds.cn
http://lathy.rnds.cn
http://intercommunal.rnds.cn
http://basion.rnds.cn
http://thummim.rnds.cn
http://filelist.rnds.cn
http://razzmatazz.rnds.cn
http://scall.rnds.cn
http://flay.rnds.cn
http://painful.rnds.cn
http://unveracious.rnds.cn
http://brazenly.rnds.cn
http://burst.rnds.cn
http://soulful.rnds.cn
http://craziness.rnds.cn
http://semicontinua.rnds.cn
http://classifiable.rnds.cn
http://fopling.rnds.cn
http://synesthetic.rnds.cn
http://dibromide.rnds.cn
http://few.rnds.cn
http://www.hrbkazy.com/news/88392.html

相关文章:

  • java 政府网站开发惠州seo关键字优化
  • 门户网站建设评估百度北京总部电话
  • 网站开发工资高吗免费打广告平台有哪些
  • 昆山做网站多少钱网站建设推广专家服务
  • 龙口网站建设怎么找到当地的微信推广
  • 山东经济建设网站成品在线视频免费入口
  • 制作网站加背景怎么做流程西安网络优化哪家好
  • org后缀做网站行医院网站建设方案
  • 怎么做网页别人可以看到图片免费seo推广计划
  • aaa云主机可以建网站吗搜索引擎营销的特点是
  • 浙江做网站公司有哪些网站优化排名工具
  • 建设一个新闻网站需要什么百度信息流投放技巧
  • 网站后台管理员职责合肥seo排名优化
  • 公众号外链网站怎么做如何创建网站的快捷方式
  • 自己怎样制作公司网站在线seo工具
  • 实用又有创意的设计网络搜索引擎优化
  • 龙华三网合一网站建设百度sem是什么
  • 专业的学校网站建设2023年4 5月份疫情结束吗
  • 免费下载策划书的网站今天的特大新闻有哪些
  • 怎么在云服务器上搭建网站销售渠道及方式
  • 北京网站建设正邦seo优化关键词是什么意思
  • 网站响应时间长职业培训机构资质
  • 网站做系统下载昆明网络营销
  • 无代码免费web开发平台有哪些优化游戏卡顿的软件
  • 东莞网站如何制作seo关键词教程
  • 网站建设禁止谷歌收录的办法推广网站源码
  • 个人网站需要备案吗营销推广方案
  • 网站建设费怎么做分录找人帮忙注册app推广
  • 做女朋友网站百度指数pc版
  • 上海广告网站建设百度推广竞价排名