32 KiB
atMb 0.8 API reference
Generated from library/atMb-OnlineChange.export. Declarations below are the current source. Use USER-GUIDE.md for lifecycle, units and examples. Internal fields remain exposed where required by existing IEC inheritance; do not overwrite engine state from application code.
atMbCall_cext
Fixed external C entry point. Preserve parameter order/types and External implementation setting. Use FBs for application logic.
FUNCTION atMbCall_cext : UDINT
VAR_INPUT
command : UDINT;
handle : UDINT;
ipAddress : DWORD;
port : UINT;
unitId : BYTE;
functionCode : BYTE;
startAddress : UINT;
quantity : UINT;
pData : POINTER TO WORD;
dataCapacity : UDINT;
pStatus : POINTER TO UDINT;
statusCapacity : UDINT;
nowMs : ULINT;
connectTimeoutMs : UDINT;
responseTimeoutMs : UDINT;
retryDelayMs : UDINT;
END_VAR
ModbusMaster.ClientStatus
Retained legacy enum; clients now monitor a STRING through toString.
{attribute 'qualified_only'}
{attribute 'strict'}
TYPE ClientStatus :
(
noneOk := 0,
someOk := 1,
allOk := 2
);
END_TYPE
ModbusMaster.Error
IEC result classification. TCP socket names also classify RTU OS failures. See out_errorCode for exact C result.
{attribute 'qualified_only'}
TYPE Error : (
OK := 0, RequestParameterError := 1, TcpSocketError := 4,
TcpConnectTimeout := 5, ReplyTimeout := 6, InvalidReply := 8,
RequestException := 9, RequestCancelled := 10, InternalError := 255
);
END_TYPE
ModbusMaster.ExceptionCodes
Standard Modbus exception values and local TIMEOUT=-1. Only true timeout results set timeoutCnt in this version.
{attribute 'qualified_only'}
TYPE ExceptionCodes :
(
TIMEOUT := -1,
RESPONSE_SUCCESS := 16#00,
ILLEGAL_FUNCTION := 16#01,
ILLEGAL_DATA_ADDRESS := 16#02,
ILLEGAL_DATA_VALUE := 16#03,
SLAVE_DEVICE_FAILURE := 16#04,
ACKNOWLEDGE := 16#05,
SLAVE_DEVICE_BUSY := 16#06,
MEMORY_PARITY_ERROR := 16#08,
GATEWAY_PATH_UNAVAILABLE := 16#0A,
GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND := 16#0B
);
END_TYPE
ModbusMaster.ClientBase
Shared abstract client scheduler and registry. Call concrete client every scan; IEC task handles transaction progress. Exposes aggregated stats and toString.
{attribute 'monitoring_display' := 'toString'}
{attribute 'no_assign'}
FUNCTION_BLOCK ABSTRACT ClientBase
VAR_INPUT
{attribute 'symbol' := 'none'}
in_timeout: TIME := T#0MS;
{attribute 'symbol' := 'none'}
in_resetStats: BOOL;
END_VAR
VAR_OUTPUT
{attribute 'symbol' := 'none'}
msgLastSecondCnt: UDINT;
{attribute 'symbol' := 'none'}
msgLastSecondTime: UDINT;
{attribute 'symbol' := 'none'}
numMsgSent: UDINT;
{attribute 'symbol' := 'none'}
numMsgReply: UDINT;
{attribute 'symbol' := 'none'}
allRequestsOnline: BOOL;
reqStats: ARRAY[0..99] OF POINTER TO RequestStats;
END_VAR
VAR
dataRate : DINT;
requests : ARRAY[0..99] OF POINTER TO RequestBase;
requestCnt : UINT;
allRequestsOffline : BOOL;
END_VAR
VAR
engineMode : BOOL;
engineHandle : UDINT;
engineIP : DWORD;
enginePort : UINT;
engineNowMicroseconds : SYSTIME;
engineNowMilliseconds : ULINT;
engineStatus : ARRAY[0..23] OF UDINT;
engineActiveIndex : DINT := -1;
engineSelected : POINTER TO RequestBase;
engineResultReady : BOOL;
engineFinishedIndex : DINT := -1;
engineWindowStartMilliseconds : ULINT;
engineWasConnected : BOOL;
engineEnable : BOOL := TRUE;
engineConnectTimeoutMilliseconds : UDINT := 2000;
engineRetryDelayMilliseconds : UDINT := 100;
engineHoldUncertainWrites : BOOL := FALSE;
END_VAR
VAR_INPUT
{attribute 'symbol' := 'none'}
engineIO : ARRAY[0..1999] OF WORD;
{attribute 'symbol' := 'none'}
engineActiveRequest : POINTER TO RequestBase;
{attribute 'symbol' := 'none'}
engineArgUnit : BYTE;
{attribute 'symbol' := 'none'}
engineArgFunction : BYTE;
{attribute 'symbol' := 'none'}
engineArgAddress : UINT;
{attribute 'symbol' := 'none'}
engineArgQuantity : UINT;
{attribute 'symbol' := 'none'}
engineArgTimeout : UDINT := 1000;
{attribute 'symbol' := 'none'}
engineSent : UDINT;
{attribute 'symbol' := 'none'}
engineReplied : UDINT;
{attribute 'symbol' := 'none'}
engineWindowCount : UDINT;
{attribute 'symbol' := 'none'}
engineWindowTime : UDINT;
END_VAR
VAR_OUTPUT
out_connected : BOOL;
out_connectionState : UDINT;
out_lastErrorCode : UDINT;
out_socketError : UDINT;
out_reconnectCount : UDINT;
out_registrationFull : BOOL;
END_VAR
VAR CONSTANT
CMD_OPEN : UDINT := 1;
CMD_CLOSE : UDINT := 2;
CMD_ENABLE : UDINT := 3;
CMD_TICK : UDINT := 5;
CMD_SUBMIT : UDINT := 6;
CMD_COPY_READ : UDINT := 7;
CMD_CONFIGURE : UDINT := 9;
CMD_ACKNOWLEDGE : UDINT := 10;
CMD_REQUEST_TIMEOUT : UDINT := 11;
STATE_DISABLED : UDINT := 0;
STATE_READY : UDINT := 3;
STATE_RECEIVING : UDINT := 5;
ERROR_INVALID_HANDLE : UDINT := 256;
ERROR_CANCELLED : UDINT := 10;
STATUS_HANDLE : UDINT := 0;
STATUS_STATE : UDINT := 1;
STATUS_DONE : UDINT := 3;
STATUS_ERROR : UDINT := 4;
STATUS_RESULT : UDINT := 5;
STATUS_LAST_ERROR : UDINT := 6;
STATUS_SOCKET_ERROR : UDINT := 7;
STATUS_EXCEPTION : UDINT := 8;
STATUS_WRITE_UNCERTAIN : UDINT := 9;
STATUS_RECONNECTS : UDINT := 11;
STATUS_FUNCTION : UDINT := 18;
END_VAR
VAR
engineOpenCommand : UDINT := 1;
engineDevice : STRING(127);
engineSerialBaud : UDINT;
engineSerialParity : BYTE;
engineSerialBits : BYTE;
engineSerialStops : BYTE;
engineSerialRs485 : UDINT;
END_VAR
VAR_INPUT
in_enable : BOOL := TRUE;
END_VAR
VAR_OUTPUT
stats : ClientStats;
END_VAR
ModbusMaster.ClientRTU
Linux serial/RTU configuration. Changing serial parameters recreates the context. Explicit unit ID 1..247 is required on requests.
{attribute 'monitoring_display' := 'toString'}
{attribute 'no_assign'}
FUNCTION_BLOCK ClientRTU EXTENDS ClientBase
VAR_INPUT
in_device : STRING(127) := '/dev/ttyUSB0';
in_baudRate : UDINT := 9600;
in_parity : BYTE := 0;
in_dataBits : BYTE := 8;
in_stopBits : BYTE := 1;
in_rs485 : BOOL;
in_reconnectDelay : TIME := T#100MS;
in_holdUncertainWrites : BOOL := FALSE;
END_VAR
VAR
lastDevice : STRING(127);
lastBaud : UDINT;
lastParity : BYTE;
lastBits : BYTE;
lastStops : BYTE;
lastRs485 : BOOL;
lastRetry : TIME;
END_VAR
ModbusMaster.ClientTCP
TCP connection configuration. Changing endpoint, connect timeout or retry delay recreates its context. Inherits ClientBase statistics and monitoring string.
{attribute 'monitoring_display' := 'toString'}
{attribute 'no_assign'}
FUNCTION_BLOCK ClientTCP EXTENDS ClientBase
VAR_INPUT
{attribute 'symbol' := 'none'}
in_ipAddress: ARRAY[0..3] OF BYTE;
{attribute 'symbol' := 'none'}
in_port: UINT := 502;
{attribute 'symbol' := 'none'}
in_baudrate: UINT := 0;
END_VAR
VAR_INPUT
in_connectTimeout : TIME := T#2S;
in_reconnectDelay : TIME := T#100MS;
in_holdUncertainWrites : BOOL := FALSE;
END_VAR
VAR
engineEndpointIP : DWORD;
engineEndpointPort : UINT;
engineConfigConnect : UDINT;
engineConfigRetry : UDINT;
END_VAR
ModbusMaster.ReqReadCoil
Read request using the indicated BOOL/UINT array and shared RequestBase inputs. Successful replies update only the selected slice; inspect out_validData/out_stale.
{attribute 'no_assign'}
FUNCTION_BLOCK ReqReadCoil EXTENDS RequestBase
VAR_IN_OUT
{attribute 'symbol' := 'none'}
data: ARRAY[*] OF BOOL;
END_VAR
ModbusMaster.ReqReadDiscrete
Read request using the indicated BOOL/UINT array and shared RequestBase inputs. Successful replies update only the selected slice; inspect out_validData/out_stale.
{attribute 'no_assign'}
FUNCTION_BLOCK ReqReadDiscrete EXTENDS RequestBase
VAR_IN_OUT
{attribute 'symbol' := 'none'}
data: ARRAY[*] OF BOOL;
END_VAR
ModbusMaster.ReqReadHolding
Read request using the indicated BOOL/UINT array and shared RequestBase inputs. Successful replies update only the selected slice; inspect out_validData/out_stale.
{attribute 'no_assign'}
FUNCTION_BLOCK ReqReadHolding EXTENDS RequestBase
VAR_IN_OUT
{attribute 'symbol' := 'none'}
data: ARRAY[*] OF UINT;
END_VAR
ModbusMaster.ReqReadInput
Read request using the indicated BOOL/UINT array and shared RequestBase inputs. Successful replies update only the selected slice; inspect out_validData/out_stale.
{attribute 'no_assign'}
FUNCTION_BLOCK ReqReadInput EXTENDS RequestBase
VAR_IN_OUT
{attribute 'symbol' := 'none'}
data: ARRAY[*] OF UINT;
END_VAR
ModbusMaster.RequestBase
Abstract registered request. Quantity is clamped to available data capacity; zero disables scheduling. Concrete blocks supply data type and function code.
{attribute 'no_assign'}
FUNCTION_BLOCK ABSTRACT RequestBase
VAR_INPUT
{attribute 'symbol' := 'none'}
client: REFERENCE TO ClientBase;
{attribute 'symbol' := 'none'}
in_startAddr: UINT;
{attribute 'symbol' := 'none'}
in_quantity: UINT;
{attribute 'symbol' := 'none'}
in_dataOffset: UINT;
{attribute 'symbol' := 'none'}
in_unitId: BYTE := 0;
{attribute 'symbol' := 'none'}
in_timeout: SYSTIME := 0;
{attribute 'symbol' := 'none'}
in_minDelay: TIME := T#10MS;
{attribute 'symbol' := 'none'}
in_prioritySetpoint: INT := 50;
{attribute 'symbol' := 'none'}
in_priorityCurrent: INT;
{attribute 'symbol' := 'none'}
stats: RequestStats;
END_VAR
VAR
{attribute 'symbol' := 'none'}
dataCapacity: UINT;
END_VAR
VAR
engineFunction : BYTE;
engineTransactionQuantity : UINT;
engineTransactionDataIndex : UINT;
engineInFlight : BOOL;
engineReadComplete : BOOL;
engineCopyAllowed : BOOL;
engineWriteHold : BOOL;
engineRequestStartMilliseconds : ULINT;
engineDataIndex : DINT;
engineCallResult : UDINT;
END_VAR
VAR_OUTPUT
out_errorCode : UDINT;
out_socketError : UDINT;
out_writeUncertain : BOOL;
out_validData : BOOL;
out_dataAgeMs : ULINT;
out_stale : BOOL := TRUE;
out_parameterError : BOOL;
END_VAR
VAR_INPUT
in_staleAfter : TIME := T#2S;
END_VAR
ModbusMaster.RequestStats
Per-request history, communication flags and 100 ms display indicators. Maintained by request processing; temporary disable retains historical counters.
{attribute 'monitoring_display' := 'toString'}
{attribute 'no_assign'}
FUNCTION_BLOCK RequestStats
VAR_INPUT
lastErrorId: Error;
lastExceptionCode: ExceptionCodes;
lastValidDuration: UDINT;
longestValidDuration: UDINT;
interval: UDINT;
offlineCnt: UINT;
doneCnt: UDINT;
errorCnt: UDINT;
doneCntRst: UDINT;
errorCntRst: UDINT;
sinceLastExec: UDINT;
timeoutCnt: UDINT;
reqLength: UINT;
END_VAR
VAR_OUTPUT
executeLight: BOOL;
reqDoneLight: BOOL;
reqErrorLight: BOOL;
reqBusyLight: BOOL;
online: BOOL;
offline: BOOL;
active: BOOL;
executeMbFb: BOOL;
END_VAR
VAR
{attribute 'symbol' := 'none'}
doneIndicatorDelay: TOF;
{attribute 'symbol' := 'none'}
errorIndicatorDelay: TOF;
{attribute 'symbol' := 'none'}
busyIndicatorDelay: TOF;
{attribute 'symbol' := 'none'}
executeIndicatorDelay: TOF;
toString: STRING(64);
{attribute 'symbol' := 'none'}
executeTrig: R_TRIG;
{attribute 'symbol' := 'none'}
offlineTrig: R_TRIG;
{attribute 'symbol' := 'none'}
lastRequestStartMicroseconds: SYSTIME;
{attribute 'symbol' := 'none'}
currentTimeMicroseconds: SYSTIME;
_execute: BOOL;
_reqDone: BOOL;
_reqBusy: BOOL;
_reqError: BOOL;
END_VAR
VAR CONSTANT
{attribute 'symbol' := 'none'}
INDICATOR_HOLD_TIME: TIME:= T#100MS;
END_VAR
VAR_INPUT
engineResponseSeen : BOOL;
engineLastSuccessMs : ULINT;
END_VAR
VAR_INPUT
sentCnt : UDINT;
replyCnt : UDINT;
exceptionCnt : UDINT;
totalValidDuration : ULINT; // Sum of successful transport transaction durations, milliseconds.
END_VAR
VAR
previousOnline : BOOL;
END_VAR
ModbusMaster.ReqWriteCoil
Cyclic write request. Values are copied at submission; writeNow changes eligibility/hold state. See uncertain-write policy in USER-GUIDE.md.
{attribute 'no_assign'}
FUNCTION_BLOCK ReqWriteCoil EXTENDS RequestBase
VAR_IN_OUT
{attribute 'symbol' := 'none'}
data: ARRAY[*] OF BOOL;
END_VAR
ModbusMaster.ReqWriteHolding
Cyclic write request. Values are copied at submission; writeNow changes eligibility/hold state. See uncertain-write policy in USER-GUIDE.md.
{attribute 'no_assign'}
FUNCTION_BLOCK ReqWriteHolding EXTENDS RequestBase
VAR_IN_OUT
{attribute 'symbol' := 'none'}
data: ARRAY[*] OF UINT;
END_VAR
ModbusMaster.To_IPAddress
Return four BYTE IPv4 octets as the ClientTCP address array.
FUNCTION To_IPAddress : ARRAY[0..3] OF BYTE
VAR_INPUT
byte1: BYTE;
byte2: BYTE;
byte3: BYTE;
byte4: BYTE;
END_VAR
ModbusSlave.ModbusSlave
TCP server: four memory arrays, eight peers, up to 2000 entries/table. Array bounds define protocol addresses. Dirty remote writes are protected until PLC pull. Mapping changes require in_reset. No RTU server is provided.
{attribute 'no_assign'}
FUNCTION_BLOCK ModbusSlave
VAR_IN_OUT
aDiscreteInputsMemory : ARRAY[*] OF BOOL;
aCoilsMemory : ARRAY[*] OF BOOL;
aInputRegistersMemory : ARRAY[*] OF UINT;
aHoldingRegistersMemory : ARRAY[*] OF UINT;
END_VAR
VAR_INPUT
in_enable : BOOL := TRUE;
in_reset : BOOL;
in_reconnectDelay : TIME := T#100MS;
interfaceName : WSTRING;
in_ipAddress : DWORD;
port : UINT := 502;
END_VAR
VAR_OUTPUT
out_running : BOOL;
out_error : BOOL;
out_errorId : Error;
out_parameterError : BOOL;
out_socketError : UDINT;
out_connectedClients : UINT;
out_requestsReceived : UDINT;
out_repliesSent : UDINT;
out_exceptionReplies : UDINT;
END_VAR
VAR
serverHandle : UDINT;
serverStatus : ARRAY[0..23] OF UDINT;
serverIO : ARRAY[0..1999] OF WORD;
nowUs : SYSTIME;
nowMs : ULINT;
lastIP : DWORD;
lastPort : UINT;
lastRetry : TIME;
callResult : UDINT;
tableIndex : BYTE;
itemIndex : DINT;
tableStart : UINT;
tableCount : UINT;
END_VAR
ModbusSlave.SlaveTCP
TCP server: four memory arrays, eight peers, up to 2000 entries/table. Array bounds define protocol addresses. Dirty remote writes are protected until PLC pull. Mapping changes require in_reset. No RTU server is provided.
{attribute 'no_assign'}
FUNCTION_BLOCK SlaveTCP
VAR_IN_OUT
aDiscreteInputsMemory : ARRAY[*] OF BOOL;
aCoilsMemory : ARRAY[*] OF BOOL;
aInputRegistersMemory : ARRAY[*] OF UINT;
aHoldingRegistersMemory : ARRAY[*] OF UINT;
END_VAR
VAR_INPUT
in_enable : BOOL := TRUE;
in_reset : BOOL;
in_reconnectDelay : TIME := T#100MS;
interfaceName : WSTRING;
in_ipAddress : DWORD;
port : UINT := 502;
END_VAR
VAR_OUTPUT
out_running : BOOL;
out_error : BOOL;
out_errorId : Error;
out_parameterError : BOOL;
out_socketError : UDINT;
out_connectedClients : UINT;
out_requestsReceived : UDINT;
out_repliesSent : UDINT;
out_exceptionReplies : UDINT;
END_VAR
VAR
serverHandle : UDINT;
serverStatus : ARRAY[0..23] OF UDINT;
serverIO : ARRAY[0..1999] OF WORD;
nowUs : SYSTIME;
nowMs : ULINT;
lastIP : DWORD;
lastPort : UINT;
lastRetry : TIME;
callResult : UDINT;
tableIndex : BYTE;
itemIndex : DINT;
tableStart : UINT;
tableCount : UINT;
END_VAR
ClientBase.addRequest
Register unique non-null request pointer, max 100. Duplicate registration is ignored. Overflow sets registrationFull.
METHOD PUBLIC addRequest
VAR_INPUT
request: POINTER TO RequestBase;
END_VAR
VAR
requestIndex : DINT := 0;
END_VAR
ClientBase.FB_exit
Lifecycle resource release. context hooks close their owned handle. Use public release for application shutdown.
METHOD FB_exit : BOOL
VAR_INPUT
bInCopyCode : BOOL;
END_VAR
ClientBase.FB_reinit
Clear handles/registry or request execution state after instance reinitialization. Does not guarantee online-change correctness.
METHOD FB_reinit : BOOL
VAR
requestIndex : DINT;
END_VAR
ClientBase.callEngine
Internal synchronous ABI adapter with WORD transfer buffer and 24-word status storage. RTU open repurposes fields to pass serial path/configuration.
METHOD callEngine : UDINT
VAR_INPUT
command : UDINT;
END_VAR
VAR
deviceBytes : POINTER TO BYTE;
deviceLength : UINT;
deviceIndex : DINT;
END_VAR
ClientBase.processCycle
Refresh scan lease, read completed results, process request completions, acknowledge result and select next transaction. Transport I/O progresses during the owning PLC call.
METHOD processCycle
VAR
callResult : UDINT;
END_VAR
ClientBase.ensureContext
Allocate/configure/enable a context. A nonzero handle does not imply connectivity. Old components are rejected with error 259.
METHOD PROTECTED ensureContext : BOOL
VAR
callResult : UDINT;
END_VAR
ClientBase.releaseContext
Close context, cancel active request, mark requests offline and invalidate cached read data. Returns TRUE. Does not disable in_enable; an enabled client can reopen.
METHOD releaseContext : BOOL
VAR
requestIndex : DINT;
END_VAR
ClientBase.selectNextRequest
Select lowest current priority among eligible unheld requests; oldest age breaks ties. Minimum start delay applies. No zero-priority prerequisite.
METHOD PROTECTED selectNextRequest
VAR
requestIndex : DINT;
selectedRequestIndex : DINT;
selectedPriority : INT;
oldestRequestAgeMilliseconds : UDINT;
END_VAR
ClientBase.updateDiagnostics
Publish transport state, errno, last result history and reconnect-attempt count. Mark requests offline on connection loss.
METHOD PROTECTED updateDiagnostics
ClientBase.updateStatistics
Rebuild the client summary from each registered RequestStats. State counts are restricted to active requests; historic counters include inactive ones. Publish the common monitoring string and compatibility counters.
METHOD PROTECTED updateStatistics
VAR
requestIndex : DINT;
END_VAR
ClientBase.processAllRequests
Dispatch all registered non-null request methods; guarded against empty/invalid count.
METHOD processAllRequests
VAR_INPUT
END_VAR
VAR
requestIndex: DINT;
END_VAR
ClientBase.recreateClient
Release current context so next enabled scan reopens with current settings. Affects every request using that connection.
METHOD ABSTRACT recreateClient
VAR_INPUT
END_VAR
ClientBase.release
Disable client input and release its context. Passing in_enable TRUE on a subsequent call resumes it.
METHOD release : BOOL
ClientBase.resetStats
Clear success/error/send/reply/timeout/exception/offline counters and successful-duration history. Client version delegates to each request and refreshes totals. Connection state and data freshness are preserved.
METHOD resetStats
VAR
requestIndex : DINT;
END_VAR
ClientBase.setAllRequestsOffline
Force registered request statistics offline. Used when connection disappears or context is released.
METHOD PROTECTED setAllRequestsOffline : BOOL
VAR_INPUT
END_VAR
VAR
requestIndex: DINT;
END_VAR
ClientBase.setupClient
Return whether a context handle exists. Does not open a context or prove connection success.
METHOD setupClient : BOOL
VAR_INPUT
END_VAR
ClientBase.activeIndex
Read active registry index or -1. Setting valid index flags that request execute; it does not bypass scheduler eligibility.
PROPERTY activeIndex : DINT
ClientBase.activeReqCnt
Private count of active registered requests.
PROPERTY PRIVATE activeReqCnt : UINT
ClientBase.allRequestsComplete
Legacy private flag check: FALSE for no requests or any execution/completion/error flag present.
{attribute 'symbol' := 'none'}
PROPERTY PRIVATE allRequestsComplete : BOOL
ClientBase.onlineCnt
Legacy count of registered online flags. Client.stats.onlineCount uses active requests only.
{attribute 'symbol' := 'none'}
PROPERTY onlineCnt : DINT
ClientBase.requestExecuting
Private activeIndex <> -1 test.
{attribute 'symbol' := 'none'}
PROPERTY PRIVATE requestExecuting : BOOL
ClientRTU.recreateClient
Release current context so next enabled scan reopens with current settings. Affects every request using that connection.
METHOD recreateClient
ClientBase.toString
Shared client string property returning stats.toString. Used by both concrete client monitoring displays.
PROPERTY toString : STRING(64)
ClientTCP.recreateClient
Release current context so next enabled scan reopens with current settings. Affects every request using that connection.
METHOD recreateClient
ReqReadCoil.processRequest
Concrete request adapter performs bounds validation and transfers its typed slice through processTransaction; abstract on RequestBase. Called by scheduler.
METHOD processRequest
ReqReadCoil.recreateRequest
Clear request in-flight state; if it owns the active transaction, recreates the client connection. Returns TRUE.
METHOD recreateRequest : BOOL
ReqReadDiscrete.processRequest
Concrete request adapter performs bounds validation and transfers its typed slice through processTransaction; abstract on RequestBase. Called by scheduler.
METHOD processRequest
ReqReadDiscrete.recreateRequest
Clear request in-flight state; if it owns the active transaction, recreates the client connection. Returns TRUE.
METHOD recreateRequest : BOOL
ReqReadHolding.processRequest
Concrete request adapter performs bounds validation and transfers its typed slice through processTransaction; abstract on RequestBase. Called by scheduler.
METHOD processRequest
ReqReadHolding.recreateRequest
Clear request in-flight state; if it owns the active transaction, recreates the client connection. Returns TRUE.
METHOD recreateRequest : BOOL
ReqReadInput.processRequest
Concrete request adapter performs bounds validation and transfers its typed slice through processTransaction; abstract on RequestBase. Called by scheduler.
METHOD processRequest
ReqReadInput.recreateRequest
Clear request in-flight state; if it owns the active transaction, recreates the client connection. Returns TRUE.
METHOD recreateRequest : BOOL
RequestBase.busy
Set stats.reqBusy and return the assigned flag.
METHOD busy : BOOL
VAR_INPUT
in: BOOL;
END_VAR
RequestBase.done
Set stats.reqDone and restore configured priority on success.
METHOD done
VAR_INPUT
in: BOOL;
END_VAR
RequestBase.err
Set error identity before triggering counter update; apply 10/40/90 consecutive-error priority backoff.
METHOD err
VAR_INPUT
in: BOOL;
errorId: Error;
exceptionCode: ExceptionCodes;
END_VAR
VAR
priorityMultiplier: INT;
END_VAR
RequestBase.FB_reinit
Clear handles/registry or request execution state after instance reinitialization. Does not guarantee online-change correctness.
METHOD FB_reinit : BOOL
RequestBase.invalidateData
Invalidate/stale cached read data without clearing its application array.
METHOD PUBLIC invalidateData
RequestBase.finishRequest
Map a completed result and write uncertainty, collect transport timing/read age, update reply/exception/timeout counters and completion flags. Successful reads become valid; errors retain old array values.
METHOD finishRequest
VAR_INPUT
result : UDINT;
END_VAR
VAR
mapped : Error;
ex : ExceptionCodes;
duration : UDINT;
END_VAR
RequestBase.processTransaction
Submit the selected request or consume its buffered result. Record accepted-send counter and refresh data freshness. Normally invoked by the client through concrete processRequest.
METHOD processTransaction
VAR_INPUT
functionCode : BYTE;
END_VAR
RequestBase.processRequest
Concrete request adapter performs bounds validation and transfers its typed slice through processTransaction; abstract on RequestBase. Called by scheduler.
METHOD ABSTRACT processRequest
VAR_INPUT
END_VAR
RequestBase.recreateRequest
Clear request in-flight state; if it owns the active transaction, recreates the client connection. Returns TRUE.
METHOD ABSTRACT recreateRequest : BOOL
RequestBase.replyTimeout
Internal microsecond timeout calculation. Request milliseconds override client TIME, then baud/data-rate formula. C submission rounds to milliseconds.
PROPERTY PROTECTED replyTimeout : UDINT
RequestStats.resetStats
Clear success/error/send/reply/timeout/exception/offline counters and successful-duration history. Client version delegates to each request and refreshes totals. Connection state and data freshness are preserved.
METHOD resetStats
VAR_INPUT
END_VAR
RequestStats.setClientOffline
Count a real online-to-offline transition, clear response evidence and force offline. Returns TRUE.
METHOD setClientOffline : BOOL
VAR_INPUT
END_VAR
RequestStats.setToString
Update OK:/Er: monitoring text, returning TRUE.
METHOD PRIVATE setToString : BOOL
VAR_INPUT
END_VAR
RequestStats.execute
Execution state property. Setter refuses execution while completion/error flags remain set.
PROPERTY execute : BOOL
RequestStats.reqBusy
Underlying request busy flag; normal application code inspects rather than drives it.
PROPERTY reqBusy : BOOL
RequestStats.reqDone
On successful executing completion, increment saturated success counters, clear errors and execution, update display. Transport supplies duration.
PROPERTY reqDone : BOOL
RequestStats.reqError
On failed executing completion, increment saturated error counters and clear execution. Timeout/exception classification is handled by finishRequest.
PROPERTY reqError : BOOL
ReqWriteCoil.processRequest
Concrete request adapter performs bounds validation and transfers its typed slice through processTransaction; abstract on RequestBase. Called by scheduler.
METHOD processRequest
ReqWriteCoil.recreateRequest
Clear request in-flight state; if it owns the active transaction, recreates the client connection. Returns TRUE.
METHOD recreateRequest : BOOL
ReqWriteCoil.writeNow
Release uncertain-write hold and set priority zero. Does not send synchronously or make the cyclic write block single-shot.
METHOD writeNow : BOOL
VAR_INPUT
END_VAR
ReqWriteHolding.processRequest
Concrete request adapter performs bounds validation and transfers its typed slice through processTransaction; abstract on RequestBase. Called by scheduler.
METHOD processRequest
ReqWriteHolding.recreateRequest
Clear request in-flight state; if it owns the active transaction, recreates the client connection. Returns TRUE.
METHOD recreateRequest : BOOL
ReqWriteHolding.writeNow
Release uncertain-write hold and set priority zero. Does not send synchronously or make the cyclic write block single-shot.
METHOD writeNow : BOOL
VAR_INPUT
END_VAR
ModbusSlave.FB_exit
Lifecycle resource release. context hooks close their owned handle. Use public release for application shutdown.
METHOD FB_exit : BOOL
VAR_INPUT
bInCopyCode : BOOL;
END_VAR
ModbusSlave.FB_reinit
Clear handles/registry or request execution state after instance reinitialization. Does not guarantee online-change correctness.
METHOD FB_reinit : BOOL
ModbusSlave.serverCall
Private synchronous server ABI adapter using server staging/status arrays.
METHOD PRIVATE serverCall : UDINT
VAR_INPUT
command : UDINT;
END_VAR
SlaveTCP.FB_exit
Lifecycle resource release. context hooks close their owned handle. Use public release for application shutdown.
METHOD FB_exit : BOOL
VAR_INPUT
bInCopyCode : BOOL;
END_VAR
SlaveTCP.FB_reinit
Clear handles/registry or request execution state after instance reinitialization. Does not guarantee online-change correctness.
METHOD FB_reinit : BOOL
SlaveTCP.serverCall
Private synchronous server ABI adapter using server staging/status arrays.
METHOD PRIVATE serverCall : UDINT
VAR_INPUT
command : UDINT;
END_VAR
activeIndex.Get
Get accessor for activeIndex; see the owning property description for semantics and side effects.
VAR
requestIndex: DINT;
END_VAR
activeIndex.Set
Set accessor for activeIndex; see the owning property description for semantics and side effects.
activeReqCnt.Get
Get accessor for activeReqCnt; see the owning property description for semantics and side effects.
VAR
requestIndex : DINT;
cnt: UINT;
END_VAR
allRequestsComplete.Get
Get accessor for allRequestsComplete; see the owning property description for semantics and side effects.
VAR
requestIndex : DINT;
END_VAR
onlineCnt.Get
Get accessor for onlineCnt; see the owning property description for semantics and side effects.
VAR
requestIndex : DINT;
cnt: UINT;
END_VAR
requestExecuting.Get
Get accessor for requestExecuting; see the owning property description for semantics and side effects.
toString.Get
Get accessor for toString; see the owning property description for semantics and side effects.
replyTimeout.Get
Get accessor for replyTimeout; see the owning property description for semantics and side effects.
execute.Get
Get accessor for execute; see the owning property description for semantics and side effects.
execute.Set
Set accessor for execute; see the owning property description for semantics and side effects.
reqBusy.Get
Get accessor for reqBusy; see the owning property description for semantics and side effects.
reqBusy.Set
Set accessor for reqBusy; see the owning property description for semantics and side effects.
reqDone.Get
Get accessor for reqDone; see the owning property description for semantics and side effects.
reqDone.Set
Set accessor for reqDone; see the owning property description for semantics and side effects.
reqError.Get
Get accessor for reqError; see the owning property description for semantics and side effects.
reqError.Set
Set accessor for reqError; see the owning property description for semantics and side effects.
ModbusMaster.ClientStats
Aggregate data structure: sums all registered request history, counts active communication states and calculates a weighted successful-duration mean. See USER-GUIDE.md for exact semantics.
TYPE ClientStats :
STRUCT
doneCnt : ULINT; // Sum over every registered request, including inactive requests.
errorCnt : ULINT;
sentCnt : ULINT;
replyCnt : ULINT;
exceptionCnt : ULINT;
timeoutCnt : ULINT;
offlineCnt : ULINT; // Sum of request online-to-offline transitions.
requestCount : UINT;
activeCount : UINT;
onlineCount : UINT;
offlineCount : UINT;
unknownCount : UINT; // Active, neither online nor offline yet.
busyCount : UINT;
staleCount : UINT; // Active read requests only.
heldWriteCount : UINT;
totalValidDuration : ULINT; // Milliseconds, all successful requests.
averageValidDuration : ULINT; // Weighted mean = totalValidDuration / doneCnt.
longestValidDuration : UDINT; // Maximum request maximum, milliseconds.
active : BOOL;
online : BOOL; // At least one active request and all active requests online.
offline : BOOL; // At least one active request and all active requests explicitly offline.
toString : STRING(64);
END_STRUCT
END_TYPE