Skip to content

Commit

Permalink
90% MODBUS готов.
Browse files Browse the repository at this point in the history
 1.По запросу от 104 посылает запрос в MODBUS
 2.Принимает ответ, правда не используя полный буфер ДМА. а только 1
байт. нужно настроить на всю длину пакета.
 3.Проверяет CRC и свой адрес.
 4.Уходим в функцию обработки данных(в таске MODBUS).
 ps. Осталось передать эти данные назад в таск IEC104 и переложить их в
функцию ответа в 104
  • Loading branch information
sagok committed Sep 24, 2015
1 parent f80a2e2 commit 4897ae6
Show file tree
Hide file tree
Showing 27 changed files with 1,117 additions and 1,015 deletions.
14 changes: 10 additions & 4 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS/portable/GCC/ARM_CM4F}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/SmI_IEC104/STM32F4xx_HAL_Driver/Inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/SmI_IEC104/FreeModbus}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeModbus}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeModbus/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeModbus/rtu}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeModbus/functions}&quot;"/>
Expand Down Expand Up @@ -92,8 +92,11 @@
<tool id="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.printsize.debug.1976894999" name="ARM Sourcery Windows GNU Print Size" superClass="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.printsize.debug"/>
</toolChain>
</folderInfo>
<fileInfo id="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.debug.821813876.225302007" name="stm32f4xx_hal_tim_ex.c" rcbsApplicability="disable" resourcePath="STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c" toolsToInvoke="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.c.compiler.debug.100445529.1968619009">
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.c.compiler.debug.100445529.1968619009" name="ARM Sourcery Windows GCC C Compiler" superClass="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.c.compiler.debug.100445529"/>
</fileInfo>
<sourceEntries>
<entry excluding="STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_fmpi2c.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_fmpi2c_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nor.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nand.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_irda.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cec.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spdifrx.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_smartcard.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c|Doc|FreeRTOS/portable/GCC/ARM_CM3" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_fmpi2c.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_fmpi2c_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nor.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nand.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_irda.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cec.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spdifrx.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_smartcard.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c|Doc|FreeRTOS/portable/GCC/ARM_CM3" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
Expand Down Expand Up @@ -136,7 +139,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS/portable/GCC/ARM_CM4F}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/SmI_IEC104/STM32F4xx_HAL_Driver/Inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/SmI_IEC104/FreeModbus}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeModbus}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeModbus/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeModbus/rtu}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeModbus/functions}&quot;"/>
Expand Down Expand Up @@ -195,8 +198,11 @@
<tool id="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.printsize.release.882450538" name="ARM Sourcery Windows GNU Print Size" superClass="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.printsize.release"/>
</toolChain>
</folderInfo>
<fileInfo id="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.release.1983890987.1749237222" name="stm32f4xx_hal_tim_ex.c" rcbsApplicability="disable" resourcePath="STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c" toolsToInvoke="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.c.compiler.release.1623371815.1411068221">
<tool id="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.c.compiler.release.1623371815.1411068221" name="ARM Sourcery Windows GCC C Compiler" superClass="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.elf.c.compiler.release.1623371815"/>
</fileInfo>
<sourceEntries>
<entry excluding="STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_fmpi2c.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_fmpi2c_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nor.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nand.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_irda.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cec.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spdifrx.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_smartcard.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c|Doc|FreeRTOS/portable/GCC/ARM_CM3" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_fmpi2c.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_fmpi2c_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nor.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nand.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_irda.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cec.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spdifrx.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_smartcard.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c|STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c|Doc|FreeRTOS/portable/GCC/ARM_CM3" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
Expand Down
40 changes: 33 additions & 7 deletions ConfBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ typedef enum
LED1 = 0,
LED2 = 1,
LED3 = 2,
LED4 = 3
}Led_TypeDef;
LED4 = 3,
RS485_1_DEn = 4,
RS485_2_DEn = 5,
MODBUS_DEn = 6,
}Port_TypeDef;

// ----------------------------------------------------------------------------------------------------
#define PORTn 7

#define LEDn 4

#define LED1_PIN GPIO_PIN_12
#define LED1_GPIO_PORT GPIOD
Expand All @@ -79,15 +83,37 @@ typedef enum
#define LED4_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
#define LED4_GPIO_CLK_DISABLE() __GPIOD_CLK_DISABLE()

#define LEDx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED1_GPIO_CLK_ENABLE(); else \
#define RS485_1_DE GPIO_PIN_4
#define RS485_1_DE_GPIO_PORT GPIOD
#define RS485_1_DE_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
#define RS485_1_DE_GPIO_CLK_DISABLE() __GPIOD_CLK_DISABLE()

#define RS485_2_DE GPIO_PIN_12
#define RS485_2_DE_GPIO_PORT GPIOD
#define RS485_2_DE_GPIO_CLK_ENABLE() __GPIOD_CLK_ENABLE()
#define RS485_2_DE_GPIO_CLK_DISABLE() __GPIOD_CLK_DISABLE()

#define MODBUS_DE GPIO_PIN_0 // íå èñïîëüçîâàòü
#define MODBUS_DE_GPIO_PORT GPIOC
#define MODBUS_DE_GPIO_CLK_ENABLE() __GPIOC_CLK_ENABLE()
#define MODBUS_DE_GPIO_CLK_DISABLE() __GPIOC_CLK_DISABLE()

#define PORTx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED1_GPIO_CLK_ENABLE(); else \
if((__INDEX__) == 1) LED2_GPIO_CLK_ENABLE(); else \
if((__INDEX__) == 2) LED3_GPIO_CLK_ENABLE(); else \
if((__INDEX__) == 3) LED4_GPIO_CLK_ENABLE(); \
if((__INDEX__) == 3) LED4_GPIO_CLK_ENABLE(); else \
if((__INDEX__) == 4) RS485_1_DE_GPIO_CLK_ENABLE(); else \
if((__INDEX__) == 5) RS485_2_DE_GPIO_CLK_ENABLE(); else \
if((__INDEX__) == 6) MODBUS_DE_GPIO_CLK_ENABLE();\
}while(0)
#define LEDx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED1_GPIO_CLK_DISABLE(); else \

#define PORTx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED1_GPIO_CLK_DISABLE(); else \
if((__INDEX__) == 1) LED2_GPIO_CLK_DISABLE(); else \
if((__INDEX__) == 2) LED3_GPIO_CLK_DISABLE(); else \
if((__INDEX__) == 3) LED4_GPIO_CLK_DISABLE(); \
if((__INDEX__) == 3) LED4_GPIO_CLK_DISABLE(); else \
if((__INDEX__) == 4) RS485_1_DE_GPIO_CLK_DISABLE(); else \
if((__INDEX__) == 5) RS485_2_DE_GPIO_CLK_DISABLE(); else \
if((__INDEX__) == 6) MODBUS_DE_GPIO_CLK_DISABLE(); \
}while(0)

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions FreeModbus/functions/mbfuncdisc_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ eMBMasterReqReadDiscreteInputs( UCHAR ucSndAddr, USHORT usDiscreteAddr, USHORT u
ucMBFrame[MB_PDU_REQ_READ_DISCCNT_OFF ] = usNDiscreteIn >> 8;
ucMBFrame[MB_PDU_REQ_READ_DISCCNT_OFF + 1] = usNDiscreteIn;
vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_READ_SIZE );
( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
eErrStatus = eMBMasterWaitRequestFinish( );
( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT ); // ïåðåäà¸ì ñîáûòèå "FRAME_SENT" â ìåíåäæåð ñîáûòèé
eErrStatus = eMBMasterWaitRequestFinish( ); // îæèäàåì îòâåò îò ìåíåäæåðà ñîáûòèé îá îêîí÷àíèè ñ âîçâðàòîì ñòàòóñà
}
return eErrStatus;
}
Expand Down
6 changes: 3 additions & 3 deletions FreeModbus/include/mb_m.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ typedef enum
*/
typedef enum
{
MB_TMODE_T35, /*!< Master receive frame T3.5 timeout. */
MB_TMODE_RESPOND_TIMEOUT, /*!< Master wait respond for slave. */
MB_TMODE_CONVERT_DELAY /*!< Master sent broadcast ,then delay sometime.*/
MB_TMODE_T35, /*!< Master ïîëó÷àåò ôðåéì T3.5 òàéìàóò. */
MB_TMODE_RESPOND_TIMEOUT, /*!< Master æäåò îòâåòà îò slave. */
MB_TMODE_CONVERT_DELAY /*!< Master ïåðåäà¸ò øèðîêîâåùàòåëüíûé ïàêåò, then delay sometime.*/
}eMBMasterTimerMode;

/* ----------------------- Function prototypes ------------------------------*/
Expand Down
16 changes: 10 additions & 6 deletions FreeModbus/include/mbconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,17 @@ PR_BEGIN_EXTERN_C
#endif

#if MB_MASTER_RTU_ENABLED > 0 || MB_MASTER_ASCII_ENABLED > 0
/*! \brief If master send a broadcast frame,the master will wait time of convert to delay,
* then master can send other frame */
/*! \brief If master send a broadcast frame,the master will wait time of convert to delay, then master can send other frame */

// Åñëè ìàñòåð îòïðàâèòü øèðîêîâåùàòåëüíûé êàäð, òî áóäåò æäàòü ýòî âðåìÿ. Çàòåì ìîæåò ïîñëàòü äðóãîé êàäð.
#define MB_MASTER_DELAY_MS_CONVERT (200 )
/*! \brief If master send a frame which is not broadcast,the master will wait sometime for slave.
* And if slave is not respond in this time,the master will process this timeout error.
* Then master can send other frame */
#define MB_MASTER_TIMEOUT_MS_RESPOND (100 )

/*! \brief If master send a frame which is not broadcast,the master will wait sometime for slave. And if slave is not respond
* in this time,the master will process this timeout error. Then master can send other frame */

// Åñëè ìàñòåð îòïðàâèòü íå øèðîêîâåùàòåëüíûé êàäð, òî áóäåò æäàòü îòâåòà ýòî âðåìÿ. Åñëè slave íå îòâåòèë çà ýòî âðåìÿ òî timeout error. Çàòåì ìîæåò ïîñëàòü äðóãîé êàäð.
#define MB_MASTER_TIMEOUT_MS_RESPOND (50 )

/*! \brief The total slaves in Modbus Master system. Default 16.
* \note : The slave ID must be continuous from 1.*/
#define MB_MASTER_TOTAL_SLAVE_NUM ( 16 )
Expand Down
1 change: 0 additions & 1 deletion FreeModbus/include/mbframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ PR_BEGIN_EXTERN_C

/* ----------------------- Prototypes 0-------------------------------------*/
typedef void ( *pvMBFrameStart ) ( void );

typedef void ( *pvMBFrameStop ) ( void );

typedef eMBErrorCode( *peMBFrameReceive ) ( UCHAR * pucRcvAddress,
Expand Down
Loading

0 comments on commit 4897ae6

Please sign in to comment.