Gabriel Rivas / ModbusSlaveRTU

Dependents:   Nucleo_modbus_protocol_test

Embed: (wiki syntax)

« Back to documentation index

ModbusSlaveRTU Class Reference

ModbusSlaveRTU Class Reference

Modbus RTU class for slave devices. More...

#include <ModbusSlaveRTU.h>

Public Types

enum  MbStatusTypes_t { LISTENING = 0x20, PROCESSING = 0x21, SENDING = 0x23 }

Public Member Functions

 ModbusSlaveRTU (uint8_t id, MessageQueue< uint8_t > *txQueue, MessageQueue< uint8_t > *rxQueue, ThreadSafeArray_t *coilRegisters, ThreadSafeArray_t *inputRegisters, ThreadSafeArray_t *holdingRegisters)
 Creates a Modbus Slave RTU object.
void trigger (void)
 Function to start the Modbus RTU Slave engine.
MbStatusTypes_t getStatus (void)
 Gets the status of the internal FSM.
void FSM (void)
 Internal FSM process.

Detailed Description

Modbus RTU class for slave devices.

It shares data with other software components via a Message queue object, and can exist more than one Modbus Slave RTU instances in a application program.

Definition at line 36 of file ModbusSlaveRTU.h.


Member Enumeration Documentation

Status of the internal modbus FSM.

Enumerator:
LISTENING 

Listening for incomming requests.

PROCESSING 

Processing received request.

SENDING 

Sending generated response.

Definition at line 40 of file ModbusSlaveRTU.h.


Constructor & Destructor Documentation

ModbusSlaveRTU ( uint8_t  id,
MessageQueue< uint8_t > *  txQueue,
MessageQueue< uint8_t > *  rxQueue,
ThreadSafeArray_t *  coilRegisters,
ThreadSafeArray_t *  inputRegisters,
ThreadSafeArray_t *  holdingRegisters 
)

Creates a Modbus Slave RTU object.

Parameters:
idMosbus address.
txQueueMessage queue to write modbus responses into.
rxQueueMessage queue to read modbus requests from.
*coilRegistersPointer to the memory space reserved for the coil registers.
*inputRegistersPointer to the memory space reserved for the input registers.
*inputRegistersPointer to the memory space reserved for the holding registers.

Definition at line 25 of file ModbusSlaveRTU.cpp.


Member Function Documentation

void FSM ( void   )

Internal FSM process.

Definition at line 63 of file ModbusSlaveRTU.cpp.

ModbusSlaveRTU::MbStatusTypes_t getStatus ( void   )

Gets the status of the internal FSM.

Returns:
Status value as defined in MbStatusTypes_t.

Definition at line 58 of file ModbusSlaveRTU.cpp.

void trigger ( void   )

Function to start the Modbus RTU Slave engine.

Definition at line 53 of file ModbusSlaveRTU.cpp.