diff --git a/Core/Dallas/dallas_tools.c b/Core/Dallas/dallas_tools.c
index af66772..5c9cb80 100644
--- a/Core/Dallas/dallas_tools.c
+++ b/Core/Dallas/dallas_tools.c
@@ -459,7 +459,9 @@ HAL_StatusTypeDef Dallas_ReadTemperature(DALLAS_SensorHandleTypeDef *sensor)
/* */
result = Dallas_IsConnected(sensor);
if (result != HAL_OK)
+ {
return result;
+ }
result = DS18B20_CalcTemperature(sensor->hdallas->onewire, (uint8_t *)&sensor->sensROM, (uint8_t *)&sensor->hdallas->scratchpad, &sensor->temperature);
@@ -495,7 +497,7 @@ HAL_StatusTypeDef Dallas_IsConnected(DALLAS_SensorHandleTypeDef *sensor)
}
else
{
-
+ sensor->temperature = 0;
if(sensor->isConnected == 1)
{
sensor->f.disconnect_cnt++;
diff --git a/Core/Dallas/ds18b20_driver.h b/Core/Dallas/ds18b20_driver.h
index 96e3831..42d42db 100644
--- a/Core/Dallas/ds18b20_driver.h
+++ b/Core/Dallas/ds18b20_driver.h
@@ -26,7 +26,7 @@
#define DS_GPIO_Port GPIOB
/* Data Structure ------------------------------------------------------------*/
-#define DS18B20_DEVICE_AMOUNT 27
+#define DS18B20_DEVICE_AMOUNT 30
/* Register ------------------------------------------------------------------*/
#define DS18B20_CMD_CONVERT 0x44
diff --git a/Core/Dallas/ow_port.c b/Core/Dallas/ow_port.c
index 7e29074..a40139b 100644
--- a/Core/Dallas/ow_port.c
+++ b/Core/Dallas/ow_port.c
@@ -119,8 +119,8 @@ void OneWire_Delay_uw(uint32_t us)
{
// start = htim1.Instance->CNT;
// end = start + us*tim_1us_period;
- htim1.Instance->CNT = 0;
+ TIM1->CNT = 0;
end = us*tim_1us_period;
- while(htim1.Instance->CNT < end) {};
+ while(TIM1->CNT < end) {};
}
\ No newline at end of file
diff --git a/Core/Dallas/pch_sensors.c b/Core/Dallas/pch_sensors.c
index ac620ae..9337152 100644
--- a/Core/Dallas/pch_sensors.c
+++ b/Core/Dallas/pch_sensors.c
@@ -8,6 +8,7 @@
/* Includes ----------------------------------------------------------------*/
#include "pch_sensors.h"
+#include "modbus_data.h"
PCHSens_DallasBusHandle DallasBus;
PCHSens_SensorActionsTypeDef action;
@@ -111,8 +112,7 @@ HAL_StatusTypeDef PCHSens_InitModule(DALLAS_HandleTypeDef *hdallas, PCHSens_Modu
PCHSens_AddSensor(hdallas, &module->sens1);
module->sens2.Location.all = module->refLocation.all;
- module->sens2.Location.param.Location = 1;
-
+ module->sens2.Location.param.Location = 1;
PCHSens_AddSensor(hdallas, &module->sens2);
module->sens3.Location.all = module->refLocation.all;
@@ -126,13 +126,13 @@ HAL_StatusTypeDef PCHSens_InitModule(DALLAS_HandleTypeDef *hdallas, PCHSens_Modu
}
-HAL_StatusTypeDef PCHSens_ReadTemperature(PCHSens_ModuleTypeDef *module)
+HAL_StatusTypeDef PCHSens_ModuleHandleAction(PCHSens_ModuleTypeDef* module)
{
HAL_StatusTypeDef result;
if(module == NULL)
return HAL_ERROR;
-
+
result = PCHSens_SensorHandleActions(module->hdallas, &module->sens1);
result = PCHSens_SensorHandleActions(module->hdallas, &module->sens2);
result = PCHSens_SensorHandleActions(module->hdallas, &module->sens3);
@@ -140,15 +140,25 @@ HAL_StatusTypeDef PCHSens_ReadTemperature(PCHSens_ModuleTypeDef *module)
return result;
}
-
HAL_StatusTypeDef PCHSens_Covert(PCHSens_DallasBusHandle *hbus)
{
return Dallas_StartConvertTAll(hbus->hdallas, DALLAS_WAIT_BUS, 0);
}
+HAL_StatusTypeDef PCHSens_ReadTemperature(PCHSens_SensorTypeDef* sensor)
+{
+ HAL_StatusTypeDef result;
+
+ if(sensor == NULL)
+ return HAL_ERROR;
+
+ result = Dallas_ReadTemperature(&sensor->sens);
+ PCHSens_StoreToModbus(sensor);
+
+ return result;
+}
HAL_StatusTypeDef PCHSens_CheckSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor)
{
HAL_StatusTypeDef result;
- PCHSens_LocationTypeDef initlocation;
unsigned unknow_sensors_flag = 0;
if(sensor == NULL)
@@ -158,7 +168,6 @@ HAL_StatusTypeDef PCHSens_CheckSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_Sen
if((sensor->sens.isLost == 1))
{
- initlocation.param.Location = 0;
if(Dallas_ReplaceLostedSensor(&sensor->sens) != HAL_OK)
{
sensor->not_found = 1;
@@ -249,7 +258,7 @@ HAL_StatusTypeDef PCHSens_SensorHandleActions(DALLAS_HandleTypeDef *hdallas, PCH
if(action.read != NULL)
{
- result = Dallas_ReadTemperature(&sensor->sens);
+ result = PCHSens_ReadTemperature(sensor);
if(result != HAL_OK)
PCHSens_CheckSensor(hdallas, sensor);
}
@@ -275,30 +284,30 @@ void PCHSens_FirstInit(void)
DallasBus.hdallas = &hdallas1;
DallasBus.hdallas->onewire = &OW;
+
+
+
PCHSens_InitModule(&hdallas1, &module1, REG_PCH_NUMB_11|REG_PCH_DIODE_NUMB_1);
+ PCHSens_InitModule(&hdallas1, &module2, REG_PCH_NUMB_12|REG_PCH_DIODE_NUMB_1);
+ PCHSens_InitModule(&hdallas1, &module3, REG_PCH_NUMB_13|REG_PCH_DIODE_NUMB_1);
+ PCHSens_InitModule(&hdallas1, &module4, REG_PCH_NUMB_21|REG_PCH_DIODE_NUMB_1);
+ PCHSens_InitModule(&hdallas1, &module5, REG_PCH_NUMB_22|REG_PCH_DIODE_NUMB_1);
+ PCHSens_InitModule(&hdallas1, &module6, REG_PCH_NUMB_23|REG_PCH_DIODE_NUMB_1);
PCHSens_FindUnknownSensors(&DallasBus);
-// PCHSens_DefineUnknownSensor(&UnknownSensors, NULL);
-// Dallas_SensorInitByInd(&OW, &AllSens.outdoor, 0);
-// Dallas_SensorInitByInd(&OW, &AllSens.indoor, 2);
-// Dallas_SensorInitByInd(&OW, &AllSens.bathroom, 1);
-// Dallas_SensorInitByInd(&OW, &AllSens.kitchen, 3);
-// Dallas_SensorInitByInd(&OW, &AllSens.big_room, 4);
-// Dallas_SensorInitByInd(&OW, &AllSens.small_room, 5);
-// Dallas_SensorInitByInd(&OW, &AllSens.living_room, 6);
-// Dallas_SensorInitByInd(&OW, &AllSens.basement, 7);
-//
-// uint8_t mask = DALLAS_USER_BYTE_ALL;
-// Dallas_WriteUserBytes(&AllSens.outdoor, 1, NULL, mask);
-// Dallas_WriteUserBytes(&AllSens.indoor, 2, NULL, mask);
-// Dallas_WriteUserBytes(&AllSens.bathroom, 3, NULL, mask);
-// Dallas_WriteUserBytes(&AllSens.kitchen, 4, NULL, mask);
-// Dallas_WriteUserBytes(&AllSens.big_room, 5, NULL, mask);
-// Dallas_WriteUserBytes(&AllSens.small_room, 6, NULL, mask);
-// Dallas_WriteUserBytes(&AllSens.living_room, 7, NULL, mask);
-// Dallas_WriteUserBytes(&AllSens.basement, 8, NULL, mask);
+}
+
+
+void PCHSens_StoreToModbus(PCHSens_SensorTypeDef *sensor)
+{
+ uint8_t pch_numb = (sensor->Location.param.PCHdig1 - 1)*3 + (sensor->Location.param.PCHdig2 - 1);
+ uint8_t location = (sensor->Location.param.Location);
+
+ uint8_t mb_location = pch_numb*4 + location;
+
+ if (mb_location < DS18B20_DEVICE_AMOUNT)
+ MB_DATA.InRegs.SensTemperature[mb_location] = sensor->sens.temperature*100;
}
-
diff --git a/Core/Dallas/pch_sensors.h b/Core/Dallas/pch_sensors.h
index e4e91af..e639a93 100644
--- a/Core/Dallas/pch_sensors.h
+++ b/Core/Dallas/pch_sensors.h
@@ -163,11 +163,13 @@ extern PCHSens_DallasBusHandle DallasBus;
HAL_StatusTypeDef PCHSens_InitNewSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor, uint64_t ROM);
HAL_StatusTypeDef PCHSens_AddSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor);
HAL_StatusTypeDef PCHSens_InitModule(DALLAS_HandleTypeDef *hdallas, PCHSens_ModuleTypeDef* module, uint16_t param);
-HAL_StatusTypeDef PCHSens_ReadTemperature(PCHSens_ModuleTypeDef *module);
+HAL_StatusTypeDef PCHSens_ModuleHandleAction(PCHSens_ModuleTypeDef* module);
+HAL_StatusTypeDef PCHSens_ReadTemperature(PCHSens_SensorTypeDef* sensor);
HAL_StatusTypeDef PCHSens_Covert(PCHSens_DallasBusHandle *hbus);
HAL_StatusTypeDef PCHSens_CheckSensor(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef* sensor);
HAL_StatusTypeDef PCHSens_FindUnknownSensors(PCHSens_DallasBusHandle *hbus);
HAL_StatusTypeDef PCHSens_DefineUnknownSensor(PCHSens_DallasBusHandle *hbus, PCHSens_SensorTypeDef *sensor);
HAL_StatusTypeDef PCHSens_SensorHandleActions(DALLAS_HandleTypeDef *hdallas, PCHSens_SensorTypeDef *sensor);
void PCHSens_FirstInit(void);
+void PCHSens_StoreToModbus(PCHSens_SensorTypeDef *sensor);
#endif // #ifndef PCH_SENSORS_H
\ No newline at end of file
diff --git a/Core/Inc/tim.h b/Core/Inc/tim.h
index 14edb1c..f7f1418 100644
--- a/Core/Inc/tim.h
+++ b/Core/Inc/tim.h
@@ -39,7 +39,8 @@ extern TIM_HandleTypeDef htim14;
/* USER CODE END Private defines */
-void MX_TIM1_Init(void);
+void MX_TIM1_Init(void);
+void MX_TIM14_Init(void);
/* USER CODE BEGIN Prototypes */
diff --git a/Core/Modbus/crc_algs.c b/Core/Modbus/crc_algs.c
index d5b4d48..0abdb97 100644
--- a/Core/Modbus/crc_algs.c
+++ b/Core/Modbus/crc_algs.c
@@ -8,10 +8,6 @@ uint32_t CRC_ref;
//uint16_t CRC_ref;
-// left this global for debug
-uint8_t uchCRCHi = 0xFF;
-uint8_t uchCRCLo = 0xFF;
-unsigned uIndex;
/*Table of CRC values for high order byte*/
const unsigned char auchCRCHi[]=
@@ -55,8 +51,9 @@ const char auchCRCLo[] =
};
uint16_t crc16(uint8_t *data, uint32_t data_size)
{
- uchCRCHi = 0xFF;
- uchCRCLo = 0xFF;
+ uint8_t uchCRCHi = 0xFF;
+ uint8_t uchCRCLo = 0xFF;
+ unsigned uIndex;
/* CRC Generation Function */
while( data_size--) /* pass through message buffer */
{
diff --git a/Core/Modbus/modbus.c b/Core/Modbus/modbus.c
index 73de147..6ba7edb 100644
--- a/Core/Modbus/modbus.c
+++ b/Core/Modbus/modbus.c
@@ -130,6 +130,7 @@ void MODBUS_FirstInit(void)
hmodbus1.ID = MODBUS_DEVICE_ID;
hmodbus1.sRS_Mode = SLAVE_ALWAYS_WAIT;
hmodbus1.sRS_RX_Size_Mode = RS_RX_Size_NotConst;
+ hmodbus1.sRS_Timeout = 1;
// INIT
#ifdef INCLUDE_GENERAL_PERIPH_LIBS
@@ -263,8 +264,8 @@ MB_ExceptionTypeDef MB_DefineRegistersAddress(uint16_t **pRegs, uint16_t Addr, u
if(RegisterType == RegisterType_Holding)
{
- // Устаки для тестера
- if(MB_Check_Address_For_Arr(Addr, Qnt, R_SETTINGS_ADDR, R_SETTINGS_QNT) == NO_ERRORS)
+ // Параметры для инициализации датчика
+ if(MB_Check_Address_For_Arr(Addr, Qnt, R_SENS_INIT_ADDR, R_SENS_INIT_QNT) == NO_ERRORS)
{
*pRegs = MB_Set_Register_Ptr(&MB_DATA.HoldRegs, Addr); // начало регистров хранения/входных
}
@@ -276,8 +277,13 @@ MB_ExceptionTypeDef MB_DefineRegistersAddress(uint16_t **pRegs, uint16_t Addr, u
}
else if(RegisterType == RegisterType_Input)
{
- // Измеренные параметры диода
- if(MB_Check_Address_For_Arr(Addr, Qnt, R_MEASURED_ADDR, R_MEASURED_QNT) == NO_ERRORS)
+ // Измеренные температуры
+ if(MB_Check_Address_For_Arr(Addr, Qnt, R_TEMPERATURE_ADDR, R_TEMPERATURE_QNT) == NO_ERRORS)
+ {
+ *pRegs = MB_Set_Register_Ptr(&MB_DATA.InRegs, Addr); // начало регистров хранения/входных
+ }
+ // Параметры датчика
+ else if(MB_Check_Address_For_Arr(Addr, Qnt, R_SENS_PARAMS_ADDR, R_SENS_PARAMS_QNT) == NO_ERRORS)
{
*pRegs = MB_Set_Register_Ptr(&MB_DATA.InRegs, Addr); // начало регистров хранения/входных
}
@@ -314,11 +320,12 @@ MB_ExceptionTypeDef MB_DefineCoilsAddress(uint16_t **pCoils, uint16_t Addr, uint
return ILLEGAL_DATA_VALUE; // return exception code
}
- // tester settings coils
- if(MB_Check_Address_For_Arr(Addr, Qnt, C_SETTINGS_ADDR, C_SETTINGS_QNT) == NO_ERRORS)
+ // Флаги всей шины датчиков
+ if(MB_Check_Address_For_Arr(Addr, Qnt, C_FLAGS_ADDR, C_FLAGS_QNT) == NO_ERRORS)
{
*pCoils = MB_Set_Coil_Reg_Ptr(&MB_DATA.Coils, Addr);
- }// tester control coils
+ }
+ // Управление датчиками
else if(MB_Check_Address_For_Arr(Addr, Qnt, C_CONTROL_ADDR, C_CONTROL_QNT) == NO_ERRORS)
{
*pCoils = MB_Set_Coil_Reg_Ptr(&MB_DATA.Coils, Addr);
diff --git a/Core/Modbus/modbus_data.h b/Core/Modbus/modbus_data.h
index 22a07b2..0ba0942 100644
--- a/Core/Modbus/modbus_data.h
+++ b/Core/Modbus/modbus_data.h
@@ -31,15 +31,29 @@
@endverbatim
* @{
*/
-
-
+
+//typedef struct
+//{
+// uint16_t ROM[4];
+// uint16_t Location;
+// uint16_t Resolution;
+// uint16_t Losted;
+//}MB_SensorResponseTypeDef;
+
+typedef struct
+{
+ uint16_t Location;
+ uint16_t ROM[4];
+ uint16_t Resolution;
+ uint16_t Enable;
+}MB_SensorParamsTypeDef;
/**
* @brief Регистры хранения
*/
typedef struct //MB_DataInRegsTypeDef
{
- uint16_t SensTemperature[DS18B20_DEVICE_AMOUNT];
- uint16_t Resolution;
+ uint16_t SensTemperature[DS18B20_DEVICE_AMOUNT];
+ MB_SensorParamsTypeDef Response;
}MB_DataInRegsTypeDef;
@@ -48,27 +62,19 @@ typedef struct //MB_DataInRegsTypeDef
*/
typedef struct //MB_DataInRegsTypeDef
{
- uint16_t TimeForForward;
- uint16_t TimeForReverse;
- uint16_t TimeBeforeTest;
- uint16_t TimeDeadtime;
- uint16_t TimeBeforePeak;
-
- uint16_t Adc_PulseWidth;
- uint16_t Adc_PulseSign;
- uint16_t Adc_CalibrValue;
- uint16_t Adc_ZeroValue;
- uint16_t Adc_U_Calibr;
+ MB_SensorParamsTypeDef InitStruct;
}MB_DataHoldRegsTypeDef;
// DEFINES FOR INPUT REGISTERS ARRAYS
-#define R_MEASURED_ADDR 0
-#define R_MEASURED_QNT 2
+#define R_TEMPERATURE_ADDR (0)
+#define R_TEMPERATURE_QNT (DS18B20_DEVICE_AMOUNT)
+#define R_SENS_PARAMS_ADDR (DS18B20_DEVICE_AMOUNT+1)
+#define R_SENS_PARAMS_QNT (sizeof(MB_SensorParamsTypeDef)/sizeof(uint16_t))
// DEFINES FOR HOLDING REGISTERS ARRAYS
-#define R_SETTINGS_ADDR 0
-#define R_SETTINGS_QNT 10
+#define R_SENS_INIT_ADDR (0)
+#define R_SENS_INIT_QNT (sizeof(MB_SensorParamsTypeDef)/sizeof(uint16_t))
// DEFINES FOR REGISTERS LOCAL ADDRESSES
@@ -102,31 +108,23 @@ typedef struct //MB_DataInRegsTypeDef
typedef struct //MB_DataCoilsTypeDef
{
/* reg 1 - control */
- unsigned ForwardTest:1;
- unsigned ReverseTest:1;
- unsigned StartTest:1;
- unsigned KeyForwardHiTest:1;
- unsigned KeyForwardLoTest:1;
- unsigned KeyReverseHiTest:1;
- unsigned KeyReverseLoTest:1;
+ unsigned RunConvertions:1;
+ unsigned InitSensor:1;
+ unsigned DenitSensor:1;
- unsigned reserved:9;
+ unsigned reserved:13;
/* reg 2 - settings */
- unsigned msTimeForForward_enable:1;
- unsigned msTimeForReverse_enable:1;
- unsigned msTimeBeforeTest_enable:1;
- unsigned msTimeDeadtime_enable:1;
- unsigned msTimeBeforePeak_enable:1;
- unsigned reserved2:11;
+ unsigned ConvertionDone:1;
+ unsigned LostedSensors:1;
}MB_DataCoilsTypeDef;
// DEFINES FOR COIL ARRAYS
#define C_CONTROL_ADDR 0
-#define C_CONTROL_QNT 7
+#define C_CONTROL_QNT 3
-#define C_SETTINGS_ADDR 16
-#define C_SETTINGS_QNT 5
+#define C_FLAGS_ADDR 16
+#define C_FLAGS_QNT 5
/** MODBUS_DATA_COILS_DEFINES
* @}
diff --git a/Core/Src/main.c b/Core/Src/main.c
index d276089..4e0832b 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -51,7 +51,7 @@ int main(void)
MX_GPIO_Init();
MX_TIM1_Init();
- HAL_TIM_Base_Start(&htim1);
+ MX_TIM14_Init();
MX_USART1_UART_Init();
MODBUS_FirstInit();
@@ -64,14 +64,15 @@ int main(void)
{
GPIOA->ODR ^= GPIO_LED_2;
+
PCHSens_Covert(&DallasBus);
- PCHSens_ReadTemperature(&module1);
-// PCHSens_ReadTemperature(&module2);
-// PCHSens_ReadTemperature(&module3);
-// PCHSens_ReadTemperature(&module4);
-// PCHSens_ReadTemperature(&module5);
-// PCHSens_ReadTemperature(&module6);
+ PCHSens_ModuleHandleAction(&module1);
+ PCHSens_ModuleHandleAction(&module2);
+ PCHSens_ModuleHandleAction(&module3);
+ PCHSens_ModuleHandleAction(&module4);
+ PCHSens_ModuleHandleAction(&module5);
+ PCHSens_ModuleHandleAction(&module6);
}
}
diff --git a/Core/Src/tim.c b/Core/Src/tim.c
index 21c69fb..f0bccd8 100644
--- a/Core/Src/tim.c
+++ b/Core/Src/tim.c
@@ -24,52 +24,81 @@
/* USER CODE END 0 */
-TIM_HandleTypeDef htim1;
+//TIM_HandleTypeDef htim1;
TIM_HandleTypeDef htim14;
/* TIM3 init function */
void MX_TIM1_Init(void)
{
+ // TIM1
+ __HAL_RCC_TIM1_CLK_ENABLE();
+
+ // (Prescaler)
+ TIM1->PSC = 0;
+
+ //
+ TIM1->CR1 &= ~TIM_CR1_DIR;
+
+ // (ARR - Auto-reload register)
+ TIM1->ARR = 0xFFFFFFFF;
+
+ // (Clock Division)
+ TIM1->CR1 &= ~TIM_CR1_CKD;
+
+ //
+ TIM1->CR1 &= ~TIM_CR1_ARPE;
+
+ //
+ TIM1->SMCR &= ~TIM_SMCR_SMS;
+
+ // (TRGO)
+ TIM1->CR2 &= ~TIM_CR2_MMS;
+
+ // Master/Slave
+ TIM1->SMCR &= ~TIM_SMCR_MSM;
+
+ //
+ TIM1->CR1 |= TIM_CR1_CEN;
- /* USER CODE BEGIN TIM3_Init 0 */
+// /* USER CODE BEGIN TIM3_Init 0 */
- /* USER CODE END TIM3_Init 0 */
+// /* USER CODE END TIM3_Init 0 */
- TIM_ClockConfigTypeDef sClockSourceConfig = {0};
- TIM_MasterConfigTypeDef sMasterConfig = {0};
+// TIM_ClockConfigTypeDef sClockSourceConfig = {0};
+// TIM_MasterConfigTypeDef sMasterConfig = {0};
- /* USER CODE BEGIN TIM3_Init 1 */
- HAL_RCC_GetPCLK1Freq();
- /* USER CODE END TIM3_Init 1 */
- htim1.Instance = TIM1;
- htim1.Init.Prescaler = 0;
- htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
- htim1.Init.Period = 0xFFFFFFFF;
- htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
- htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
- if (HAL_TIM_Base_Init(&htim1) != HAL_OK)
- {
- Error_Handler();
- }
- sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
- if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK)
- {
- Error_Handler();
- }
- sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
- sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
- if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK)
- {
- Error_Handler();
- }
- /* USER CODE BEGIN TIM3_Init 2 */
+// /* USER CODE BEGIN TIM3_Init 1 */
+// HAL_RCC_GetPCLK1Freq();
+// /* USER CODE END TIM3_Init 1 */
+// htim1.Instance = TIM1;
+// htim1.Init.Prescaler = 0;
+// htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
+// htim1.Init.Period = 0xFFFFFFFF;
+// htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
+// htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
+// if (HAL_TIM_Base_Init(&htim1) != HAL_OK)
+// {
+// Error_Handler();
+// }
+// sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
+// if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK)
+// {
+// Error_Handler();
+// }
+// sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
+// sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
+// if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK)
+// {
+// Error_Handler();
+// }
+// /* USER CODE BEGIN TIM3_Init 2 */
- /* USER CODE END TIM3_Init 2 */
+// /* USER CODE END TIM3_Init 2 */
}
/* TIM2 init function */
-void MX_TIM2_Init(void)
+void MX_TIM14_Init(void)
{
/* USER CODE BEGIN TIM2_Init 0 */
diff --git a/Core/Src/usart.c b/Core/Src/usart.c
index d46ae86..a517a02 100644
--- a/Core/Src/usart.c
+++ b/Core/Src/usart.c
@@ -92,30 +92,6 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
}
}
-void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
-{
-
- if(uartHandle->Instance==USART1)
- {
- /* USER CODE BEGIN USART1_MspDeInit 0 */
-
- /* USER CODE END USART1_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_USART1_CLK_DISABLE();
-
- /**USART1 GPIO Configuration
- PA9 ------> USART1_TX
- PA10 ------> USART1_RX
- */
- HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
-
- /* USART1 interrupt Deinit */
- HAL_NVIC_DisableIRQ(USART1_IRQn);
- /* USER CODE BEGIN USART1_MspDeInit 1 */
-
- /* USER CODE END USART1_MspDeInit 1 */
- }
-}
/* USER CODE BEGIN 1 */
diff --git a/MDK-ARM/PY32Dallas.uvoptx b/MDK-ARM/PY32Dallas.uvoptx
index 076fc84..67e1608 100644
--- a/MDK-ARM/PY32Dallas.uvoptx
+++ b/MDK-ARM/PY32Dallas.uvoptx
@@ -153,24 +153,7 @@
(105=-1,-1,-1,-1,0)
-
-
- 0
- 0
- 152
- 1
- 134221440
- 0
- 0
- 0
- 0
- 0
- 1
- ..\Core\Dallas\dallas_tools.c
-
- \\Project\../Core/Dallas/dallas_tools.c\152
-
-
+
0
@@ -185,7 +168,7 @@
2
1
- \\Project\../Core/Dallas/ds18b20_driver.c\OW.RomByte[7]
+ module2
3
@@ -240,7 +223,12 @@
13
1
- hmodbus1
+ hmodbus1,0x0A
+
+
+ 14
+ 1
+ RS_Buffer,0x10
@@ -262,7 +250,12 @@
3
2
- MB_DATA
+ MB_DATA,0x0A
+
+
+ 4
+ 2
+ hmodbus1
@@ -456,8 +449,8 @@
0
0
0
- ..\Core\Src\py32f002b_hal_msp.c
- py32f002b_hal_msp.c
+ ..\Core\Src\py32f002b_it.c
+ py32f002b_it.c
0
0
@@ -468,8 +461,8 @@
0
0
0
- ..\Core\Src\py32f002b_it.c
- py32f002b_it.c
+ ..\Core\Src\py32f002b_hal_msp.c
+ py32f002b_hal_msp.c
0
0
diff --git a/MDK-ARM/PY32Dallas.uvprojx b/MDK-ARM/PY32Dallas.uvprojx
index 4444fad..350f911 100644
--- a/MDK-ARM/PY32Dallas.uvprojx
+++ b/MDK-ARM/PY32Dallas.uvprojx
@@ -435,16 +435,16 @@
1
..\Core\Src\usart.c
-
- py32f002b_hal_msp.c
- 1
- ..\Core\Src\py32f002b_hal_msp.c
-
py32f002b_it.c
1
..\Core\Src\py32f002b_it.c
+
+ py32f002b_hal_msp.c
+ 1
+ ..\Core\Src\py32f002b_hal_msp.c
+
diff --git a/ds18b20_locations.xlsx b/ds18b20_locations.xlsx
new file mode 100644
index 0000000..6b591fa
Binary files /dev/null and b/ds18b20_locations.xlsx differ