×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ, Entry ID: 22637440, Entry date: 01/26/2017
(1)
Rate

How do you program the instruction AG_CNTRL (FC10)?

  • Entry
  • Associated product(s)
You can use the AG_CNTRL (FC10) instruction to diagnose connections. If required, you can initialize a new connection setup via the instruction.

The following actions can be executed via parameterizable commands:

  • Reading out connection data
    Based on the status data of all or individual CP connections you can decide whether or not it is useful to reset the connections.
  • Resetting configured connections
    You can reset single connections or all the connections of a CP.
  • Disconnecting and re-establishing active connections

The AG_CNTRL (FC10) instruction is supported by the following Industrial Ethernet CPs:

Article numberFirmware versionDescription / Entry ID
CP 343-1
6GK7343-1EX21-0XE0V1.0.17 and higherDelivery release: 20750998
Manual: 22259495
6GK7343-1EX30-0XE0V2.0.16 and higher

With firmware V3.0.23 and higher the CP supports the new AG_CNTEX instruction for connection diagnostics. The AG_CNTEX instruction provides extensions compared with the AG_CNTRL instruction. All the functions of the AG_CNTRL instruction are included in the AG_CNTEX instruction and can be used identically at the interface in the user program.


Manual: 24485272

CP 343-1 Lean
6GK7343-1CX10-0XE0V2.1 and higherFirmware update V2.1: 32599720
Manual: 23643456
CP 343-1 Advanced
6GK7343-1GX21-0XE0V1.0.24 and higherDelivery release: 22037563
Manual: 22261695
6GK7343-1GX30-0XE0V1.0.23 and higherManual: 28017299
6GK7343-1GX31-0XE0V3.0.33 and higher

The CP supports the new AG_CNTEX instruction for connection diagnostics. The AG_CNTEX instruction provides extensions compared with the AG_CNTRL instruction. All the functions of the AG_CNTRL instruction are included in the AG_CNTEX instruction and can be used identically at the interface in the user program.


Manual: 68427475

CP443-1
6GK7443-1EX20-0XE0V1.0.26 and higherDelivery release: 26685738
Manual: 27013386
6GK7443-1EX30-0XE0V3.0.90 and higher

The CP supports the new AG_CNTEX instruction for connection diagnostics. The AG_CNTEX instruction provides extensions compared with the AG_CNTRL instruction. All the functions of the AG_CNTRL instruction are included in the AG_CNTEX instruction and can be used identically at the interface in the user program.


Manual: 59187251

CP443-1 Advanced
6GK7443-1EX40-0XE0V2.2 and higherFirmware update: V2.2: 22008900
6GK7443-1EX41-0XE0V1.0.24 and higherManual: 23643789
6GK7443-1GX20-0XE0V2.0 and higherManual: 28011203
6GK7443-1GX30-0XE0V3.0.90 and higher

The CP supports the new AG_CNTEX instruction for connection diagnostics. The AG_CNTEX instruction provides extensions compared with the AG_CNTRL instruction. All the functions of the AG_CNTRL instruction are included in the AG_CNTEX instruction and can be used identically at the interface in the user program.


Manual: 59187252


Table 1

Instructions
In STEP 7 V5.x, the FC10 "AG_CNTRL" block is included in the SIMATIC_NET_CP library. Open the SIMATIC_NET_CP library in the SIMATIC Manager via the menu "File > Open".
The FC10 "AG_CNTRL" for the S7-300 is in the SIMATIC_NET_CP library under "CP 300 > Blocks".
The FC10 "AG_CNTRL" for the S7-400 is in the SIMATIC_NET_CP library under "CP 400 > Blocks".
Copy the FC10 "AG_CNTRL" from the SIMATIC_NET_CP library and paste it in your S7 program.

In STEP 7 (TIA Portal) you will find the instruction in the "Instructions" task card under "Communication > Communications Processor > SIMATIC NET CP > Open User Communication".

Fig. 1 shows the call of the AG_CNTRL instruction in the user program of the CPU.



Fig. 1

Table 2 shows the input parameters of the AG_CNTRL (FC10) instruction.

Input parameter Description
ACT Activating the block
ID Connection number

Note
The connection number is to be taken from the configuration.
LADDR Module starting address

Note
The module starting address is to be taken from the Hardware Configuration.
CMD Command to FC10 "AG_CNTRL"

Table 2

Table 3 shows the output parameters of the AG_CNTRL (FC10) instruction.

Output parameter Description
DONE The Status parameter indicates whether the order has been executed error-free.
ERROR Error display
STATUS Status display
RESULT1 Feedback as per command to the FC10 "AG_CNTRL"
RESULT2 Feedback Part 2 as per command to the FC10 "AG_CNTRL

Note
Output parameter RESULT2 is evaluated only for S7-400.

Table 3

Below we show calls of the AG_CNTRL instruction with different commands:

Read out connection status CMD = 1
The AG_CNTRL instruction is called with CMD = 1 (CN_STATUS - connection status). This command delivers the status of the connection which has been selected with ID.


Fig. 2

The output parameter RESULT1 has the value 0000 7017H. The value of output parameter RESULT1 is evaluated bit by bit.

BitValue / Description
Bits 0-3: Displays for the Send direction
Bit 0

Connection type

  • 1: Connection reserved for Send and Receive jobs
  • 0: No Send and Receive connection
Bit 1

Status of current job

  • 1: Send job is being processed
  • 0: No Send job is being processed
Bits 2 and 3

Previous job

  • 01: Previous Send job completed positively
  • 10: Previous Send job completed negatively
  • 00: No information available about the previous Send job
Bits 4-7: Displays for the Receive direction
Bit 4

Connection type

  • 1: Connection reserved for Send and Receive jobs
  • 0: No Send and Receive connection
Bit 5

Status of current job

  • 0: No Receive job is being processed
  • 1: Receive job is being processed
Bits 6 and 7

Previous job

  • 00: No information available about the previous Receive job
Bits 8-11: Displays for FETCH/WRITE
Bit 8

Connection type

  • 0: No FETCH connection
  • 1: Connection reserved for FETCH jobs
Bit 9

Connection type

  • 0: No WRITE connection
  • 1: Connection reserved for WRITE jobs
Bit 10

Job status (FETCH/WRITE)

  • 0: Job status OK
  • 1: Job status NOT OK, for example:
    The CPU has acknowledged the job negatively
    The job could not be forwarded to the CPU because the connection was in the "LOCKED" status.
    The job has been rejected because the FETCH/WRITE header has not been configured correctly.
Bit 11

Status (FETCH/WRITE)

  • 0: No job is running
  • 1: A job is running from the LAN
Bits 12-15: General CP information
Bits 12 and 13

Information about the connection status

  • 11: Connection has been established
  • 00: Connection has been disconnected
  • 01: Connection is being established
  • 10: Connection is being disconnected
Bit 14

CP information:

  • 1: CP in RUN
  • 0: CP in STOP
Bit 15

Reset ID

  • 0: The AG_CNTRL has not yet made a connection reset or the reset ID has been canceled.
  • 1: The AG_CNTRL has made a connection reset.
Bits 16 to 31

Reserved

  • 0: Reserved for later extensions

Table 4

Reset connection CMD = 2
The AG_CNTRL instruction is called with CMD = 2 (CN_RESET - connection reset). This command resets the connection that has been selected with ID.


Fig. 3

The output parameter RESULT1 has the value 0000 0001H, which means the Reset job has been transferred successfully to the CP.

Value of the parameter RESULT1Description
0000 0001HThe Reset job has been transferred successfully to the CP. Disconnection and subsequent establishment of the connection has been triggered.
0000 0002HThe Reset job could not be transferred to the CP because the service has not been started in the CPU (CP in STOP, for example).

Table 5

Status of all connections CMD = 3
The AG_CNTRL instruction is called with CMD = 3 (CN_STATUS_ALL - status of all connections). This command supplies the status of all connections (established/disconnected) in the RESULT1/2 parameters (a total of 8 bytes of group information). The parameter ID must be set to "0" (is checked for 0).


Fig. 4

The output parameter RESULT1 has the value 0000 0007H, which means that connections number 1, 2 and 3 are established and connections 4 to 32 are disconnected or not configured.
The output parameter RESULT2 has the value 0000 0000H, which means that connections 33 to 64 are disconnected or not configured.


ParameterValue / Description
RESULT1

32 Bit: Connections 1 to 32

  • 0: Connection disconnected / not configured
  • 1: Connection established
RESULT2

32 Bit: Connections 33 to 64

  • 0: Connection disconnected / not configured
  • 1: Connection established

Table 6

Note

  • All the feedback values supplied are only conclusive if the corresponding SEND/RECEIVE block has been called beforehand for the connection under consideration.
  • A description of the AG_CNTRL instruction and the evaluation of the parameters are available in the manual "SIMATIC STEP 7 Professional V14", in the section entitled AG_CNTRL (S7-300, S7-400), and in the manual "System and Standard Functions for S7-300/400 Volume 1 and Volume 2" in Entry ID 44240604.
  • Entry ID 33414377 includes an overview of the commands (CMD) that are supported by the above-mentioned IE CPs.
Security information
In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.