FC_GetActualCountByLogAddr - General Information

Overview

Type:

Function

Available as of:

SystemInterface_1.32.6.0

Versions:

Current version

Task

Determine the number of objects (for example, servo amplifier) in the PLC configuration.

Description

This function returns the configured number of an object based on its logical address i_stLogAdr. This method allows you to determine how many servo amplifiers have been configured.

Interface

Input

Data type

Description

i_stLogAdr

ST_LogicalAddress

Logical address of the object

Return Value

Data type

Description

DINT

-1: An error is detected

0: The object that is searched for is not configured

>0: Configured number of the object

Example

The number of Sercos slaves in the PLC configuration is to be determined.

PROGRAM PLC_PRG 
VAR 
   xStart : BOOL := TRUE; 
   diNumberOfDrives : DINT; 
   diNumberOfLXM62DxS : DINT; 
   diNumberOfILM62 : DINT; 
   diNumberOfLXM62PS : DINT; 
END_VAR 
IF xStart THEN 
   xStart := FALSE; 
   diNumberOfLXM62DxS := GetActualCountByLogAddr(LXM62DxS_TYPE);
   diNumberOfILM62 := GetActualCountByLogAddr(ILM62_TYPE);
   diNumberOfLXM62PS := GetActualCountByLogAddr(LXM62PS_TYPE);
   diNumberOfDrives := diNumberOfLXM62DxS + diNumberOfILM62;
END_IF