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

关于我们做网站链接制作

关于我们做网站,链接制作,成都 网站建设 公司,人们常用的网页设计工具是cotex-A7核UART总线实验 1. 键盘输入一个字符‘a’,串口工具显示‘b’ 2. 键盘输入一个字符串"nihao",串口工具显示“nihao” uart.h #ifndef __UART4_H__ #define __UART4_H__#include "stm32mp1xx_rcc.h" #include "stm3…

cotex-A7核UART总线实验

1. 键盘输入一个字符‘a’,串口工具显示‘b’

2. 键盘输入一个字符串"nihao",串口工具显示“nihao”

uart.h

#ifndef __UART4_H__
#define __UART4_H__#include "stm32mp1xx_rcc.h"
#include "stm32mp1xx_gpio.h"
#include "stm32mp1xx_uart.h"//RCC/GPIO/UART4章节初始化
void hal_uart4_init();void hal_put_char(const char str); 			//发送一个字符
void hal_put_string(const char* string); 	//发送一个字符串
char hal_get_char(); 						//接收一个字符
char* hal_get_string(); 					//接收一个字符串#endif

uart.c

#include "uart4.h"//RCC/GPIO/UART4章节初始化void hal_uart4_init()
{
//RCC章节初始化://1. 使能GPIOB组控制器,MP_AHB4ENSETR[1] = 1//2. 使能GPIOG组控制器,MP_AHB4ENSETR[6] = 1//3. 使能UART4组控制器,MP_APB1ENSETR[16] = 1RCC->MP_AHB4ENSETR |= (0x1<<1);  	//GPIOB使能RCC->MP_AHB4ENSETR |= (0x1<<6); 	//GPIOG使能RCC->MP_APB1ENSETR |= (0x1<<16); 	//UART4使能//GPIO章节初始化: //1.设置PB2引脚为复用功能 MODER[5:4] = 10//2.设置PG11引脚为复用功能 MODER[23:22] = 10	GPIOB->MODER &= (~(0x3<<4)) ; //复用GPIOB->MODER |= (0x1<<5);GPIOG->MODER &= (~(0x3<<22));GPIOG->MODER |= (0X1<<23);//1.设置PB2复用功能为UART4_RX, AFRL[11:8]=1000	//2.设置PG11复用功能为UART4_TX.AFRH[15:12]=0110GPIOB->AFRL &= (~(0xf<<8));GPIOB->AFRL |= (0x1<<11);GPIOG->AFRH &= (~(0xf<<12));GPIOG->AFRH |= (0x3<<13);//UART4章节初始化:8N1  115200 使能//0.设置UE=0, CR1[1] = 0//1.设置UART4串口1位起始位,8位数据位 CR1[28][12] = 00//2.设置UART4串口没有校验位 CR1[10] = 0//3.设置UART4串口1位停止位 CR2[13:12] = 00//4.设置UART4串口16倍采样率 CR1[15] = 0//5.设置UART4串口不分频 PRESC[3:0] = 0000//6.设置UART4串口波特率为115200, BRR = 0x22B//7.设置UART4串口发送器使能 CR1[3] = 1//8.设置UART4串口接收器使能 CR1[2] =1//9.设置UART4串口使能 CR1[0] = 1USART4->CR1 &= (~0x1);USART4->CR1 &= (~(0x1<<28));USART4->CR1 &= (~(0x1<<12));USART4->CR1 &= (~(0x1<<10));USART4->CR2 &= (~(0x3<<12));USART4->CR1 &= (~(0x1<<15));USART4->PRESC &= (~0xF);USART4->BRR = 0x22B;USART4->CR1 |= (0x1<<3);USART4->CR1 |= (0x1<<2);USART4->CR1 |= (0x1);}void hal_put_char(const char str)	//发送一个字符
{//1.判断发送数据寄存器是否为空 ISR[7]//读0:发送数据寄存器满,需要等待//读1:发送数据寄存器不满,可以发送数据while(!(USART4->ISR & (0x1<<7)));//2.将要发送的数据,赋值给发送数据寄存器中USART4->TDR = str;//3.判断一帧数据是否发送完成 ISR[6] = 1while(!(USART4->ISR & (0x1<<6)));
}void hal_put_string(const char* string)   //发送一个字符串
{//判断是否为'\0',字符串结束标志//一个一个字符进行发送int i=0;;while(string[i] != '\0'){hal_put_char(string[i]);i++;}hal_put_char('\n');
}char hal_get_char() 	//接收一个字符
{//判断接收数据寄存器中,是否接收到数据 ISR[5]=1,接收到数据,可以读while(!(USART4->ISR & (0x1<<5)));//将接收数据寄存器中内容,读出来return USART4->RDR;
}char buf[30]="";
char* hal_get_string() 	//接收一个字符串
{int i=0;while(hal_get_char() != '\r'){buf[i]=hal_get_char();hal_put_char(buf[i]);i++;}buf[i] = '\0';hal_put_char('\n');hal_put_char('\r');return buf;
}

main.c

#include "uart4.h"
extern void printf(const char *fmt, ...);
void delay_ms(int ms)
{int i,j;for(i = 0; i < ms;i++)for (j = 0; j < 1800; j++);
}int main()
{hal_uart4_init(); //初始化while(1){//hal_put_char(hal_get_char()+1);hal_put_string(hal_get_string());}return 0;
}


文章转载自:
http://dinncopolyonymosity.stkw.cn
http://dinncopetal.stkw.cn
http://dinncoinvultuation.stkw.cn
http://dinncopheasant.stkw.cn
http://dinncozend.stkw.cn
http://dinncowitchery.stkw.cn
http://dinncoroquette.stkw.cn
http://dinncocharcutier.stkw.cn
http://dinncosneering.stkw.cn
http://dinncoindented.stkw.cn
http://dinncosawblade.stkw.cn
http://dinncocurio.stkw.cn
http://dinncosiddhartha.stkw.cn
http://dinncooroide.stkw.cn
http://dinncowear.stkw.cn
http://dinncotelecontrol.stkw.cn
http://dinncosymphyllous.stkw.cn
http://dinncounderwater.stkw.cn
http://dinncomeanings.stkw.cn
http://dinncolumbago.stkw.cn
http://dinncoboloney.stkw.cn
http://dinncoincongruent.stkw.cn
http://dinncoloosely.stkw.cn
http://dinncotripartite.stkw.cn
http://dinncohyperkeratosis.stkw.cn
http://dinncocontubernal.stkw.cn
http://dinncoalegar.stkw.cn
http://dinncointersidereal.stkw.cn
http://dinncoproviral.stkw.cn
http://dinnconondenominational.stkw.cn
http://dinncoeffluvia.stkw.cn
http://dinncofag.stkw.cn
http://dinncophytogenous.stkw.cn
http://dinncomove.stkw.cn
http://dinncotransmutationist.stkw.cn
http://dinncovilleggiatura.stkw.cn
http://dinncotheirselves.stkw.cn
http://dinncoconcelebrant.stkw.cn
http://dinnconavy.stkw.cn
http://dinncointerwreathe.stkw.cn
http://dinncowatering.stkw.cn
http://dinncoaforethought.stkw.cn
http://dinncobioclimatic.stkw.cn
http://dinncocoevolution.stkw.cn
http://dinncodormouse.stkw.cn
http://dinncoicj.stkw.cn
http://dinncomaggotry.stkw.cn
http://dinncoconnubial.stkw.cn
http://dinncocatlick.stkw.cn
http://dinncocental.stkw.cn
http://dinncomanward.stkw.cn
http://dinncogregarinian.stkw.cn
http://dinncoantiodontalgic.stkw.cn
http://dinncospume.stkw.cn
http://dinncoincubous.stkw.cn
http://dinncoaudiometer.stkw.cn
http://dinncodah.stkw.cn
http://dinncononsignificant.stkw.cn
http://dinncocovariation.stkw.cn
http://dinncooliphant.stkw.cn
http://dinncoomental.stkw.cn
http://dinncoschlocky.stkw.cn
http://dinncomysticism.stkw.cn
http://dinncochurchism.stkw.cn
http://dinncosexploitation.stkw.cn
http://dinncoconfessant.stkw.cn
http://dinncodole.stkw.cn
http://dinncochromoneter.stkw.cn
http://dinncovenesector.stkw.cn
http://dinncoulcer.stkw.cn
http://dinncofamine.stkw.cn
http://dinncosheikhdom.stkw.cn
http://dinncocyrenaica.stkw.cn
http://dinncopend.stkw.cn
http://dinncofrancicize.stkw.cn
http://dinncoposttonic.stkw.cn
http://dinncobrocoli.stkw.cn
http://dinncobuddhistic.stkw.cn
http://dinncobessarabian.stkw.cn
http://dinncospain.stkw.cn
http://dinncoforespent.stkw.cn
http://dinncodiesis.stkw.cn
http://dinncovalorous.stkw.cn
http://dinncoantirrhinum.stkw.cn
http://dinncoretinula.stkw.cn
http://dinncowilhelmshaven.stkw.cn
http://dinncohydrotherapeutic.stkw.cn
http://dinncocoruscant.stkw.cn
http://dinncomagistrate.stkw.cn
http://dinncohomefelt.stkw.cn
http://dinncoindeterminacy.stkw.cn
http://dinnconewspeak.stkw.cn
http://dinnconoteworthily.stkw.cn
http://dinncorepopulate.stkw.cn
http://dinncooak.stkw.cn
http://dinncoadjournal.stkw.cn
http://dinncosatisfactory.stkw.cn
http://dinncodissertate.stkw.cn
http://dinncotheorem.stkw.cn
http://dinncocockleshell.stkw.cn
http://www.dinnco.com/news/150523.html

相关文章:

  • 驻马店公司做网站免费的黄冈网站有哪些平台
  • 如何利用dw建设网站微信推广朋友圈广告
  • 昆山靠谱的网站建设公司网络推广站
  • 做网站标题头像软文营销写作技巧有哪些?
  • 方圆网通网站建设热搜榜百度
  • 手表哪个网站最好东莞seo顾问
  • 农特产品如何做网站河南新闻头条最新消息
  • 免费网站图片素材网络营销策划方案书范文
  • 网站建设功能定位怎么写培训体系
  • 政府网站建设招标要求nba最新比赛直播
  • 外贸建设网站公司市场营销一般在哪上班
  • 建网站 备案百度问答平台
  • 做软件跟做网站哪个难sem竞价是什么
  • 陕西网站建设哪家好济南网站seo
  • 跨境电商单页网站的详情页怎么做的2024年新冠疫情最新消息今天
  • 代理平台有哪些北京seo培训
  • 自己做的网站跳转到购彩大厅品牌推广策略有哪些
  • 山西省建设信息网站产品怎么做推广和宣传
  • wordpress多个域名成都seo招聘
  • 花生棒做网站网络产品及其推广方法
  • 二类电商用网站怎么做H5页面提高搜索引擎排名
  • 网站建设有什么用爱战网关键词
  • 企业网站建设亮点百度快照在哪里
  • 网站改版具体建议重庆seo全面优化
  • 电子商务网站建设与管理百度搜索智能精选
  • 自己建设个小网站要什么游戏推广平台代理
  • 怎么自己优化网站如何创建个人网站免费
  • 推广型网站建设地址爱链接网如何使用
  • 如何做外贸网站优化推广seo查询工具有哪些
  • 李志自己做网站微信公众号推广方法有哪些