From 884f1fc3f159a86eb7f97211ab939ecfd2d8daeb Mon Sep 17 00:00:00 2001 From: Razvalyaev Date: Mon, 3 Mar 2025 13:09:20 +0300 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=BC=D0=B5=D0=BD=D1=8C=D1=88=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=20=D0=BC=D0=B0?= =?UTF-8?q?=D0=BA=D1=81=D0=B8=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BC=D0=BE=D0=B4=D0=B1=D0=B0=D1=81=20=D0=B4=D0=BE=2027=20?= =?UTF-8?q?=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=B8?= =?UTF-8?q?=20=D0=B2=D1=80=D0=BE=D0=B4=D0=B5=20=D0=BF=D0=BE=D0=BC=D0=B5?= =?UTF-8?q?=D1=89=D0=B0=D0=B5=D1=82=D1=81=D1=8F...=20=D0=BD=D0=BE=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=B4=D0=BE=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=81=20=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82?= =?UTF-8?q?=D1=83=D1=80=D0=BE=D0=B9=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=BC=D0=BE=D0=B4=D0=B1=D0=B0=D1=81=20=D0=BF=D0=BE=D0=B4=20?= =?UTF-8?q?=D1=8D=D1=82=D0=B8=20=D0=B4=D0=B0=D1=82=D1=87=D0=B8=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Modbus/modbus.h | 2 +- Core/Src/main.c | 6 ++-- Core/Src/py32f002b_it.c | 32 +++++++++--------- MDK-ARM/PY32Dallas.uvprojx | 69 -------------------------------------- 4 files changed, 20 insertions(+), 89 deletions(-) diff --git a/Core/Modbus/modbus.h b/Core/Modbus/modbus.h index d23e8a9..c0e0a93 100644 --- a/Core/Modbus/modbus.h +++ b/Core/Modbus/modbus.h @@ -37,7 +37,7 @@ #define Addr_SIZE 2 ///< size of (Addr) #define Qnt_SIZE 2 ///< size of (Qnt) #define ByteCnt_SIZE 1 ///< size of (ByteCnt) -#define DATA_SIZE 125 ///< maximum number of data: DWORD (NOT MESSAGE SIZE) +#define DATA_SIZE 27 ///< maximum number of data: DWORD (NOT MESSAGE SIZE) #define CRC_SIZE 2 ///< size of (MB_CRC) in bytes /** @brief Size of whole message */ diff --git a/Core/Src/main.c b/Core/Src/main.c index caf6fef..ad5f059 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -54,11 +54,11 @@ int main(void) HAL_TIM_Base_Start(&htim1); MX_USART1_UART_Init(); -// MODBUS_FirstInit(); -// RS_Receive_IT(&hmodbus1, &MODBUS_MSG); + MODBUS_FirstInit(); + RS_Receive_IT(&hmodbus1, &MODBUS_MSG); - PCHSens_FirstInit(); +// PCHSens_FirstInit(); /* infinite loop */ while (1) { diff --git a/Core/Src/py32f002b_it.c b/Core/Src/py32f002b_it.c index b373ee9..08dbf89 100644 --- a/Core/Src/py32f002b_it.c +++ b/Core/Src/py32f002b_it.c @@ -75,23 +75,23 @@ void SysTick_Handler(void) HAL_IncTick(); } -//#include "rs_message.h" -///** -// * @brief This function handles USART1. -// */ -//void USART1_IRQHandler(void) -//{ -// RS_UART_Handler(&hmodbus1); -//} +#include "rs_message.h" +/** + * @brief This function handles USART1. + */ +void USART1_IRQHandler(void) +{ + RS_UART_Handler(&hmodbus1); +} -///** -// * @brief This function handles TIM2 global interrupt. -// */ -//void TIM14_IRQHandler(void) -//{ -// /* USER CODE BEGIN TIM2_IRQn 0 */ -// RS_TIM_Handler(&hmodbus1); -//} +/** + * @brief This function handles TIM2 global interrupt. + */ +void TIM14_IRQHandler(void) +{ + /* USER CODE BEGIN TIM2_IRQn 0 */ + RS_TIM_Handler(&hmodbus1); +} /******************************************************************************/ /* PY32F002B Peripheral Interrupt Handlers */ /* Add here the Interrupt Handlers for the used peripherals. */ diff --git a/MDK-ARM/PY32Dallas.uvprojx b/MDK-ARM/PY32Dallas.uvprojx index 972e87b..8e69808 100644 --- a/MDK-ARM/PY32Dallas.uvprojx +++ b/MDK-ARM/PY32Dallas.uvprojx @@ -549,75 +549,6 @@ Modbus - - - 0 - 0 - 0 - 0 - 0 - 0 - 2 - 2 - 2 - 2 - 11 - - - 1 - - - - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - - - - - - - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - - - - - - - - - crc_algs.c