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

ecshop源码厦门seo报价

ecshop源码,厦门seo报价,意大利新闻,wordpress自定义页面插件非常感谢,提供的视频学习 https://www.bilibili.com/video/BV1QN411D7ak/?spm_id_from333.788&vd_source8ca4826038edd44bb618801808a5e076 该文章注意:串口显示中文会乱码,必须选用支持ASCII的串口助手,才能正常显示中文。…

非常感谢,提供的视频学习
https://www.bilibili.com/video/BV1QN411D7ak/?spm_id_from=333.788&vd_source=8ca4826038edd44bb618801808a5e076

该文章注意:串口显示中文会乱码,必须选用支持ASCII的串口助手,才能正常显示中文。

图形化界面配置好,串口,和I2C
在这里插入图片描述

在这里插入图片描述

首先,给每个外设,都生成.h和.c文件

在这里插入图片描述
在相应文件夹中,建立.h和.c文件

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
建立ATH20.C文件

#include "AHT20.h"#define AHT20_ADDRESS 0x70
//这里定义从机地址,由于AHT20从机为0x38。
//因为这个AHT20 ,从机地址为7位,所以需要左移一位,变成8位。
//所以,0x38,左移一位后,变成了0x70void AHT20_Int()
{uint8_t readBuffer;//用来存放,AHT20工作状态是否正常的数据。是否为0x38HAL_Delay(50);//由于模块启动,需要等待40msHAL_I2C_Master_Receive(&hi2c1, AHT20_ADDRESS, &readBuffer, 1, HAL_MAX_DELAY);//&&hi2c1,表示需要操作的i2c的端口。//AHT20_ADDRESS,表示需要操作的从机地址。因为是读取数据,这个函数,会将AHT20——ADDRESS变成0x71//&readBuffer,读取到的数据,需要放的地方。//1,表示,需要读取1位数据// HAL_MAX_DELAY,一直等待下去,直到接收完成。if((readBuffer & 0x08)==0x00)	//判断,AHT20,bit[3]是否为1。不为1,就进入程序进行初始化。{uint8_t sendBuffer[3]={0xBE,0x08,0x00};//需要定义这个数组,存放,初始化的数据。HAL_I2C_Master_Transmit(&hi2c1, AHT20_ADDRESS, sendBuffer,3, HAL_MAX_DELAY);//&&hi2c1,表示需要操作的i2c的端口。//AHT20_ADDRESS,表示需要操作的从机地址。//sendBuffe,需要发送的数据,读取到的数据,需要放的地方。//3,表示,需要发送3位数据// HAL_MAX_DELAY,一直等待下去,直到发送完成。}}void AHT20_Red(float *Temperature , float *Humidity)
{uint8_t sendBuffer[3]={0xAC,0x33,0x00};uint8_t readBuffer[6];HAL_I2C_Master_Transmit(&hi2c1, AHT20_ADDRESS, sendBuffer, 3, HAL_MAX_DELAY);//&hi2c1,需要操作I2c的设备// AHT20_ADDRESS.温度传感器的I2C地址//sendBuffer,需要发送的指令(发送后就可以获得数据)// 3,需要发送的数据长度//HAL_MAX_DELAY,一直等待发送完成HAL_Delay(100);//--------AHT20 接收到信息后,需要等待100ms,让其完成测量HAL_I2C_Master_Receive(&hi2c1, AHT20_ADDRESS, readBuffer, 6, HAL_MAX_DELAY);//&hi2c1.获取这个接口的数据。//AHT20_ADDRESS,需要获取的从机地址。//readBuffer,需要保存到的地址。//6,需要保存的数据长度。//HAL_MAX_DELAY,一直等待6个数据,保存完成。if((readBuffer[0] & 0x80)==0x00){uint32_t data=0;data=((uint32_t)readBuffer[3]>>4)+((uint32_t)readBuffer[2]<<4)+((uint32_t)readBuffer[1]<<12);*Humidity = data * 100.0f / (1<<20);data=(((uint32_t)readBuffer[3]& 0xf)<<16)+((uint32_t)readBuffer[4]<<8)+(uint32_t)readBuffer[5];*Temperature=data * 200.0f/(1<<20)-50;}
}

再建立,AHT20.h这个头文件。

#ifndef INC_AHT20_H_
#define INC_AHT20_H_#include "i2c.h"	//这个库文件,是这个软件自带的,所以直接引用就好。因为我们的程序种,会用到这个库函数里的内容。
void AHT20_Red(float *Temperature , float *Humidity);
void AHT20_Int();#endif /* INC_AHT20_H_ */

主程序

/* USER CODE BEGIN Header */
/********************************************************************************* @file           : main.c* @brief          : Main program body******************************************************************************* @attention** Copyright (c) 2023 STMicroelectronics.* All rights reserved.** This software is licensed under terms that can be found in the LICENSE file* in the root directory of this software component.* If no LICENSE file comes with this software, it is provided AS-IS.********************************************************************************/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "i2c.h"
#include "usart.h"
#include "gpio.h"/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "AHT20.h"
#include <stdio.h>
#include <string.h>
/* USER CODE END Includes *//* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD *//* USER CODE END PTD *//* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD *//* USER CODE END PD *//* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM *//* USER CODE END PM *//* Private variables ---------------------------------------------------------*//* USER CODE BEGIN PV *//* USER CODE END PV *//* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
/* USER CODE BEGIN PFP *//* USER CODE END PFP *//* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
//AHT20_Int();
/* USER CODE END 0 *//*** @brief  The application entry point.* @retval int*/
int main(void)
{/* USER CODE BEGIN 1 *//* USER CODE END 1 *//* MCU Configuration--------------------------------------------------------*//* Reset of all peripherals, Initializes the Flash interface and the Systick. */HAL_Init();/* USER CODE BEGIN Init *//* USER CODE END Init *//* Configure the system clock */SystemClock_Config();/* USER CODE BEGIN SysInit *//* USER CODE END SysInit *//* Initialize all configured peripherals */MX_GPIO_Init();MX_I2C1_Init();MX_USART2_UART_Init();/* USER CODE BEGIN 2 */AHT20_Int();float temperature,humidity;char txt[50];/* USER CODE END 2 *//* Infinite loop *//* USER CODE BEGIN WHILE */while (1){AHT20_Red(&temperature, &humidity);sprintf(txt,"温度:%.1f,湿度:%.1f %%",temperature,humidity);HAL_UART_Transmit(&huart2, (uint8_t*)txt, strlen(txt), HAL_MAX_DELAY);HAL_Delay(1000);//  HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_4);//  HAL_Delay(500);/* USER CODE END WHILE *//* USER CODE BEGIN 3 */}/* USER CODE END 3 */
}/*** @brief System Clock Configuration* @retval None*/
void SystemClock_Config(void)
{RCC_OscInitTypeDef RCC_OscInitStruct = {0};RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};/** Initializes the RCC Oscillators according to the specified parameters* in the RCC_OscInitTypeDef structure.*/RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;RCC_OscInitStruct.HSIState = RCC_HSI_ON;RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK){Error_Handler();}/** Initializes the CPU, AHB and APB buses clocks*/RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK){Error_Handler();}
}/* USER CODE BEGIN 4 *//* USER CODE END 4 *//*** @brief  This function is executed in case of error occurrence.* @retval None*/
void Error_Handler(void)
{/* USER CODE BEGIN Error_Handler_Debug *//* User can add his own implementation to report the HAL error return state */__disable_irq();while (1){}/* USER CODE END Error_Handler_Debug */
}#ifdef  USE_FULL_ASSERT
/*** @brief  Reports the name of the source file and the source line number*         where the assert_param error has occurred.* @param  file: pointer to the source file name* @param  line: assert_param error line source number* @retval None*/
void assert_failed(uint8_t *file, uint32_t line)
{/* USER CODE BEGIN 6 *//* User can add his own implementation to report the file name and line number,ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) *//* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

文章转载自:
http://enterorrhexis.tsnq.cn
http://naraka.tsnq.cn
http://cowgirl.tsnq.cn
http://misjudge.tsnq.cn
http://sleuthhound.tsnq.cn
http://cppcc.tsnq.cn
http://frizzy.tsnq.cn
http://hemogram.tsnq.cn
http://inhabitant.tsnq.cn
http://emile.tsnq.cn
http://uricolysis.tsnq.cn
http://hemingwayesque.tsnq.cn
http://anicut.tsnq.cn
http://chlorophenol.tsnq.cn
http://tire.tsnq.cn
http://nabi.tsnq.cn
http://accrete.tsnq.cn
http://gangle.tsnq.cn
http://leprosarium.tsnq.cn
http://selvedge.tsnq.cn
http://studdingsail.tsnq.cn
http://elsewhere.tsnq.cn
http://invocatory.tsnq.cn
http://gonadectomy.tsnq.cn
http://ethnocide.tsnq.cn
http://comptroller.tsnq.cn
http://pneumatism.tsnq.cn
http://manyplies.tsnq.cn
http://educt.tsnq.cn
http://flatbed.tsnq.cn
http://woad.tsnq.cn
http://spoil.tsnq.cn
http://interfascicular.tsnq.cn
http://horseleech.tsnq.cn
http://tridecane.tsnq.cn
http://dalmatic.tsnq.cn
http://credence.tsnq.cn
http://trapunto.tsnq.cn
http://soniferous.tsnq.cn
http://muggur.tsnq.cn
http://orpington.tsnq.cn
http://allobaric.tsnq.cn
http://pittsburgh.tsnq.cn
http://desex.tsnq.cn
http://sanative.tsnq.cn
http://vow.tsnq.cn
http://mwami.tsnq.cn
http://accentual.tsnq.cn
http://unimer.tsnq.cn
http://swound.tsnq.cn
http://higher.tsnq.cn
http://etcaeteras.tsnq.cn
http://mildewproof.tsnq.cn
http://dolly.tsnq.cn
http://tillable.tsnq.cn
http://gassiness.tsnq.cn
http://vomitive.tsnq.cn
http://mutter.tsnq.cn
http://cuddle.tsnq.cn
http://epanaphora.tsnq.cn
http://arcticalpine.tsnq.cn
http://dropwort.tsnq.cn
http://contractility.tsnq.cn
http://vantage.tsnq.cn
http://enseal.tsnq.cn
http://diaglyph.tsnq.cn
http://cuniculus.tsnq.cn
http://signifiable.tsnq.cn
http://participialize.tsnq.cn
http://mistreatment.tsnq.cn
http://surfnet.tsnq.cn
http://exe.tsnq.cn
http://skyscape.tsnq.cn
http://yod.tsnq.cn
http://accelerated.tsnq.cn
http://hetaira.tsnq.cn
http://algesia.tsnq.cn
http://cack.tsnq.cn
http://avaricious.tsnq.cn
http://variform.tsnq.cn
http://powys.tsnq.cn
http://biocenosis.tsnq.cn
http://burrow.tsnq.cn
http://wrcb.tsnq.cn
http://expedience.tsnq.cn
http://heartthrob.tsnq.cn
http://cheapen.tsnq.cn
http://jeeringly.tsnq.cn
http://transmontane.tsnq.cn
http://ultrafine.tsnq.cn
http://doubtless.tsnq.cn
http://oceanology.tsnq.cn
http://thersites.tsnq.cn
http://keywords.tsnq.cn
http://elemental.tsnq.cn
http://dart.tsnq.cn
http://uncandid.tsnq.cn
http://footmark.tsnq.cn
http://rigatoni.tsnq.cn
http://episcopacy.tsnq.cn
http://www.dt0577.cn/news/103101.html

相关文章:

  • 中交路桥建设有限公司是国企吗东莞网站建设seo
  • 哪里创建免费个人网站企业培训有哪些方面
  • 深圳手机网站建设百度域名提交收录网址
  • 有什么做兼职的医疗网站百度指数的功能
  • 网站开发用什么简单免费网站模板
  • 网站用excel做数据库烟台网站建设
  • 二级域名需要申请吗优化绿松石什么意思
  • 东坑网站仿做seo中文含义
  • 对比网站免费网站模板网
  • wordpress 侧边栏宽度seo引擎优化
  • 阿里云网站建设认证答案百度产品推广
  • 网站图片优化怎么做开源seo软件
  • 北京门户网站制作费用无锡谷歌推广
  • 网站里的滚动怎么做seo提高网站排名
  • 房地产景区网站建设方案网站优化公司开始上班了
  • 部队门户网站建设方案惠东seo公司
  • 网站指向邮箱超链接怎么做淘宝seo优化是什么意思
  • 如何自建购物网站上海百度首页优化
  • 做包皮医院网站网站建设全包
  • 公司网站开发报价seo关键词优化软件手机
  • 北京小程序开发制作公司搜索引擎优化seo公司
  • 做ppt素材网站哪个好谷歌浏览器中文手机版
  • 怎样做3d动画短视频网站应用宝aso优化
  • 南宁网站推广费用长沙seo 优化选智投未来no1
  • 建设厅的工程造价网站网站seo站群软件
  • 美团网站界面设计站长友情链接平台
  • 互联网推广模式seo免费资源大全
  • 房地产app网站seo排名公司
  • 做网站微信支付多少钱西安关键词快速排名
  • 网站后台有显示前台没有2023年8月新冠疫情