You are on page 1of 24

Documentation for

PHOENIX CONTACT function blocks

Function block

ANL_IL_SGI_2P_EF_3

for the PC Worx control system

April 20, 2018/FBL

Documentation for
PHOENIX CONTACT function blocks
PHOENIX CONTACT GmbH & Co. KG
Flachsmarktstraße 8
32825 Blomberg, Germany

ANL_IL_SGI_2P_EF_3_001.docx Page 1 of 24
ANL_IL_SGI_2P_EF_3

Table of contents
1 General information ........................................................................................................ 4
2 Block versions/Change notes ......................................................................................... 4
3 Releases ........................................................................................................................ 4
4 ANL_IL_SGI_2P_EF ...................................................................................................... 5
4.1 Block call ................................................................................................................. 5
4.2 Input parameters ..................................................................................................... 5
4.3 Output parameters .................................................................................................. 6
4.4 Input and output parameters ................................................................................... 6
4.5 Diagnostics ............................................................................................................. 6
5 ANL_IL_SGI_2P_EF_Para ............................................................................................. 8
5.1 Block call ................................................................................................................. 8
5.2 Input parameters ..................................................................................................... 9
5.3 Output parameters .................................................................................................. 9
5.4 Input and output parameters ................................................................................... 9
6 ANL_IL_SGI_2P_EF_Adju ............................................................................................10
6.1 Block description ....................................................................................................10
6.2 Block call ................................................................................................................10
6.3 Input parameters ....................................................................................................11
6.4 Output parameters .................................................................................................11
6.5 Input and output parameters ..................................................................................11
7 ANL_IL_SGI_2P_EF_Val ..............................................................................................12
7.1 Block description ....................................................................................................12
7.2 Block call ................................................................................................................12
7.3 Input parameters ....................................................................................................13
7.4 Output parameters .................................................................................................13
7.5 Input and output parameters ..................................................................................13
8 ANL_IL_SGI_2P_EF_DIDE ...........................................................................................14
8.1 Block description ....................................................................................................14
8.2 Block call ................................................................................................................14
8.3 Input parameters ....................................................................................................14
8.4 Output parameters .................................................................................................14
8.5 Input and output parameters ..................................................................................14
9 ANL_IL_SGI_2P_EF_DIEN ...........................................................................................15
9.1 Block description ....................................................................................................15
9.2 Block call ................................................................................................................15

ANL_IL_SGI_2P_EF_3_001.docx Page 2 of 24
ANL_IL_SGI_2P_EF_3

9.3 Input parameters ....................................................................................................15


9.4 Output parameters .................................................................................................15
9.5 Input and output parameters ..................................................................................15
10 Startup instruction .........................................................................................................16
10.1 INTERBUS .............................................................................................................16
10.1.1 Only channel 1 is used: ...................................................................................16
10.1.2 Channel 1 and channel 2 are used: .................................................................17
10.2 PROFINET .............................................................................................................19
10.2.1 Only channel 1 is used: ...................................................................................19
10.2.2 Channel 1 and channel 2 are used: .................................................................20

ANL_IL_SGI_2P_EF_3_001.docx Page 3 of 24
ANL_IL_SGI_2P_EF_3

1 General information
We recommend the ANL_IL_SGI_2P_EF (2702373) function block when using the IB IL SGI
2P EF module.
For easier handling, the following function blocks are available: ANL_IL_SGI_2P_EF_Para,
ANL_IL_SGI_2P_EF_Adju, ANL_IL_SGI_2P_EF_Val, ANL_IL_SGI_2P_EF_DIEN, and
ANL_IL_SGI_2P_EF_DIDE.
The ANL_IL_SGI_2P_EF_Para and ANL_IL_SGI_2P_EF_Adju function blocks are sufficient
to start up the IB IL SGI 2P EF module.
The ANL_IL_SGI_2P_EF_Val function block is for decoding the measurement data. The
ANL_IL_SGI_2P_EF_DIEN and ANL_IL_SGI_2P_EF_DIDE function blocks can be used for
decoding the error code of the ANL_IL_SGI_2P_EF block.
In addition, the Asyn_Com library is required for startup.

Block Description
ANL_IL_SGI_2P_EF Communication with the module
ANL_IL_SGI_2P_EF_Para Decoding of the configuration parameters of a channel
ANL_IL_SGI_2P_EF_Adju Calibration of a channel
ANL_IL_SGI_2P_EF_Val Decoding of the measurement data of a channel
ANL_IL_SGI_2P_EF_DIEN Output of error texts in English
ANL_IL_SGI_2P_EF_DIDE Output of error texts in German

2 Block versions/Change notes

Version Description
1 Initial version
2 ANL_IL_SGI_2P_EF_2: Bug fix for
 In some cases xActive = TRUE after xActivate = FALSE.
 Sporadic RDREC error.
 Corrections and improvement of the documentation.
ANL_IL_SGI_2P_EF_VAL_2: Bug fix for
 xError = FALSE when bSelect = 0 (invalid).
 rVal = 0 while process data contain valid values.
3 ANL_IL_SGI_2P_EF_3: Bug fix

ANL_IL_SGI_2P_EF_DIDE/DIEN_2:
 Add new DiagCodes

3 Releases
These versions of function blocks do not require any licence.
These versions of function blocks are approved for all controller types.

ANL_IL_SGI_2P_EF_3_001.docx Page 4 of 24
ANL_IL_SGI_2P_EF_3

4 ANL_IL_SGI_2P_EF
This function block is for parameterization and communication with the IB IL SGI 2P EF
module.

4.1 Block call

4.2 Input parameters

Name Type Description


xActivate BOOL Rising edge: Activates the block
bSelect BYTE Selects the channel to be used
0: channel 1 and channel 2
1: channel 1
2: channel 2
xSetDefaultSettings BOOL Rising edge : Resets to factory defaults (PCP object
16#009A)
xReadExtValue BOOL Rising edge : Reads out measured and display values
xReadMinMaxVal BOOL Rising edge: Reads out min./max. values
xResetMinMaxVal BOOL Rising edge: Resets min./max. values
arrInputPD ANL_ARR_SGI_PD Input process data

ANL_IL_SGI_2P_EF_3_001.docx Page 5 of 24
ANL_IL_SGI_2P_EF_3

4.3 Output parameters

Name Type Description


xActive BOOL TRUE: The block is active
xError BOOL TRUE: Function block is in error state. Please refer
the udtSGI_Data.udtDiag.wDiagCode and
udtSGI_Data.udtDiag.dwAddDiagCode for details.
arrOutputPD ANL_ARR_SGI_PD Output process data

4.4 Input and output parameters

Name Type Description


udtSGI_Data ANL_UDT_SGI_2P_EF Data structure for IL_SGI_2P_EF
udtAsynCom ASYN_UDT_COM Communication structure Asyn_Com

4.5 Diagnostics

udtSGI_Data. udtSGI_Data.udtDiag. Description


udtDiag.wDiagCode dwAddDiagCode

16#0000 16#0000.0000 Block is not active

16#8100 16#0000.0000 Initialization

16#8000 16#0000.0000 Block is active

16#C110 Invalid input value


16#0000.0001 Invalid input bSelect

16#0000.0102 Invalid mean value- channel 1

16#0000.0202 Invalid mean value- channel 2


16#0000.0103 Invalid characteristic- channel 1

16#0000.0203 Invalid characteristic- channel 2

16#0000.0104 Invalid nominal load- channel 1


16#0000.0204 Invalid nominal load- channel 2

16#0000.0105 Invalid adjustment value- channel 1

16#0000.0205 Invalid adjustment value- channel 2

16#0000.0106 Invalid conversion time- channel 1

16#0000.0206 Invalid conversion time channel 2


16#C210 16#0000.0000 Device faulty

16#C211 16#0000.0000 Measured value invalid/no valid measured


value available
(e.g., because channel was not configured)

ANL_IL_SGI_2P_EF_3_001.docx Page 6 of 24
ANL_IL_SGI_2P_EF_3

16#C212 Measuring range exceeded (overrange)

16#0000.0100 Channel 1
16#0000.0200 Channel 2

16#C213 Below measuring range (underrange)

16#0000.0100 Channel 1
16#0000.0200 Channel 2

16#C214 Open circuit

16#0000.0100 Channel 1

16#0000.0200 Channel 2

16#C215 Supply voltage faulty

16#C310 Error PCP_CONNECT

16#0000.C410 Timeout PCP_CONNECT

16#XXXX.XXXX Error of PCP_CONNECT (see


documentation of PCP_CONNECT)

16#C311 Error PCP_READ

16#0000.C411 Timeout PCP_READ

16#XXXX.XXXX Error of PCP_READ (see documentation of


PCP_READ)

16#C312 Error PCP_WRITE

16#0000.C412 Timeout PCP_WRITE

16#XXXX.XXXX Error of PCP_WRITE (see documentation


of PCP_WRITE)

16#C350 RDREC error

16#0000.C411 Timeout RDREC


16#XXXX.XXXX Error of RDREC (see documentation of
RDREC)

16#C351 WRREC error

16#0000.C412 Timeout WRREC

16#XXXX.XXXX Error of WRREC (see documentation of


WRREC)
16#C411 16#0000.0000 Error while reading the firmware version

16#C510 Error of AsynCom function block

16#0000.0010 Error input strPartner/dwSlot


16#XXXX.XXXX See documentation of AsynCom function
block

ANL_IL_SGI_2P_EF_3_001.docx Page 7 of 24
ANL_IL_SGI_2P_EF_3

5 ANL_IL_SGI_2P_EF_Para
This function block parameterizes the main block. The input parameters, iFilter,
iCharacteristic, rNominalWeight, rAdjustValue and iConversionTime, of a channel are
transferred to the main block via the structure. The channel to be parameterized by the block
is selected via the bSelect input.

5.1 Block call

ANL_IL_SGI_2P_EF_3_001.docx Page 8 of 24
ANL_IL_SGI_2P_EF_3

5.2 Input parameters

Name Type Description


bSelect BYTE Selecting the channel
0: both channels
1: channel 1
2: channel 2
iFilter INT Setting the filter of the channel
0: 16-sample mean value
1: no mean value
2: 4-sample mean value
3: 32-sample mean value
4: dynamic filter
iCharacteristic INT Properties of the strain gauge characteristic
0 = ±1 mV/V
1 = ±2 mV/V
2= ±3 mV/V
3 = ±3.33 mV/V
4 = ±4 mV/V
5= ±5 mV/V
6 = ±6 mV/V
rNominalWeight REAL Nominal load of the strain gauge
(e.g. 10.00 for 10 kg)
rAdjustValue REAL Adjusted value in % of the nominal load
iConversionTime INT Conversion time of the analog-to-digital converter
0: 100 ms
1: 12.5 ms
2: 200 µs
3: 500 µs
4: 1 ms
5: 2 ms
6: 5 ms
7: 10 ms
8: 20 ms
9: 50 ms

5.3 Output parameters

Name Type Description


xError BOOL TRUE: Invalid value at bSelect (< 0 or > 2)

5.4 Input and output parameters

Name Type Description


udtSGI_Data ANL_UDT_SGI_2P_EF Data structure for IL_SGI_2P_EF

ANL_IL_SGI_2P_EF_3_001.docx Page 9 of 24
ANL_IL_SGI_2P_EF_3

6 ANL_IL_SGI_2P_EF_Adju
6.1 Block description

This auxiliary block supports the following functions:


Zero point: Once the input xZeroPoint is activated, the terminal determines the zero point,
and sets the status bit xZeroPoint to TRUE, when it is reached.
Contact Ka_Kb: A resistance can be added with the potential-free contact. The upper and
lower switching threshold can be defined via the variables wKa_Kb_Up and wKa_Kb_Dn.
The behavior of the contact can be defined via the input iKa_Kb. The contact is activated or
deactivated via the input xKa_Kb.
Adjustment: The terminal determines the current measured value and is adjusted to the
adjustment value. Each weight value is now displayed with the highest possible degree of
accuracy. Before the adjustment process can be performed, the zero point must be defined
and the scale loaded with the adjustment weight.
Tare: The tare function calculates the difference between the gross and net weight.

6.2 Block call

ANL_IL_SGI_2P_EF_3_001.docx Page 10 of 24
ANL_IL_SGI_2P_EF_3

6.3 Input parameters

Name Type Description


bSelect BYTE Selecting the channel
0: channel 1 and 2
1: channel 1
2: channel 2
xAdjust BOOL Rising edge: Adjusts (PCP object 16#0092)
xTara BOOL Rising edge: Tares (PCP object 16#0091)
xZeroPoint BOOL Rising edge: Sets zero point of the channel (PCP object 16#0092)
xKa_Kb BOOL Rising edge: Adjusts shunt (PCP object 16#00A0)

6.4 Output parameters

Name Type Description


xError BOOL Invalid value at bSelect (< 0 or > 2)

6.5 Input and output parameters

Name Type Description


udtSGI_Data ANL_UDT_SGI_2P_EF Data structure for IL_SGI_2P_EF

ANL_IL_SGI_2P_EF_3_001.docx Page 11 of 24
ANL_IL_SGI_2P_EF_3

7 ANL_IL_SGI_2P_EF_Val
7.1 Block description

This auxiliary block decrypts the data structure udtSGI_Data of the main block, and outputs
data like firmware version, measured values, min/max values, as well as display values.
The block also outputs some status information on the terminal.
This function block has to be instantiated separately for each channel.

7.2 Block call

ANL_IL_SGI_2P_EF_3_001.docx Page 12 of 24
ANL_IL_SGI_2P_EF_3

7.3 Input parameters

Name Type Description


bSelect BYTE Selecting the channel
1: channel 1
2: channel 2

7.4 Output parameters

Name Type Description

xError BOOL TRUE: Incorrect value at input bSelect


(< 1 or > 2)
xValid BOOL TRUE: The measured values output are valid
rVal REAL Standardized measured value of the specified channel (from process data)
wVal WORD Measured value as 16 bit value (= rVal)
rMinVal REAL Minimum value of the channel (from process data)
rMaxVal REAL Maximum value of the channel (from process data)
rDisplayVal REAL Display value of the channel (PCP object 16#0083)
rFloatVal REAL Value in extended float format of the channel (PCP object 16#0082)
xStandStill BOOL TRUE: Standstill reached (corresponding LED on display is on)
FALSE: Standstill not reached (corresponding LED on display is off)
(PCP object 16#0093)
xZeroPoint BOOL TRUE: Zero point reached (corresponding LED on display is on)
FALSE: Standstill not reached (corresponding LED on display is off)
(PCP object 16#0093)
xNettoValue BOOL TRUE: The tare function was activated; the net value is displayed
(corresponding LED on display is on)
FALSE: The tare function was not activated; the gross value is displayed
(corresponding LED on display is on)
(PCP object 16#0093)
xDefault BOOL TRUE: The adjustment values do not correspond to the default setting
FALSE: The adjustment values correspond to the default setting
(PCP object 16#0093)
wDeviceInfo WORD Firmware version and module ID

7.5 Input and output parameters

Name Type Description


udtSGI_Data ANL_UDT_SGI_2P_EF Data structure for IL_SGI_2P_EF

ANL_IL_SGI_2P_EF_3_001.docx Page 13 of 24
ANL_IL_SGI_2P_EF_3

8 ANL_IL_SGI_2P_EF_DIDE
8.1 Block description

In the event of an error at the main block, the block displays the diagnostics as text in
German. The source code is neither read- nor write-protected, and can be adapted by the
user to individual requirements. In this way, diagnostic messages can be changed,
expanded, or translated into a different language. The text output of the outputs strDiagInfo
and strAddDiagInfo is limited to 80 characters respectively.

8.2 Block call

8.3 Input parameters

Name Type Description


xError BOOL TRUE: An error has occurred
FALSE: No error has occurred

8.4 Output parameters

Name Type Description


strDiagInfo STRING The output displays the diagnostics of the main
block as German text.
strAddDiagInfo STRING The output displays the expanded diagnostics of
the main block as German text.

8.5 Input and output parameters

Name Type Description


udtSGI_Data ANL_UDT_SGI_2P_EF Data structure for IL_SGI_2P_EF

ANL_IL_SGI_2P_EF_3_001.docx Page 14 of 24
ANL_IL_SGI_2P_EF_3

9 ANL_IL_SGI_2P_EF_DIEN
9.1 Block description

In the event of an error at the main block, the block displays the diagnostics as text in
English. The source code is neither read- nor write-protected, and can be adapted by the
user to individual requirements. In this way, diagnostic messages can be changed,
expanded, or translated into a different language. The text output of the outputs strDiagInfo
and strAddDiagInfo is limited to 80 characters respectively.

9.2 Block call

9.3 Input parameters

Name Type Description


xError BOOL TRUE: An error has occurred
FALSE: No error has occurred

9.4 Output parameters

Name Type Description


strDiagInfo STRING The output displays the diagnostics of the main
block as English text.
strAddDiagInfo STRING The output displays the expanded diagnostics of
the main block as English text.

9.5 Input and output parameters

Name Type Description


udtSGI_Data ANL_UDT_SGI_2P_EF Data structure for IL_SGI_2P_EF

ANL_IL_SGI_2P_EF_3_001.docx Page 15 of 24
ANL_IL_SGI_2P_EF_3

10 Startup instruction
10.1 INTERBUS

10.1.1 Only channel 1 is used:

ANL_IL_SGI_2P_EF_3_001.docx Page 16 of 24
ANL_IL_SGI_2P_EF_3

10.1.2 Channel 1 and channel 2 are used:

ANL_IL_SGI_2P_EF_3_001.docx Page 17 of 24
ANL_IL_SGI_2P_EF_3

When using the IL_SGI_2P_EF_1 function block in an application under INTERBUS, the
AsynCom_ISB function block is also required for communication via PCP. The
communication between the two blocks takes place via the udtAsynCom structure.
The communication between the other blocks takes place via the udtSGI_Data structure.
The IN process data of the terminal is connected to the arrInputPD input. The OUT process
data is connected to the arrOutputPD output.

The ANL_IL_SGI_2P_EF_Para has always to stand on the top of the processing sequence.

The channels to be parameterized or read out, are specified via the bSelect inputs at the
function blocks.

ANL_IL_SGI_2P_EF_3_001.docx Page 18 of 24
ANL_IL_SGI_2P_EF_3

10.2 PROFINET

10.2.1 Only channel 1 is used:

ANL_IL_SGI_2P_EF_3_001.docx Page 19 of 24
ANL_IL_SGI_2P_EF_3

10.2.2 Channel 1 and channel 2 are used:

ANL_IL_SGI_2P_EF_3_001.docx Page 20 of 24
ANL_IL_SGI_2P_EF_3

When using the IL_SGI_2P_EF_1 function block in an application under INTERBUS, the
AsynCom_ISB function block is also required for communication via PCP. The
communication between the two blocks takes place via the udtAsynCom structure.
The communication between the other blocks takes place via the udtSGI_Data structure.
The IN process data of the terminal is connected to the arrInputPD input. The OUT process
data is connected to the arrOutputPD output.

The ANL_IL_SGI_2P_EF_Para has always to stand on the top of the processing sequence.

The channels to be parameterized or read out, are specified via the bSelect inputs at the
function blocks.

ANL_IL_SGI_2P_EF_3_001.docx Page 21 of 24
ANL_IL_SGI_2P_EF_3

11 Appendix
11.1 Data types

TYPE
(*Processdata*)
ANL_ARR_SGI_PD : ARRAY[0..2] OF WORD;

(*ANL_IL_SGI_2P_EF_Adju*)
ANL_UDT_SGI_ADJUST : STRUCT
(*Inputs*)
xAdjust : BOOL;
xSetZeroPoint : BOOL;
xTara : BOOL;
xKa_Kb : BOOL;
wKa_Kb : WORD;
wKa_Kb_Up : WORD;
wKa_Kb_Dn : WORD;
END_STRUCT;

(*ANL_IL_SGI_2P_EF_Para*)
ANL_UDT_SGI_PARA : STRUCT
(*Inputs*)
iFilter : INT;
iCharacteristic : INT;
rNominalWeight : REAL;
iConversionTime : INT;
rAdjustValue : REAL;
wAdjustValue : WORD;
wNominalWeight : WORD;
END_STRUCT;

(*ANL_IL_SGI_2P_EF_Val*)
ANL_UDT_SGI_VALUE : STRUCT
(*Outputs*)
rVal : REAL;
xValid : BOOL;

ANL_IL_SGI_2P_EF_3_001.docx Page 22 of 24
ANL_IL_SGI_2P_EF_3

rMinVal : REAL;
rMaxVal : REAL;
arrFloatValue : SGI_2P_PN_ARR_B_1_4;
arrDisplayValue : SGI_2P_PN_ARR_B_1_4;
xStandstill : BOOL;
xZeroPoint : BOOL;
xNettoValue : BOOL;
xDefault : BOOL;
END_STRUCT;

(*Diag struct*)
ANL_UDT_SGI_DIAG : STRUCT
wDiagCode : WORD;
dwAddDiagCode : DWORD;
END_STRUCT;

(*Struct for one channel*)


ANL_UDT_SGI_CHANNEL : STRUCT
udtAdjust : ANL_UDT_SGI_ADJUST;
udtPara : ANL_UDT_SGI_PARA;
udtVal : ANL_UDT_SGI_VALUE;
xSelected : BOOL; (*TRUE- Channel is active*)
xAdjust : BOOL;
xTara : BOOL;
xZeroPoint : BOOL;
xKa_Kb : BOOL;
wConfig : WORD;(*config parameter*)
(*padding*)
wPadding : DWORD;
END_STRUCT;

(*Array of channels*)
ANL_ARR_SGI_CHANNELS : ARRAY[1..2] OF ANL_UDT_SGI_CHANNEL;

ANL_UDT_SGI_2P_EF : STRUCT
iState : INT; (*actual State of the
statemachine*)

ANL_IL_SGI_2P_EF_3_001.docx Page 23 of 24
ANL_IL_SGI_2P_EF_3

wDeviceInfo : WORD; (*firmware of the


device*)
xConnect : BOOL; (*Activte the AysnCom-FB*)
xWrite : BOOL; (*activate write
service*)
xRead : BOOL; (*activate read service*)
iCNT : INT; (*number of data to be
read/write*)
wIndexWrite : WORD; (*PCP-command write*)
wSubIndexWrite : WORD; (*add. PCP-command write*)
wIndexRead : WORD; (*PCP-command read*)
wSubIndexRead : WORD; (*add. PCP-command read*)
iValue : INT; (*internal paramter*)
xConnectError : BOOL; (*Error during connection*)
xWriteDone : BOOL; (*Write process successfully
finished*)
xWriteError : BOOL; (*Error write*)
xNDR : BOOL; (*new data received*)
xReadError : BOOL; (*Error read*)
xConnectValid : BOOL; (*valid connection exits*)
xSetDefaultSettings : BOOL; (*reset on default
settings*)
udtDiag : ANL_UDT_SGI_DIAG; (*Diag
struct*)
arrCH : ANL_ARR_SGI_CHANNELS; (*Array of the
two channels*)
END_STRUCT;

END_TYPE

ANL_IL_SGI_2P_EF_3_001.docx Page 24 of 24

You might also like