F_iecInitAOEntry
The function F_iecInitAOEntry configures application objects (Single Points, Double Points, Measured Values...) as linear table entries. The table element (array element ) to be configured has to be given to the function as VAR_IN_OUT function parameter.
FUNCTION F_iecInitAOEntry: UDINT
VAR_INPUT
eType : E_IEC870_5_101TcTypeID := ASDU_TYPEUNDEF;
objAddr : DWORD := 0;
group : DWORD := 0;
multiplier : BYTE := 0;
ioMapType : E_IEC870_5_101IOMappingType := MAP_AREA_NONE;
byteOffs : UDINT := 0;
bitOffs : UDINT := 0;
END_VAR
VAR_IN_OUT
dbEntry : ST_IEC870_5_101AODBEntry;
END_VAR
eType: Type of application object, ASDU identifier (e.g..: M_SP_NA_1 for Single Point or M_DP_NA_1 for Double Point ).
objAddr : Object address, any address can be given.
group: Object group configuration flags. See: Description of all Group Flags. The flags can be combined with OR-Linking. Not all combinations are sensefull!
multiplier: Base cycle time multiplicator for cyclic/periodic data transfer. 0 = disabled. The base cycle time can be configured by the tPerCyclicBase- parameter in the system parameters.
ioMapType: TwinCAT PLC process data range. This parameter defines how the TwinCAT PLC and IEC applicatation object process data are to be mapped.
byteOffs: TwinCAT PLC process data byte offset.
bitOffs: TwinCAT PLC process data bit offset.
dbEntry: Application object to be configured (array element).
Return value | Description |
---|---|
0 | No error. |
<> 0 | Error: IEC60870-5-10x error code |
Example in ST:
Configuration of three datapoints as linear table entries.
eType | objAddr | group | multiplier | ioMapType | byteOffs | bitOffs |
---|---|---|---|---|---|---|
M_SP_NA_1 | 100 | IEC870_GRP_INRO1 | 0 | MAP_AREA_MEMORY | 100 | 0 |
M_DP_NA_1 | 200 | IEC870_GRP_INROGEN | 0 | MAP_AREA_DATA | 200 | 0 |
M_IT_NA_1 | 800 | IEC870_GRP_REQCOGEN | 0 | MAP_AREA_MEMORY | 800 | 0 |
VAR_GLOBAL CONSTANT
MIN_TABLE_IDX : INT := 0;
MAX_TABLE_IDX : INT := 49;
END_VAR
PROGRAM P_LinearTableConfig
VAR_IN_OUT
AODB : ARRAY[MIN_TABLE_IDX..MAX_TABLE_IDX] OF ST_IEC870_5_101AODBEntry;
END_VAR
VAR
init : BOOL := TRUE;
initError : UDINT;
END_VAR
IF init THEN
init := FALSE;
initError := F_iecInitAOEntry( eType := M_SP_NA_1,
objAddr := 100,
group := IEC870_GRP_INRO1,
multiplier := 0,
ioMapType := MAP_AREA_MEMORY,
byteOffs := 100,
bitOffs := 0,
dbEntry := AODB[0] );
IF initError <> 0 THEN
ADSLOGSTR( ADSLOG_MSGTYPE_ERROR OR ADSLOG_MSGTYPE_LOG,
'F_iecInitAOEntry() error: %s',
DWORD_TO_HEXSTR( initError, 8, FALSE ) );
RETURN;
END_IF
initError := F_iecInitAOEntry( eType := M_DP_NA_1,
objAddr := 200,
group := IEC870_GRP_INROGEN,
multiplier := 0,
ioMapType := MAP_AREA_DATA,
byteOffs := 200,
bitOffs := 0,
dbEntry := AODB[1] );
IF initError <> 0 THEN
ADSLOGSTR( ADSLOG_MSGTYPE_ERROR OR ADSLOG_MSGTYPE_LOG,
'F_iecInitAOEntry() error: %s',
DWORD_TO_HEXSTR( initError, 8, FALSE ) );
RETURN;
END_IF
initError := F_iecInitAOEntry( eType := M_IT_NA_1,
objAddr := 800,
group := IEC870_GRP_REQCOGEN,
multiplier := 0,
ioMapType := MAP_AREA_MEMORY,
byteOffs := 800,
bitOffs := 0,
dbEntry := AODB[2] );
IF initError <> 0 THEN
ADSLOGSTR( ADSLOG_MSGTYPE_ERROR OR ADSLOG_MSGTYPE_LOG,
'F_iecInitAOEntry() error: %s',
DWORD_TO_HEXSTR( initError, 8, FALSE ) );
RETURN;
END_IF
END_IF
Requirements
Development Environment | Target System | PLC libraries to include |
---|---|---|
TwinCAT v2.9.0 Build >= 1030 | PC or CX (x86) | TcIEC870_5_101.Lib |
TwinCAT v2.10.0 Build >= 1301 | CX (ARM) |