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