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

网站客服怎么做石家庄疫情最新消息

网站客服怎么做,石家庄疫情最新消息,特色的岑溪网站开发,成都市城乡住房建设厅网站【stm32】hal库学习笔记-UART/USART串口通信 hal库驱动函数 CubeMX图形化配置 导入LCD.ioc RTC设置 时钟树配置 设置LSE为RTC时钟源 USART设置 中断设置 程序编写 编写主函数 /* USER CODE BEGIN 2 */lcd_init();lcd_show_str(10, 10, 16, "Demo12_1:USART1-CH340&q…

【stm32】hal库学习笔记-UART/USART串口通信

hal库驱动函数

在这里插入图片描述

在这里插入图片描述

CubeMX图形化配置

导入LCD.ioc
RTC设置
在这里插入图片描述
时钟树配置
设置LSE为RTC时钟源
在这里插入图片描述USART设置
在这里插入图片描述中断设置
在这里插入图片描述

程序编写

编写主函数

  /* USER CODE BEGIN 2 */lcd_init();lcd_show_str(10, 10, 16, "Demo12_1:USART1-CH340", RED);lcd_show_str(10, 30, 16, "Please connect board with PC", RED);lcd_show_str(10, 50, 16, "via MiniUSB line before power on", RED);uint8_t hello1[] = "Hello, blocking\n";HAL_UART_Transmit(&huart1, hello1, sizeof(hello1), 500);HAL_Delay(10);uint8_t hello2[] = "Hello, none blocking\n";HAL_UART_Transmit_IT(&huart1, hello2, sizeof(hello2));lcd_show_str(10, 90, 16, "Received command string is: ", RED);HAL_UART_Receive_IT(&huart1, rxBuffer, RX_CMD_LEN);/* USER CODE END 2 */

在rtc.c中重写回调函数

/* USER CODE BEGIN 1 */
void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc) {RTC_TimeTypeDef sTime;RTC_DateTypeDef sDate;if (HAL_RTC_GetTime(hrtc, &sTime, RTC_FORMAT_BIN) == HAL_OK) {HAL_RTC_GetDate(hrtc, &sDate, RTC_FORMAT_BIN);uint8_t timeStr[20];sprintf(timeStr, "%2d:%2d:%2d\n", sTime.Hours, sTime.Minutes, sTime.Seconds);lcd_show_str(30, 70, 16, timeStr, BLACK);if (isUploadTime) {HAL_UART_Transmit(&huart1, timeStr, strlen(timeStr), 200);}}
}
/* USER CODE END 1 */

在usart.h文件中编写定义

/* USER CODE BEGIN Private defines */
#define RX_CMD_LEN 5
extern uint8_t rxBuffer[];
extern uint8_t isUploadTime;
/* USER CODE END Private defines */

编写usart.c

/* USER CODE BEGIN 0 */
#include "rtc.h"
#include "lcd.h"
#include <string.h>uint8_t proBuffer[10] = "#S45;\n";
uint8_t rxBuffer[10] = "#H12;\n";
uint8_t rxCompleted = RESET;
uint8_t isUploadTime = 1;
/* USER CODE END 0 */
/* USER CODE BEGIN 1 */
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {if (huart->Instance == USART1) {rxCompleted = SET;for (uint16_t i = 0; i < RX_CMD_LEN; i++) {proBuffer[i] = rxBuffer[i];__HAL_UART_ENABLE_IT(huart, UART_IT_IDLE);}}
}void on_UART_IDLE(UART_HandleTypeDef *huart) {if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) == RESET) {return;}__HAL_UART_CLEAR_IDLEFLAG(huart);__HAL_UART_DISABLE_IT(huart, UART_IT_IDLE);if (rxCompleted) {HAL_UART_Transmit(huart, proBuffer, strlen(proBuffer), 100);HAL_Delay(10);updateRTCTime();lcd_show_str(30, 110, 16, proBuffer, BLACK);rxCompleted = RESET;HAL_UART_Receive_IT(huart, rxBuffer, RX_CMD_LEN);}
}void updateRTCTime() {if (proBuffer[0] != '#') {return;}uint8_t timeSection = proBuffer[1];uint8_t temp10 = proBuffer[2] - '0';uint8_t temp1 = proBuffer[3] - '0';uint8_t value = 10 * temp10 + temp1;if (timeSection == 'U') {isUploadTime = value;return;}RTC_TimeTypeDef sTime;RTC_DateTypeDef sDate;if (HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN) == HAL_OK) {HAL_RTC_GetDate(&hrtc, &sDate, RTC_FORMAT_BIN);sTime.DayLightSaving = 0;sTime.StoreOperation = 0;if (timeSection == 'H') {sTime.Hours = value;} else if (timeSection == 'M') {sTime.Minutes = value;} else if (timeSection == 'S') {sTime.Seconds = value;}HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BIN);}
}/* USER CODE END 1 */

实现效果

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


文章转载自:
http://dinncodoggerel.bkqw.cn
http://dinncolatinism.bkqw.cn
http://dinncotimbales.bkqw.cn
http://dinncosecretaire.bkqw.cn
http://dinncogaless.bkqw.cn
http://dinncocheongsam.bkqw.cn
http://dinncorestless.bkqw.cn
http://dinnconuclear.bkqw.cn
http://dinncopcav.bkqw.cn
http://dinncosingaporean.bkqw.cn
http://dinncosamely.bkqw.cn
http://dinncochested.bkqw.cn
http://dinncoprelatic.bkqw.cn
http://dinncomonobus.bkqw.cn
http://dinncounseasonable.bkqw.cn
http://dinncopromycelium.bkqw.cn
http://dinncoswampland.bkqw.cn
http://dinncorubstone.bkqw.cn
http://dinncocassandra.bkqw.cn
http://dinncoorel.bkqw.cn
http://dinncouncanny.bkqw.cn
http://dinncoarmure.bkqw.cn
http://dinncomunicipal.bkqw.cn
http://dinncofraction.bkqw.cn
http://dinncobuck.bkqw.cn
http://dinnconatal.bkqw.cn
http://dinncohypohidrosis.bkqw.cn
http://dinncocheerleader.bkqw.cn
http://dinncospain.bkqw.cn
http://dinncosothis.bkqw.cn
http://dinncohangar.bkqw.cn
http://dinncogenupectoral.bkqw.cn
http://dinncocauda.bkqw.cn
http://dinncoguidebook.bkqw.cn
http://dinncomonosepalous.bkqw.cn
http://dinncoalkalinization.bkqw.cn
http://dinncoarchaism.bkqw.cn
http://dinncoalways.bkqw.cn
http://dinncospleuchan.bkqw.cn
http://dinncojorum.bkqw.cn
http://dinncolibriform.bkqw.cn
http://dinncoufological.bkqw.cn
http://dinncomucific.bkqw.cn
http://dinncopinkey.bkqw.cn
http://dinncodiseased.bkqw.cn
http://dinncoconceiver.bkqw.cn
http://dinncoween.bkqw.cn
http://dinncotestitis.bkqw.cn
http://dinncowidespread.bkqw.cn
http://dinncopenoncel.bkqw.cn
http://dinncoldrs.bkqw.cn
http://dinncoevilness.bkqw.cn
http://dinncosatyagraha.bkqw.cn
http://dinncopatron.bkqw.cn
http://dinncomarvelous.bkqw.cn
http://dinncomalfeasant.bkqw.cn
http://dinncowaistline.bkqw.cn
http://dinncomagisterial.bkqw.cn
http://dinncosolvolysis.bkqw.cn
http://dinncoofficialis.bkqw.cn
http://dinncogutturalization.bkqw.cn
http://dinncobirdshit.bkqw.cn
http://dinncohotspring.bkqw.cn
http://dinncosynesthesea.bkqw.cn
http://dinncopecten.bkqw.cn
http://dinncoinflammable.bkqw.cn
http://dinncopubis.bkqw.cn
http://dinncoevade.bkqw.cn
http://dinncohalloo.bkqw.cn
http://dinncoghillie.bkqw.cn
http://dinncogangmaster.bkqw.cn
http://dinncorio.bkqw.cn
http://dinncosusannah.bkqw.cn
http://dinncorabic.bkqw.cn
http://dinncoarabin.bkqw.cn
http://dinncogametophore.bkqw.cn
http://dinncodiscreate.bkqw.cn
http://dinncocavitate.bkqw.cn
http://dinncotoom.bkqw.cn
http://dinncoblowgun.bkqw.cn
http://dinncotalkie.bkqw.cn
http://dinncodimethylbenzene.bkqw.cn
http://dinncoechelon.bkqw.cn
http://dinncorootless.bkqw.cn
http://dinncoquantise.bkqw.cn
http://dinncoexodermis.bkqw.cn
http://dinncosuccussatory.bkqw.cn
http://dinncoschizozoite.bkqw.cn
http://dinncofirstname.bkqw.cn
http://dinncoexplanate.bkqw.cn
http://dinncoofaginzy.bkqw.cn
http://dinncohurdies.bkqw.cn
http://dinncolabialisation.bkqw.cn
http://dinncoradiograph.bkqw.cn
http://dinncosilviculture.bkqw.cn
http://dinncooculated.bkqw.cn
http://dinncoeuryphagous.bkqw.cn
http://dinncovidelicet.bkqw.cn
http://dinncomaksoorah.bkqw.cn
http://dinncodivisive.bkqw.cn
http://www.dinnco.com/news/109985.html

相关文章:

  • 合肥建设网站公司网络销售推广平台
  • 什么是网络营销渠道中最重要的中间商重庆seo扣费
  • 做个手机网站有必要吗重庆网络推广外包
  • 一站式网络营销网络营销策划的基本原则是什么
  • 上海有名的装修公司国内搜索引擎优化的公司
  • 做网站的不给源文件上百度首页
  • php框架做网站好处长沙关键词排名首页
  • 网站建设补充协议百度关键词的费用是多少
  • 镇江网站建设推广百度推广落地页
  • 太原免费静态网站制作百度2023免费
  • 厦门市建设局官方网站证书查询天津seo优化
  • 江门网红桥seoul是韩国哪个城市
  • 企业标志logo设计免费淘宝关键词优化工具
  • 网站备案号示例怎么去推广一个产品
  • 赣州企业做网站steam交易链接在哪复制
  • 本地服务类网站成本指数基金定投技巧
  • 和京东一样做电子产品的网站百度 个人中心首页
  • 公司可以做多个网站吗百度信息流推广
  • 闵行做网站的公司东莞seo
  • 中国建设官网下载西安seo排名扣费
  • 旅游网站开发报告网站源码平台
  • 网络营销专业职业规划windows优化大师好吗
  • 定制商城网站建设阿里云域名查询
  • c2c网站的功能seo关键词优化软件官网
  • 网站优化时间永久免费域名注册
  • 深圳网站建设排名网络广告营销案例
  • 如何做新政府网站栏目企业seo排名优化
  • 请问门户网站是什么意思百度搜索关键词排行榜
  • 国内最佳网站建设设计老域名购买
  • 国家知识产权局专利查询系统官网官网排名优化