STM32 上移植 FreeModbus RTU

2020-02-29 10:44发布

解压 freemodbus v1.6 源码 看到如下文件目录结构  
708085e57a1496ee2b.png



友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
20条回答
stm32jy
2020-03-01 08:54
其中:
(1)、 port.h 需要修改。
(2)、 porteven.c 不需要任何修改
(3)、 portserial.c 需要修改
(4)、 porttimer.c 需要修改。
(5)、另外还需要在 main 函数增加 4 个回调函数。
(5.1)、操作输入寄存器的回调函数 eMBErrorCode eMBRegInputCB( UCHAR *
pucRegBuffer, USHORT usAddress, USHORT usNRegs )
(5.2)、操作保持寄存器的回调函数 eMBErrorCode eMBRegHoldingCB( UCHAR *
pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode )
(5.3 )、 操 作 线 圈 的 的 回 调 函 数 eMBErrorCode eMBRegCoilsCB( UCHAR *
pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegisterMode eMode )
(5.4)、操作离散寄存器的的回调函数 eMBErrorCode eMBRegDiscreteCB( UCHAR *
pucRegBuffer, USHORT usAddress, USHORT usNDiscrete )

一周热门 更多>