portevent.c
#include "mb.h"
#include "mbport.h"
static EventGroupHandle_t xSlaveOsEvent;
BOOL xMBPortEventInit( void )
{
xSlaveOsEvent = xEventGroupCreate();
return TRUE;
}
BOOL xMBPortEventPost( eMBEventType eEvent )
{
xEventGroupSetBits(xSlaveOsEvent, eEvent);
return TRUE;
}
BOOL xMBPortEventGet( eMBEventType * eEvent )
{
EventBits_t recvedEvent;
recvedEvent = xEventGroupWaitBits(xSlaveOsEvent,
EV_READY | EV_FRAME_RECEIVED | EV_EXECUTE | EV_FRAME_SENT,
pdTRUE,
pdFALSE,
portMAX_DELAY);
switch (recvedEvent)
{
case EV_READY:
*eEvent = EV_READY;
break;
case EV_FRAME_RECEIVED:
*eEvent = EV_FRAME_RECEIVED;
break;
case EV_EXECUTE:
*eEvent = EV_EXECUTE;
break;
case EV_FRAME_SENT:
*eEvent = EV_FRAME_SENT;
break;
}
return TRUE;
}
Modbus资料整理
笔者将Modbus 主机、从机协议完整资料整理如下:
文件 | 说明 |
---|
freemodbus-v1.6.zip | FreeModbusV1.6源码 | FreeModbusMasterSlave(Rev1.0.0).zip | 笔者移植好测试通过STM32+FreeRTOS+FreeModbus Master Slave代码 | ModbusSlave 7.0和ModbusPoll_7.0软件注册码.zip | FreeModbus Master Slave调试工具 | FreeModbus V1.6 主机使用说明.md | FreeModbus 主机使用说明文档 | FreeModbus 从机流程图.vsd | FreeModbus 从机流程图 | FreeModbus 主机流程图.vsd | FreeModbus 主机流程图 | Modbus应用协议.doc | 笔者整理的 FreeModbus 协议文档 | FreeModbus Datasheet | 笔者搜集 FreeModbus 官方协议文档 |
资料链接:👉FreeModbus资源传送门👈 资料介绍:👉FreeModbus资源介绍传送门👈
|