Browse Source

debug adc部分

master
htujun 3 years ago
parent
commit
217d995715
  1. 177
      stm32/HARDWARE/ADC/adc.c
  2. 15
      stm32/HARDWARE/ADC/adc.h
  3. 11
      stm32/HARDWARE/LED/led.c
  4. 10
      stm32/HARDWARE/LED/led.h
  5. BIN
      stm32/OBJ/Template.axf
  6. 20
      stm32/OBJ/Template.build_log.htm
  7. 2016
      stm32/OBJ/Template.hex
  8. 1200
      stm32/OBJ/Template.htm
  9. 1
      stm32/OBJ/Template.lnp
  10. 45
      stm32/OBJ/Template_Target 1.dep
  11. BIN
      stm32/OBJ/adc.crf
  12. BIN
      stm32/OBJ/adc.o
  13. BIN
      stm32/OBJ/led.crf
  14. BIN
      stm32/OBJ/led.o
  15. BIN
      stm32/OBJ/main.crf
  16. BIN
      stm32/OBJ/main.o
  17. BIN
      stm32/OBJ/stm32f10x_dma.crf
  18. 31
      stm32/OBJ/stm32f10x_dma.d
  19. BIN
      stm32/OBJ/stm32f10x_dma.o
  20. BIN
      stm32/OBJ/timer.crf
  21. BIN
      stm32/OBJ/timer.o
  22. 36
      stm32/USER/.vscode/c_cpp_properties.json
  23. 2
      stm32/USER/.vscode/keil-assistant.log
  24. 15
      stm32/USER/.vscode/uv4.log
  25. 2
      stm32/USER/.vscode/uv4.log.lock
  26. 1086
      stm32/USER/Template.map
  27. 75
      stm32/USER/Template.uvguix.QY
  28. 16
      stm32/USER/Template.uvoptx
  29. 5
      stm32/USER/Template.uvprojx
  30. 36
      stm32/USER/main.c

177
stm32/HARDWARE/ADC/adc.c

@ -1,98 +1,109 @@ @@ -1,98 +1,109 @@
#include "adc.h"
#include "delay.h"
//初始化ADC
//这里我们仅以规则通道为例
//我们默认将开启通道0~3
void Adc_Init(void)
#include "adc.h"
#include "delay.h"
#define ADC1_DR_Address ((u32)0x40012400+0x4c)
uint16_t ADC_ConvertedValue[3];
/*******************************************************************************
* : ADCx_Init
* : ADC初始化
* :
* :
*******************************************************************************/
void ADCx_Init(void)
{
ADC_InitTypeDef ADC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB |RCC_APB2Periph_ADC1 , ENABLE ); //使能ADC1通道时钟
RCC_ADCCLKConfig(RCC_PCLK2_Div6); //设置ADC分频因子6 72M/6=12,ADC最大时间不能超过14M
//PA1 作为模拟通道输入引脚
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; //模拟输入引脚
GPIO_Init(GPIOB, &GPIO_InitStructure);
ADC_DeInit(ADC1); //复位ADC1
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; //ADC工作模式:ADC1和ADC2工作在独立模式
ADC_InitStructure.ADC_ScanConvMode = ENABLE; //模数转换工作在单通道模式
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; //模数转换工作在单次转换模式
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; //转换由软件而不是外部触发启动
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //ADC数据右对齐
ADC_InitStructure.ADC_NbrOfChannel = 1; //顺序进行规则转换的ADC通道的数目
ADC_Init(ADC1, &ADC_InitStructure); //根据ADC_InitStruct中指定的参数初始化外设ADCx的寄存器
ADC_Cmd(ADC1, ENABLE); //使能指定的ADC1
ADC_ResetCalibration(ADC1); //使能复位校准
while(ADC_GetResetCalibrationStatus(ADC1));
ADC_StartCalibration(ADC1);
while(ADC_GetCalibrationStatus(ADC1));
GPIO_InitTypeDef GPIO_InitStructure; //定义结构体变量
ADC_InitTypeDef ADC_InitStructure;
DMA_InitTypeDef DMA_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOA|RCC_APB2Periph_ADC1|RCC_APB2Periph_AFIO,ENABLE);
RCC_ADCCLKConfig(RCC_PCLK2_Div6);//设置ADC分频因子6 72M/6=12,ADC最大时间不能超过14M
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
DMA_DeInit(DMA1_Channel1);
DMA_InitStructure.DMA_PeripheralBaseAddr =(u32)&ADC1->DR;
DMA_InitStructure.DMA_MemoryBaseAddr =(u32)&ADC_ConvertedValue;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStructure.DMA_BufferSize = 2;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
DMA_Init(DMA1_Channel1, &DMA_InitStructure);
DMA_Cmd(DMA1_Channel1, ENABLE);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_1;//ADC
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AIN; //模拟输入
//GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOA,&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_1;//ADC
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AIN; //模拟输入
//GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOB,&GPIO_InitStructure);
ADC_DeInit(ADC1);//?? ADC1,?? ADC1,
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_InitStructure.ADC_ScanConvMode = ENABLE;//扫描模式
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;//开启连续转换
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;//禁止触发检测,使用软件触发
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;//右对齐
ADC_InitStructure.ADC_NbrOfChannel = 2;//1个转换在规则序列中 也就是只转换规则序列1
ADC_Init(ADC1, &ADC_InitStructure);//ADC初始化
ADC_DMACmd(ADC1, ENABLE);
ADC_Cmd(ADC1, ENABLE);//开启AD转换器
ADC_ResetCalibration(ADC1);//重置指定的ADC的校准寄存器
while(ADC_GetResetCalibrationStatus(ADC1));//获取ADC重置校准寄存器的状态
ADC_StartCalibration(ADC1);//开始指定ADC的校准状态
while(ADC_GetCalibrationStatus(ADC1));//获取指定ADC的校准程序
ADC_SoftwareStartConvCmd(ADC1, ENABLE);//使能或者失能指定的ADC的软件转换启动功能
}
//获得ADC值
//ch:通道值 0~3
u16 Get_Adc(u8 ch)
{
//设置指定ADC的规则组通道,一个序列,采样时间
ADC_RegularChannelConfig(ADC1, ch, 1, ADC_SampleTime_239Cycles5 ); //ADC1,ADC通道,采样时间为239.5周期
ADC_SoftwareStartConvCmd(ADC1, ENABLE); //使能指定的ADC1的软件转换启动功能
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC ));//等待转换结束
/*******************************************************************************
* : Get_ADC_Value
* : ch的转换值times次,
* : ch:
times:
* : ch的times次转换结果平均值
*******************************************************************************/
u16 Get_ADC_Value(u8 ch,u8 times)
{
u32 temp_val=0;
u8 t;
//设置指定ADC的规则组通道,一个序列,采样时间
ADC_RegularChannelConfig(ADC1, ch, 1, ADC_SampleTime_239Cycles5); //ADC1,ADC通道,239.5个周期,提高采样时间可以提高精确度
return ADC_GetConversionValue(ADC1); //返回最近一次ADC1规则组的转换结果
for(t=0;t<times;t++)
{
//ADC_SoftwareStartConvCmd(ADC1, ENABLE);//使能指定的ADC1的软件转换启动功能
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC ));//等待转换结束
//temp_val+=ADC_GetConversionValue(ADC1);
temp_val+=ADC_ConvertedValue[0];
delay_ms(5);
}
return temp_val/times;
}
u16 Get_Adc_Average(u8 ch,u8 times)
u16 Get_ADC1_Value(u8 ch,u8 times)
{
u32 temp_val=0;
u8 t;
//设置指定ADC的规则组通道,一个序列,采样时间
ADC_RegularChannelConfig(ADC1, ch, 2, ADC_SampleTime_239Cycles5); //ADC1,ADC通道,239.5个周期,提高采样时间可以提高精确度
for(t=0;t<times;t++)
{
temp_val+=Get_Adc(ch);
//ADC_SoftwareStartConvCmd(ADC1, ENABLE);//使能指定的ADC1的软件转换启动功能
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC ));//等待转换结束
//temp_val+=ADC_GetConversionValue(ADC1);
temp_val+=ADC_ConvertedValue[1];
delay_ms(5);
}
return temp_val/times;
}

15
stm32/HARDWARE/ADC/adc.h

@ -1,12 +1,11 @@ @@ -1,12 +1,11 @@
#ifndef __ADC_H
#define __ADC_H
#include "sys.h"
#ifndef _adc_H
#define _adc_H
#include "sys.h"
void Adc_Init(void);
u16 Get_Adc(u8 ch);
u16 Get_Adc_Average(u8 ch,u8 times);
u16 Get_Adc_Average1(u8 ch1,u8 times);
u16 Get_Adc1(u8 ch1);
void ADCx_Init(void);
u16 Get_ADC_Value(u8 ch,u8 times);
u16 Get_ADC1_Value(u8 ch,u8 times);
#endif

11
stm32/HARDWARE/LED/led.c

@ -13,18 +13,11 @@ @@ -13,18 +13,11 @@
//LED IO<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
void LED_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOA, ENABLE); //ʹ<EFBFBD><EFBFBD>PA,PD<EFBFBD>˿<EFBFBD>ʱ<EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14; //LED0-->PA.8 <EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); //ʹ<EFBFBD><EFBFBD>PA,PD<EFBFBD>˿<EFBFBD>ʱ<EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>Ϊ50MHz
GPIO_Init(GPIOB, &GPIO_InitStructure); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>GPIOA.8
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15 | GPIO_Pin_11;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_SetBits(GPIOB,GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 ); //PA.8 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}

10
stm32/HARDWARE/LED/led.h

@ -10,20 +10,10 @@ @@ -10,20 +10,10 @@
#define __LED_H
#include "sys.h"
// 空调
#define LED_CONDITIONER PBout(12) // PB5
// 水帘
#define LED_NAPPE PBout(13) // PB6
// 水枪
#define LED_WATER_GUN PBout(14) // PB7
#define BEEP PAout(11)
void LED_Init(void);//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
void Relay_Beep_Init(void);
void Motor_Init(void);
#endif

BIN
stm32/OBJ/Template.axf

Binary file not shown.

20
stm32/OBJ/Template.build_log.htm

@ -22,29 +22,25 @@ Dialog DLL: TCM.DLL V1.35.1.0 @@ -22,29 +22,25 @@ Dialog DLL: TCM.DLL V1.35.1.0
<h2>Project:</h2>
E:\ÏîÄ¿\¼æÖ°ÏîÄ¿\20220423-IndoorEnvSystem\stm32\USER\Template.uvprojx
Project File Date: 04/24/2022
Project File Date: 04/25/2022
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Keil_v5\ARM\ARMCC\Bin'
Build target 'Target 1'
compiling main.c...
main.c(83): warning: #42-D: operand types are incompatible ("char *" and "u8 *")
main.c(77): warning: #42-D: operand types are incompatible ("char *" and "u8 *")
target1 = strstr((const char*)USART_RX_BUF, "(") - USART_RX_BUF;
main.c(83): warning: #993-D: subtraction of pointer types "char *" and "u8 *" is nonstandard
main.c(77): warning: #993-D: subtraction of pointer types "char *" and "u8 *" is nonstandard
target1 = strstr((const char*)USART_RX_BUF, "(") - USART_RX_BUF;
main.c(84): warning: #42-D: operand types are incompatible ("char *" and "u8 *")
main.c(78): warning: #42-D: operand types are incompatible ("char *" and "u8 *")
target2 = strstr((const char*)USART_RX_BUF, ")") - USART_RX_BUF;
main.c(84): warning: #993-D: subtraction of pointer types "char *" and "u8 *" is nonstandard
main.c(78): warning: #993-D: subtraction of pointer types "char *" and "u8 *" is nonstandard
target2 = strstr((const char*)USART_RX_BUF, ")") - USART_RX_BUF;
main.c(99): warning: #181-D: argument is incompatible with corresponding format string conversion
userInfo.temp_value,userInfo.temp_threshold, userInfo.smog, userInfo.PoisonousGas, userInfo.smog_threshold, userInfo.PoisonousGas_threshold);
main.c(99): warning: #181-D: argument is incompatible with corresponding format string conversion
userInfo.temp_value,userInfo.temp_threshold, userInfo.smog, userInfo.PoisonousGas, userInfo.smog_threshold, userInfo.PoisonousGas_threshold);
main.c: 6 warnings, 0 errors
main.c: 4 warnings, 0 errors
linking...
Program Size: Code=15296 RO-data=372 RW-data=56 ZI-data=1344
Program Size: Code=16092 RO-data=376 RW-data=60 ZI-data=1348
FromELF: creating hex file...
"..\OBJ\Template.axf" - 0 Error(s), 6 Warning(s).
"..\OBJ\Template.axf" - 0 Error(s), 4 Warning(s).
<h2>Software Packages used:</h2>

2016
stm32/OBJ/Template.hex

File diff suppressed because it is too large Load Diff

1200
stm32/OBJ/Template.htm

File diff suppressed because it is too large Load Diff

1
stm32/OBJ/Template.lnp

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
"..\obj\misc.o"
"..\obj\stm32f10x_adc.o"
"..\obj\stm32f10x_tim.o"
"..\obj\stm32f10x_dma.o"
--library_type=microlib --strict --scatter "..\OBJ\Template.sct"
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers

45
stm32/OBJ/Template_Target 1.dep

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Dependencies for Project 'Template', Target 'Target 1': (DO NOT MODIFY !)
F (.\main.c)(0x62656020)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\main.o --omf_browse ..\obj\main.crf --depend ..\obj\main.d)
I (..\HARDWARE\LED\led.h)(0x625A668C)
F (.\main.c)(0x6266BEB9)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\main.o --omf_browse ..\obj\main.crf --depend ..\obj\main.d)
I (..\HARDWARE\LED\led.h)(0x6266AADD)
I (..\SYSTEM\sys\sys.h)(0x550F951B)
I (..\USER\stm32f10x.h)(0x5E83791A)
I (..\CORE\core_cm3.h)(0x4D523B58)
@ -36,7 +36,7 @@ I (D:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x599ECD2C) @@ -36,7 +36,7 @@ I (D:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x599ECD2C)
I (..\HARDWARE\ESP8266\wifi.h)(0x5E5164A3)
I (..\HARDWARE\DHT11\dht11.h)(0x62525B1C)
I (..\HARDWARE\LCD1602\lcd1602.h)(0x5D0BE688)
I (..\HARDWARE\ADC\adc.h)(0x5CA64F5A)
I (..\HARDWARE\ADC\adc.h)(0x6266B913)
I (..\HARDWARE\TIMER\timer.h)(0x532BBAA7)
I (D:\Keil_v5\ARM\ARMCC\include\string.h)(0x599ECD2C)
I (..\HARDWARE\DS18B20\ds18b20.h)(0x6255C13A)
@ -103,8 +103,8 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4) @@ -103,8 +103,8 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415E)
I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
F (..\HARDWARE\LED\led.c)(0x625A6681)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\led.o --omf_browse ..\obj\led.crf --depend ..\obj\led.d)
I (..\HARDWARE\LED\led.h)(0x625A668C)
F (..\HARDWARE\LED\led.c)(0x6266AAFB)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\led.o --omf_browse ..\obj\led.crf --depend ..\obj\led.d)
I (..\HARDWARE\LED\led.h)(0x6266AADD)
I (..\SYSTEM\sys\sys.h)(0x550F951B)
I (..\USER\stm32f10x.h)(0x5E83791A)
I (..\CORE\core_cm3.h)(0x4D523B58)
@ -231,8 +231,8 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4) @@ -231,8 +231,8 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
I (..\SYSTEM\delay\delay.h)(0x55CC2E59)
I (..\SYSTEM\sys\sys.h)(0x550F951B)
F (..\HARDWARE\ADC\adc.c)(0x62655FA7)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\adc.o --omf_browse ..\obj\adc.crf --depend ..\obj\adc.d)
I (..\HARDWARE\ADC\adc.h)(0x5CA64F5A)
F (..\HARDWARE\ADC\adc.c)(0x6266BABA)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\adc.o --omf_browse ..\obj\adc.crf --depend ..\obj\adc.d)
I (..\HARDWARE\ADC\adc.h)(0x6266B913)
I (..\SYSTEM\sys\sys.h)(0x550F951B)
I (..\USER\stm32f10x.h)(0x5E83791A)
I (..\CORE\core_cm3.h)(0x4D523B58)
@ -294,7 +294,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4) @@ -294,7 +294,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415E)
I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
I (..\HARDWARE\LED\led.h)(0x625A668C)
I (..\HARDWARE\LED\led.h)(0x6266AADD)
I (..\HARDWARE\ESP8266\wifi.h)(0x5E5164A3)
F (..\HARDWARE\DS18B20\ds18b20.c)(0x6255C148)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\ds18b20.o --omf_browse ..\obj\ds18b20.crf --depend ..\obj\ds18b20.d)
I (..\HARDWARE\DS18B20\ds18b20.h)(0x6255C13A)
@ -631,4 +631,33 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_spi.h)(0x4D783BB4) @@ -631,4 +631,33 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_spi.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415E)
I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
F (..\STM32F10x_FWLib\src\stm32f10x_dma.c)(0x4D783BB4)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\stm32f10x_dma.o --omf_browse ..\obj\stm32f10x_dma.crf --depend ..\obj\stm32f10x_dma.d)
I (..\STM32F10x_FWLib\inc\stm32f10x_dma.h)(0x4D783BB4)
I (..\USER\stm32f10x.h)(0x5E83791A)
I (..\CORE\core_cm3.h)(0x4D523B58)
I (D:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x599ECD2E)
I (..\USER\system_stm32f10x.h)(0x4D783CAA)
I (..\USER\stm32f10x_conf.h)(0x55B0C93D)
I (..\STM32F10x_FWLib\inc\stm32f10x_adc.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_bkp.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_can.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_cec.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_crc.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_dac.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_exti.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_flash.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_gpio.h)(0x50515FBA)
I (..\STM32F10x_FWLib\inc\stm32f10x_i2c.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_iwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_pwr.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_rcc.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_rtc.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_sdio.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_spi.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415E)
I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
F (..\README.TXT)(0x00000000)()

BIN
stm32/OBJ/adc.crf

Binary file not shown.

BIN
stm32/OBJ/adc.o

Binary file not shown.

BIN
stm32/OBJ/led.crf

Binary file not shown.

BIN
stm32/OBJ/led.o

Binary file not shown.

BIN
stm32/OBJ/main.crf

Binary file not shown.

BIN
stm32/OBJ/main.o

Binary file not shown.

BIN
stm32/OBJ/stm32f10x_dma.crf

Binary file not shown.

31
stm32/OBJ/stm32f10x_dma.d

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\src\stm32f10x_dma.c
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_dma.h
..\obj\stm32f10x_dma.o: ..\USER\stm32f10x.h
..\obj\stm32f10x_dma.o: ..\CORE\core_cm3.h
..\obj\stm32f10x_dma.o: D:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
..\obj\stm32f10x_dma.o: ..\USER\system_stm32f10x.h
..\obj\stm32f10x_dma.o: ..\USER\stm32f10x_conf.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_adc.h
..\obj\stm32f10x_dma.o: ..\USER\stm32f10x.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_bkp.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_cec.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_crc.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_dac.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_dma.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_exti.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_flash.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_i2c.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_iwdg.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_pwr.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_rtc.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_sdio.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_spi.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h
..\obj\stm32f10x_dma.o: ..\STM32F10x_FWLib\inc\misc.h

BIN
stm32/OBJ/stm32f10x_dma.o

Binary file not shown.

BIN
stm32/OBJ/timer.crf

Binary file not shown.

BIN
stm32/OBJ/timer.o

Binary file not shown.

36
stm32/USER/.vscode/c_cpp_properties.json vendored

@ -3,26 +3,26 @@ @@ -3,26 +3,26 @@
{
"name": "Target 1",
"includePath": [
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\LED",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\SYSTEM\\delay",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\SYSTEM\\sys",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\SYSTEM\\usart",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\USER",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\STM32F10x_FWLib\\inc",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\CORE",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\ESP8266",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\DHT11",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\LCD1602",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\ADC",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\TIMER",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\DS18B20",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\cJSON",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\DCmotor",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\DS1302",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\LED",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\SYSTEM\\delay",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\SYSTEM\\sys",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\SYSTEM\\usart",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\USER",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\STM32F10x_FWLib\\inc",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\CORE",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\ESP8266",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\DHT11",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\LCD1602",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\ADC",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\TIMER",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\DS18B20",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\cJSON",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\DCmotor",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\HARDWARE\\DS1302",
"D:\\Keil_v5\\ARM\\ARMCC\\include",
"D:\\Keil_v5\\ARM\\ARMCC\\include\\rw",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\STM32F10x_FWLib\\src",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32"
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32\\STM32F10x_FWLib\\src",
"e:\\项目\\兼职项目\\20220423-IndoorEnvSystem\\stm32"
],
"defines": [
"STM32F10X_MD",

2
stm32/USER/.vscode/keil-assistant.log vendored

@ -4,3 +4,5 @@ @@ -4,3 +4,5 @@
[info] Log at : 2022/4/17|12:55:19|GMT+0800
[info] Log at : 2022/4/25|22:10:40|GMT+0800

15
stm32/USER/.vscode/uv4.log vendored

@ -1,2 +1,13 @@ @@ -1,2 +1,13 @@
Load "..\\OBJ\\Template.axf"
Erase Done.Programming Done.Verify OK.Flash Load finished at 12:58:02
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Keil_v5\ARM\ARMCC\Bin'
Build target 'Target 1'
compiling adc.c...
linking...
..\OBJ\Template.axf: Error: L6218E: Undefined symbol DMA_Cmd (referred from adc.o).
..\OBJ\Template.axf: Error: L6218E: Undefined symbol DMA_DeInit (referred from adc.o).
..\OBJ\Template.axf: Error: L6218E: Undefined symbol DMA_Init (referred from adc.o).
Not enough information to list image symbols.
Not enough information to list load addresses in the image map.
Finished: 2 information, 0 warning and 3 error messages.
"..\OBJ\Template.axf" - 3 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:01

2
stm32/USER/.vscode/uv4.log.lock vendored

@ -1 +1 @@ @@ -1 +1 @@
2022/4/17 12:58:02
2022/4/25 23:07:52

1086
stm32/USER/Template.map

File diff suppressed because it is too large Load Diff

75
stm32/USER/Template.uvguix.QY

File diff suppressed because one or more lines are too long

16
stm32/USER/Template.uvoptx

@ -307,7 +307,7 @@ @@ -307,7 +307,7 @@
<GroupNumber>2</GroupNumber>
<FileNumber>8</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\HARDWARE\ADC\adc.c</PathWithFileName>
@ -507,6 +507,18 @@ @@ -507,6 +507,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>23</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\STM32F10x_FWLib\src\stm32f10x_dma.c</PathWithFileName>
<FilenameWithoutPath>stm32f10x_dma.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
@ -517,7 +529,7 @@ @@ -517,7 +529,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>23</FileNumber>
<FileNumber>24</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>

5
stm32/USER/Template.uvprojx

@ -511,6 +511,11 @@ @@ -511,6 +511,11 @@
<FileType>1</FileType>
<FilePath>..\STM32F10x_FWLib\src\stm32f10x_tim.c</FilePath>
</File>
<File>
<FileName>stm32f10x_dma.c</FileName>
<FileType>1</FileType>
<FilePath>..\STM32F10x_FWLib\src\stm32f10x_dma.c</FilePath>
</File>
</Files>
</Group>
<Group>

36
stm32/USER/main.c

@ -15,14 +15,13 @@ @@ -15,14 +15,13 @@
#include "motor.h"
// 用户数据的结构体
struct UserInfo{
u8 temp_value; // 温度
u8 temp_threshold;
float smog; // 烟雾
int PoisonousGas; // 有毒气体
float smog_threshold;
float PoisonousGas; // 有毒气体
int smog_threshold;
int PoisonousGas_threshold;
};
@ -34,12 +33,11 @@ struct UserInfo userInfo; @@ -34,12 +33,11 @@ struct UserInfo userInfo;
* @return {*}
*/
void Warning(){
BEEP = 1;
delay_ms(100);
BEEP = 0;
delay_ms(100);
BEEP = 1;
}
int getResult(){
int result = 0;
if(userInfo.temp_value > userInfo.temp_threshold) result = 1;
@ -57,15 +55,11 @@ int getResult(){ @@ -57,15 +55,11 @@ int getResult(){
void Data_Deal()
{
u16 adcx;
userInfo.temp_value = DS18B20_Get_Temp() / 10;
adcx = Get_Adc_Average(ADC_Channel_1,10);
userInfo.smog = (float)adcx*(3.3/4096);
adcx = Get_Adc_Average(ADC_Channel_0,10);
adcx = Get_ADC1_Value(ADC_Channel_9,20);
userInfo.smog = (float)adcx*(3.3/4096);
adcx = Get_ADC_Value(ADC_Channel_1,20);
userInfo.PoisonousGas = (float)adcx*(3.3/4096);
if(getResult()) Warning();
else BEEP = 0;
}
@ -93,9 +87,10 @@ void Receive_data(void) @@ -93,9 +87,10 @@ void Receive_data(void)
{
// 接受到数据
if(USART_RX_STA & 0x8000){
// 模式切换
if(strstr((const char*)USART_RX_BUF, "getInfo") != NULL){
printf("temp:%d, temp_threshold:%d,smog:%0.2f, PoisonousGas%0.2f, smog_threshold:%d, PoisonousGas_threshold:%d", \
printf("temp:%d, temp_threshold:%d,smog:%0.2f, PoisonousGas%0.2f, smog_threshold:%d, PoisonousGas_threshold:%d\r\n", \
userInfo.temp_value,userInfo.temp_threshold, userInfo.smog, userInfo.PoisonousGas, userInfo.smog_threshold, userInfo.PoisonousGas_threshold);
}
if(strstr((const char*)USART_RX_BUF, "setTemp") != NULL){
@ -112,6 +107,7 @@ void Receive_data(void) @@ -112,6 +107,7 @@ void Receive_data(void)
}
}
void Sys_Init(void)
{
delay_init();
@ -119,20 +115,24 @@ void Sys_Init(void) @@ -119,20 +115,24 @@ void Sys_Init(void)
uart_init(115200);
LED_Init();
DS18B20_Init();
Adc_Init();
ADCx_Init();
userInfo.temp_threshold = 28;
userInfo.smog_threshold = 28;
userInfo.PoisonousGas_threshold = 28;
}
int main(void)
{
Sys_Init();
BEEP = 1;
delay_ms(1000);
BEEP = 0;
delay_ms(1000);
BEEP = 1;
printf("start");
while(1)
{
Data_Deal();
Receive_data();
delay_ms(200);
}
}

Loading…
Cancel
Save