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

ecshop的301重定向优化插件解决伪静态后重复页面提高网站权重迅雷bt磁力链 最好用的搜索引擎

ecshop的301重定向优化插件解决伪静态后重复页面提高网站权重,迅雷bt磁力链 最好用的搜索引擎,网站建设 开票,公司网站经常打不开1 串口物理层 两个设备的“DB9接口”之间通过串口信号建立连接,串口信号线中使用“RS232标准”传输数据信号。由于RS232电平标准的信号不能直接被控制器直接识别,所以这些信号会经过“电平转换芯片”转换成控制器能识别的“TTL校准”的电平信号&#xff…

1 串口物理层

两个设备的“DB9接口”之间通过串口信号建立连接,串口信号线中使用“RS232标准”传输数据信号。由于RS232电平标准的信号不能直接被控制器直接识别,所以这些信号会经过“电平转换芯片”转换成控制器能识别的“TTL校准”的电平信号,才能实现通讯。 

通讯标准电平标准
5V TTL逻辑1:2.4v~5v;逻辑0:0v~0.5v
RS 232逻辑1:-15v~-3v;逻辑0:+3v~+15v

 2 串口协议层

串口通讯的数据包由发送设备通过自身的TXD接口传输到接收设备的RXD接口。在串口通讯的协议层中,规定了数据包的内容,他由起始位、主体数据、校验位以及停止位组成,通讯双方的数据包格式要约定一致才能正常收发数据。

 3 波特率

串口异步通讯中由于没有时钟信号,所以两个设备之间需要约定好波特率,以便对信号进行解码。

4 STM32 的USART

  • STM32 芯片具有多个USART外设用于串口通讯,即通用同步异步收发器可以灵活地与外部设备进行全双工数据交换。它还具有UART外设,是在USART基础上剪裁掉了同步通信功能,只有异步通信,简单区分就是看通信时需不需要对外提供时钟输出,平常用的串口通信基本都是UART。

5 USART 功能框图

 TX:发送数据输出数据引脚

RX:接收数据输入引脚

SW_RX:数据接收引脚,只能用于单线和智能卡模式,属于内部引脚,没有具体外部引脚

nRTS:请求以发送,n表示低电平有效。如果使能RTS流控制,当USART接收器准备好接收新数据时就会将nRTS变成低电平;当接收寄存器已满时,nRTS将被设置为高电平,该引脚只适用于硬件流控制。

nCTS:清除以发送,n表示低电平有效。如果使能CTS流控制,发送器在发送下一帧数据之前会检测nCTS引脚,如果为低电平,表示可以发送数据;如果为高电平则在发送完当前数据帧之后停止发送,该引脚只适用于硬件流控制。

SCLK:发送器时钟输出引脚,这个引脚仅适用于同步模式。

UART只是异步传输功能,所以没有SCLK、nCTS和nRTS功能引脚。

  • 数据寄存器

        USART_DR包含了已发送的数据或者接收到的数据。USART_DR实际是包含了两个寄存器,一个是专门用于发送的可写TDR,一个是专门用于接收的可读RDR。当进行发送操作时,往USART_DR写入数据会自动存储在TDR内;当进行读操作时,向USART_DR读取数据会自动提起RDR数据。

        TDR和RDR都是介于系统总线和移位寄存器之间。串行通信是一个位一个位传输的,发送时把TDR内容转移到发送移位寄存器,然后把移位寄存器数据每一位发送出去,接收时把接收到的每一位顺序保存在接收移位寄存器内然后才转移大RDR。

  • 控制器

        USART有专门控制发送的发送器、控制接收的接收器,还有唤醒单元、中断控制等。使用USART之前需要向USART_CR1寄存器的UE位置1使能USART。发送或者接收数据字长可选8位或者9位,由USART_CR1的M位控制。

#include "stm32f4xx.h"
#include "stdio.h"
#include "USART.h"#define DEBUG_USART              USART1
#define DEBUG_USART_CLK          RCC_APB2Periph_USART1
#define DEBUG_USART_BAUDRATE     115200
#define DEBUG_USART_RX_PORT      GPIOA
#define DEBUG_GPIO_RX_CLK        RCC_AHB1Periph_GPIOA
#define DEBUG_USART_RX_PIN       GPIO_Pin_10
#define DEBUG_USART_RX_AF        GPIO_AF_USART1
#define DEBUG_USART_TX_PORT      GPIOA
#define DEBUG_GPIO_TX_CLK        RCC_AHB1Periph_GPIOA
#define DEBUG_USART_TX_PIN       GPIO_Pin_9
#define DEBUG_USART_TX_AF        GPIO_AF_USART1
#define DEBUG_USART_BAUDRATE           115200//使能RX和TX引脚GPIO时钟和USART时钟//初始化GPIO,并将GPIO复用到USART上//配置USART参数//配置中断控制器并使能USART接收中断//使能USART;//在USART接收中断服务函数实现数据接收和发送//配置嵌套向量中断控制器NVIC	
static void NVIC_Configuration(void)
{NVIC_InitTypeDef NVIC_InitStructure;NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;NVIC_Init(&NVIC_InitStructure);}void USART_Config(void)
{GPIO_InitTypeDef   GPIO_InitStructure;USART_InitTypeDef  USART_InitStructure;//开启USART时钟RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);//开启GPIOA时钟RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);//将USART Tx的GPIO配置为推挽复用GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;GPIO_InitStructure.GPIO_Pin = DEBUG_USART_TX_PIN;GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;GPIO_InitStructure.GPIO_Speed = GPIO_High_Speed;GPIO_Init(DEBUG_USART_TX_PORT,&GPIO_InitStructure);//将USART Rx的GPIO配置为浮空输入GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;GPIO_InitStructure.GPIO_Pin = DEBUG_USART_RX_PIN;GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;GPIO_InitStructure.GPIO_Speed = GPIO_High_Speed;GPIO_Init(DEBUG_USART_RX_PORT,&GPIO_InitStructure);//串口初始化配置USART_InitStructure.USART_BaudRate = DEBUG_USART_BAUDRATE;USART_InitStructure.USART_WordLength = USART_WordLength_8b;USART_InitStructure.USART_StopBits = USART_StopBits_1;USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;USART_InitStructure.USART_Parity = USART_Parity_No ;USART_Init(DEBUG_USART,&USART_InitStructure);//串口中断优先级配置NVIC_Configuration();//使能串口接收中断USART_ITConfig(DEBUG_USART,USART_IT_RXNE,ENABLE);//使能串口USART_Cmd(DEBUG_USART, ENABLE);}//发送一个字节
void Usart_SendByte(USART_TypeDef* USARTx, uint8_t ch)
{USART_SendData(DEBUG_USART, ch);while(USART_GetFlagStatus(DEBUG_USART,USART_FLAG_TC) == RESET);}//发送8位的数组
void Usart_SendArray(USART_TypeDef * pUSARTx,uint8_t *array,uint16_t num)
{uint8_t i;for(i=0;i<num;i++){Usart_SendByte(DEBUG_USART,array[i]);}while(USART_GetFlagStatus(DEBUG_USART,USART_FLAG_TXE) == RESET);
}//发送一个16位数
void Usart_SendHalfWord(USART_TypeDef * pUSARTx,uint16_t ch)
{uint8_t temp_h,temp_l;//取出高八位temp_h = (ch & 0XFF00)>>8;//取出低八位temp_l = ch & 0X00FF;//发送高八位USART_SendData(DEBUG_USART,temp_h);while(USART_GetFlagStatus(DEBUG_USART,USART_FLAG_TXE) == RESET );//发送低八位USART_SendData(DEBUG_USART,temp_l);while(USART_GetFlagStatus(DEBUG_USART,USART_FLAG_TXE) == RESET );}//重定向C库函数printf到串口,重定向后可使用printf函数
int fputc(int ch,FILE *f)
{USART_SendData(DEBUG_USART,(uint8_t)ch);while(USART_GetFlagStatus(DEBUG_USART,USART_FLAG_TXE) == RESET);return (ch);
}//重定向C库函数scanf到串口,重写后可使用是scanf、getchar等函数
int fgetc(FILE *f)
{while(USART_GetFlagStatus(DEBUG_USART,USART_FLAG_RXNE) == RESET);return (int)USART_ReceiveData(DEBUG_USART);
}//发送字符串
void Usart_SendString(USART_TypeDef * pUSARTx, char *str)
{unsigned int k = 0;do{Usart_SendByte(pUSARTx,*(str+k));k++;		}while(*(str+k)!='\0');while(USART_GetFlagStatus(pUSARTx,USART_FLAG_TC)==RESET);}//当USART有接收到数据就会执行USART_IRQ_Handler函数,USART_GetITStatus和USART_GetFlagStatus函数类似用来获取标志位状态,
//但USART_GetITStatus函数是专门用来获取中断事件标志,并返回该标志位状态。
//使用if语句来判断是否是真的产生USART数据接收这个中断事件,
//如果是真的就使用USART数据读取函数USART_RecevieData读取数据到指定存储区,然后再调用USART数据发送噶部署USART_SendData把数据又发送给源设备 
void USART1_IRQHandler(void)
{uint8_t ucTemp;if(USART_GetITStatus(DEBUG_USART,USART_IT_RXNE) != RESET){ucTemp = USART_ReceiveData(DEBUG_USART);USART_SendData(DEBUG_USART,ucTemp);}}	


文章转载自:
http://dinncoegocentric.tpps.cn
http://dinncoloxodrome.tpps.cn
http://dinncosundeck.tpps.cn
http://dinncoawn.tpps.cn
http://dinncosqueamish.tpps.cn
http://dinncoerythroblastotic.tpps.cn
http://dinncoshoebill.tpps.cn
http://dinncoletter.tpps.cn
http://dinncofeasance.tpps.cn
http://dinncogrimace.tpps.cn
http://dinncomemorial.tpps.cn
http://dinncooleo.tpps.cn
http://dinncomask.tpps.cn
http://dinncohobart.tpps.cn
http://dinncorancidness.tpps.cn
http://dinncoport.tpps.cn
http://dinncoshutter.tpps.cn
http://dinncoasahikawa.tpps.cn
http://dinncosatellize.tpps.cn
http://dinncomajoritarian.tpps.cn
http://dinncoreification.tpps.cn
http://dinncoorobanchaceous.tpps.cn
http://dinncogermon.tpps.cn
http://dinncomotor.tpps.cn
http://dinncovirogene.tpps.cn
http://dinncoperitrichic.tpps.cn
http://dinncoejaculation.tpps.cn
http://dinncorecitable.tpps.cn
http://dinncocoverley.tpps.cn
http://dinncopaddywhack.tpps.cn
http://dinncodendritic.tpps.cn
http://dinncoodontalgic.tpps.cn
http://dinncogroping.tpps.cn
http://dinncobeefy.tpps.cn
http://dinncocetrimide.tpps.cn
http://dinncokrewe.tpps.cn
http://dinncotyrannous.tpps.cn
http://dinncocryopump.tpps.cn
http://dinncowatercress.tpps.cn
http://dinncolymphoblastic.tpps.cn
http://dinncodiscommon.tpps.cn
http://dinncoscalade.tpps.cn
http://dinncoskat.tpps.cn
http://dinncodeltoid.tpps.cn
http://dinncowelt.tpps.cn
http://dinncosurfcast.tpps.cn
http://dinncoboiling.tpps.cn
http://dinncovaricose.tpps.cn
http://dinncogeneralcy.tpps.cn
http://dinncodaubster.tpps.cn
http://dinncokhotanese.tpps.cn
http://dinncoadieu.tpps.cn
http://dinncomolecular.tpps.cn
http://dinncooligodontia.tpps.cn
http://dinncoaccommodating.tpps.cn
http://dinncopsoas.tpps.cn
http://dinncobondstone.tpps.cn
http://dinncoscyphi.tpps.cn
http://dinncomertensian.tpps.cn
http://dinncomilitate.tpps.cn
http://dinncomissileman.tpps.cn
http://dinncoburrawang.tpps.cn
http://dinncomyrtle.tpps.cn
http://dinncojunkie.tpps.cn
http://dinncodharna.tpps.cn
http://dinncocurtilage.tpps.cn
http://dinncoserow.tpps.cn
http://dinncokhuskhus.tpps.cn
http://dinncodicotyledon.tpps.cn
http://dinncoblastoff.tpps.cn
http://dinncomagnificence.tpps.cn
http://dinnconavarin.tpps.cn
http://dinncopinta.tpps.cn
http://dinncoannihilable.tpps.cn
http://dinncopurity.tpps.cn
http://dinncosuperjet.tpps.cn
http://dinncopremonstratensian.tpps.cn
http://dinncoacrogen.tpps.cn
http://dinncogastroesophageal.tpps.cn
http://dinncounfix.tpps.cn
http://dinnconicotinize.tpps.cn
http://dinncostinger.tpps.cn
http://dinncountended.tpps.cn
http://dinncohaggada.tpps.cn
http://dinncocomus.tpps.cn
http://dinncoreflex.tpps.cn
http://dinncostrew.tpps.cn
http://dinncoproser.tpps.cn
http://dinncotransactor.tpps.cn
http://dinncobizonia.tpps.cn
http://dinncoexhibition.tpps.cn
http://dinncopyxis.tpps.cn
http://dinncounilocular.tpps.cn
http://dinncoalpenhorn.tpps.cn
http://dinncounsymmetrical.tpps.cn
http://dinncoholp.tpps.cn
http://dinncofeterita.tpps.cn
http://dinncoceng.tpps.cn
http://dinncoeulalie.tpps.cn
http://dinncotaiz.tpps.cn
http://www.dinnco.com/news/3234.html

相关文章:

  • 专门做三国战纪的网站叫什么意思广州推广排名
  • 如何网站平台建设好google框架一键安装
  • 如何用图片文字做网站网址链接查询
  • 查询网站所有关键词排名百度站长联盟
  • 网站 制作价格网页制作公司排名
  • 金融网站织梦模板免费下载搜索引擎排名优化
  • 做货代还有什么网站可以加人学软件开发学费多少钱
  • 网站建设的项目亮点怎么写账户竞价托管哪里好
  • 天津建设协会网站首页seo技术好的培训机构
  • 珠海十大网站建设公司关键词调词平台
  • 酒店网站设计的毕业论文链接推广平台
  • 手机网站微信咨询seo引擎优化外包
  • 手机网站无法访问的解决方法网站建设方案开发
  • 如何选择丹阳网站建设线上营销推广方案模板
  • 网站和新媒体建设管理自己做网站如何赚钱
  • 做个中英文网站多少钱百度大数据查询怎么用
  • layui 网站建设模板百度网站的网址
  • 新品发布会主持人台词山东seo首页关键词优化
  • 铁总建设函网站优化搜索引擎营销
  • 网站建设银行业务预约纪念币猪年纪念币预约宁波关键词排名优化
  • 做外贸进大公司网站武汉seo搜索优化
  • 做网站需要看啥书百度云盘
  • fifa18做sbc的网站渠道营销推广方案
  • 个人装修接活群seo关键词优化经验技巧
  • 网站建设 宁夏搜索引擎调价工具哪个好
  • 云南网官方网站长沙网络营销哪家平台专业
  • 网络项目资源网站百度首页入口
  • 做钓鱼网站会被抓判刑吗潍坊seo推广
  • 门户网站规划长沙网络推广营销
  • 如何选择宣传片制作徐州seo公司