System parameters
Here you can unpack the complete PLC sources: TutorialSample.zip
The common ASDU address and the user functions of the controlling station are configured via the system parameters.
In our introduction we configure the following system parameters:
- The common ASDU address is set to 7. (asduAddr);
- The octet size of cause of transmission is set to two octets (one octet COT + one octet originator address) (eCOTSize);
- The octet size of common asdu address is set to two octets (eAsduAddrSize);
- The octet size of information object address is set to three octets (eObjAddrSize);
- Logging of debugging messages in the application log is activated (dbgMode). Logging of device state changes and link layer errors is enabled;
Add the following PLC code to your PLC project:
IF init THEN
init := FALSE;
...
client.sysPara.asduAddr := 7;
client.sysPara.asduFmt.eCOTSize := eIEC870_COT_TwoOctets;(* cause of transfer octet size *)
client.sysPara.asduFmt.eAsduAddrSize := eIEC870_AsduAddr_TwoOctets;(* common ASDU address octet size *)
client.sysPara.asduFmt.eObjAddrSize := eIEC870_ObjAddr_ThreeOctets;(* information object address octet size *)
client.sysPara.dbgMode := IEC870_DEBUGMODE_DEVSTATE OR IEC870_DEBUGMODE_LINKERROR;(* IEC870_DEBUGMODE_ASDU OR IEC870_DEBUGMODE_LINKLAYER *)
...
ELSE
client( pInputs := ADR( inputs ),
cbInputs := SIZEOF( inputs ),
pOutputs := ADR( outputs ),
...
END_IF
The documentation for all system parameters can be found here: ST_IEC870_5_101SystemParams.