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

如何申请网站重庆网站建设夹夹虫公司

如何申请网站,重庆网站建设夹夹虫公司,怒江州住房和城乡建设局网站,绥化市建设局网站测试串口printf输出。 一、硬件电路部分 开发板自带仿真器上有虚拟串口,插上USB仿真器可以找到串口设备号。 仿真器串口连接到MM32F5265芯片的PC10和PC11引脚(UART3功能)。 二、串口3功能 看手册串口3引脚的功能映射图 串口3映射到AF7,需要在程序…

测试串口printf输出。

一、硬件电路部分

开发板自带仿真器上有虚拟串口,插上USB仿真器可以找到串口设备号。
在这里插入图片描述

仿真器串口连接到MM32F5265芯片的PC10和PC11引脚(UART3功能)。

二、串口3功能

看手册串口3引脚的功能映射图
在这里插入图片描述

串口3映射到AF7,需要在程序中配置到此映射。

三、程序部分

3.1、usart.c

#include "main.h"void init_usart(uint32_t Baudrate)
{GPIO_InitTypeDef GPIO_InitStruct;UART_InitTypeDef UART_InitStruct;RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART3, ENABLE);UART_StructInit(&UART_InitStruct);UART_InitStruct.BaudRate      = Baudrate;UART_InitStruct.WordLength    = UART_WordLength_8b;UART_InitStruct.StopBits      = UART_StopBits_1;UART_InitStruct.Parity        = UART_Parity_No;UART_InitStruct.HWFlowControl = UART_HWFlowControl_None;UART_InitStruct.Mode          = UART_Mode_Tx;UART_Init(UART3, &UART_InitStruct);UART_Cmd(UART3, ENABLE);RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_7);GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_7);GPIO_StructInit(&GPIO_InitStruct);GPIO_InitStruct.GPIO_Pin   = GPIO_Pin_10;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_High;GPIO_InitStruct.GPIO_Mode  = GPIO_Mode_AF_PP;GPIO_Init(GPIOC, &GPIO_InitStruct);GPIO_StructInit(&GPIO_InitStruct);GPIO_InitStruct.GPIO_Pin   = GPIO_Pin_11;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_High;GPIO_InitStruct.GPIO_Mode  = GPIO_Mode_AF_PP;GPIO_Init(GPIOC, &GPIO_InitStruct);
}#if   defined (__ICCARM__)#if   (__VER__ >= 9030001)/* Files include */
#include <stddef.h>
#include <LowLevelIOInterface.h>/************************************************************************************************************************ @brief  redefine __write function* @note   for printf* @param  handle* @param  *buf* @param  bufSize* @retval nChars*********************************************************************************************************************/
size_t __write(int handle, const unsigned char *buf, size_t bufSize)
{size_t nChars = 0;/* Check for the command to flush all handles */if (-1 == handle){return (0);}/* Check for stdout and stderr (only necessary if FILE descriptors are enabled.) */if ((_LLIO_STDOUT != handle) && (_LLIO_STDERR != handle)){return (-1);}for (/* Empty */; bufSize > 0; --bufSize){UART_SendData(UART2, *buf);while (RESET == UART_GetFlagStatus(UART2, UART_FLAG_TXC)){}++buf;++nChars;}return (nChars);
}#else/************************************************************************************************************************ @brief  redefine fputc function* @note   for printf* @param  ch* @param  f* @retval ch*********************************************************************************************************************/
int fputc(int ch, FILE *f)
{UART_SendData(UART2, (uint8_t)ch);while (RESET == UART_GetFlagStatus(UART2, UART_FLAG_TXC)){}return (ch);
}#endif#elif defined (__GNUC__)/************************************************************************************************************************ @brief  redefine fputc function* @note   for printf* @param  ch* @param  f* @retval ch*********************************************************************************************************************/
int fputc(int ch, FILE *f)
{UART_SendData(UART3, (uint8_t)ch);while (RESET == UART_GetFlagStatus(UART3, UART_FLAG_TXC)){}return (ch);
}#else/************************************************************************************************************************ @brief  redefine fputc function* @note   for printf* @param  ch* @param  f* @retval ch*********************************************************************************************************************/
int fputc(int ch, FILE *f)
{UART_SendData(UART2, (uint8_t)ch);while (RESET == UART_GetFlagStatus(UART2, UART_FLAG_TXC)){}return (ch);
}#endif

3.2、main.c

#include "main.h"int main(void)
{SysTick_Init();init_usart(115200);init_led();while (1){led1_tog();led2_tog();SysTick_Delay_ms(100);printf("mm32F5265_ob_printf_test!\r\n");}
}

四、运行结果

下载程序后,串口输出内容:
在这里插入图片描述


文章转载自:

http://9F91uBtC.ssxLt.cn
http://a9zeRQIm.ssxLt.cn
http://APzNp5I6.ssxLt.cn
http://ZgC239Vs.ssxLt.cn
http://53LGCvdf.ssxLt.cn
http://M40euMKB.ssxLt.cn
http://GdQ0v9ro.ssxLt.cn
http://eOPdmgrs.ssxLt.cn
http://UsC2qBjN.ssxLt.cn
http://tQyHbFhk.ssxLt.cn
http://X3pZJeUc.ssxLt.cn
http://ReMOWBrO.ssxLt.cn
http://Ci0PeehP.ssxLt.cn
http://8kTSj5gV.ssxLt.cn
http://lyYgnTDw.ssxLt.cn
http://6yKSpH1G.ssxLt.cn
http://wvyBs9po.ssxLt.cn
http://DKvjBQBe.ssxLt.cn
http://FhOycWV7.ssxLt.cn
http://sI9FERsf.ssxLt.cn
http://APhFR8cq.ssxLt.cn
http://y9aHBaCx.ssxLt.cn
http://GOHfrWNu.ssxLt.cn
http://kWmeGRfj.ssxLt.cn
http://VyYRvNAc.ssxLt.cn
http://tMi5S8fz.ssxLt.cn
http://3W3CxsFW.ssxLt.cn
http://xozrvdmX.ssxLt.cn
http://zFyx34yA.ssxLt.cn
http://I4JcyIla.ssxLt.cn
http://www.dtcms.com/wzjs/708502.html

相关文章:

  • 梅州哪里做网站小企业网站 优帮云
  • 农业基本建设项目信息网站每天免费2小时外网加速
  • 如何看网站空间问题dw制作简单网站模板下载地址
  • 网站业务建设是什么网站过期了
  • 济南网站制作经验wordpress添加文章
  • 老山做网站的公司电子商城网站建设的实训内容
  • 网站制作教程一般地建网络wordpress 分类seo
  • 上海建设网站服务维护网站建设
  • php网站怎么做静态化做网页的软件w
  • 漳州网站开发制作棋牌高端企业网站报价
  • 站群cms系统通州免费网站建设
  • 深圳网站建设电话校园网站建设er模型
  • 个人建什么网站比较好淘宝店有给网站做优化am
  • 深圳建设官方网站网站开发服务属于什么行业
  • 六盘水遵义网站建设怎么做美橙网站备案照片背景
  • 建设公司网站模板下载wordpress 输出array
  • 怎样做视频电影网站北京南站在几环
  • 现在流行用什么做网站网站关键字多少个
  • 建站网址导航无锡网站建设 微信
  • 那家公司网站做的好怎么做网站规划书
  • 专业的网站开发建设公司深圳网站建设注意事项
  • 朝阳制作网站郑州响应式网站设计
  • 电子政务与网站建设意义莱芜金点子最新招聘信息电子版
  • 简述建设一个网站的具体过程wordpress添加端口访问不了
  • 域外网站是权威的网络营销
  • 通城做网站的软件公司网站
  • 视频网站的防盗链是怎么做的专业的网站设计制作
  • wordpress文章数据太多seo是什么时候开始的
  • 郑州做网站zzmshl做衣服的教程网站有哪些
  • 什么是网站的入口平台门户网站建设方案