Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH & Co. KG, Germany.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


Overview

The library contains useful function blocks for the IP/network configuration of the BC9000 Bus Controller.

Function blocks

Name | Description
FB_AddDnsServer | Pass the DNS server.
FB_GetHostByAddr | Find the host name from the associated IP address.
FB_GetHostByName | Find the IP address from the host name.
FB_GetNetworkConfig | Read at the current network communication.
FB_SetTargetName | Set the Bus Controller's target name.


FB_AddDnsServer

Up to a maximum of three DNS servers can be passed to the Bus Controller with this function block.

INPUT

VAR_INPUT
   bStart      : BOOL;
   sDNSServer  : STRING(15);
END_VAR

bStart: The function block is activated by a rising edge at this input.

sDNSServer: A string containing the IP address of the DNS server.

OUTPUT

VAR_OUTPUT
   bBusy       : BOOL;
   bError      : BOOL;
   iErrorId    : WORD;
END_VAR

bBusy: This output remains TRUE until execution of the command is complete.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in iErrorId.

iErrorId: Contains the command-specific error code of the most recently executed command (see table).

Development environment | Target platform | PLC libraries to be linked
TwinCAT v2.7.0 and above | BC9xxx (165) firmware version >=0xB6 | TcIPUtilitiesBC.Lb6


FB_GetHostByAddr

This function block can determine the host name associated with a specified IP address.

INPUT

VAR_INPUT
   bStart          : BOOL;
   sIPAddr         : STRING(15);
   pHostName       : DWORD;
   cbMaxNameLen    : WORD;
END_VAR

bStart: The function block is activated by a rising edge at this input.

sIPAddr: A string containing the IP address of the host.

pHostName: Contains the address of a string buffer into which the host name that has been found is written. It is the programmer who is responsible for dimensioning the buffer appropriately so that cbMaxNameLen bytes can be removed from it. The address can be determined with the ADR operator.

cbMaxNameLen: Contains the length, in bytes, of the buffer into which the host name that has been found is to be written.

OUTPUT

VAR_OUTPUT
   bBusy           : BOOL;
   bError          : BOOL;
   iErrorId        : WORD;
END_VAR

bBusy: This output remains TRUE until execution of the command is complete.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in iErrorId.

iErrorId: Contains the command-specific error code of the most recently executed command (see table).

Development environment | Target platform | PLC libraries to be linked
TwinCAT v2.7.0 and above | BC9xxx (165) firmware version >=0xB6 | TcIPUtilitiesBC.Lb6


FB_GetHostByName

This function block can determine the IP address associated with a specified host name.

INPUT

VAR_INPUT
bStart        : BOOL;
pHostName     : DWORD;
END_VAR

bStart: The function block is activated by a rising edge at this input.

pHostName: Contains the address of a string variable with the host name. The address of a string variable can be determined with the ADR operator.

OUTPUT

VAR_OUTPUT
   bBusy      : BOOL;
   bError     : BOOL;
   iErrorId   : WORD;
   sIPAddr    : STRING(15);
END_VAR

bBusy: This output remains TRUE until execution of the command is complete.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in iErrorId.

iErrorId: Contains the command-specific error code of the most recently executed command (see table).

sIPAddr: When successful, this variable contains the IP address of the host.

Development environment | Target platform | PLC libraries to be linked
TwinCAT v2.7.0 and above | BC9xxx (165) firmware version >=0xB6 | TcIPUtilitiesBC.Lb6


FB_GetNetworkConfig

This function block can determine information on the current network configuration.

INPUT

VAR_INPUT
   bStart             : BOOL;
END_VAR

bStart: The function block is activated by a rising edge at this input.

OUTPUT

VAR_OUTPUT
   bBusy              : BOOL;
   bError             : BOOL;
   iErrorId           : WORD;
   sMacId             : STRING(17);
   sIPAddr            : STRING(15);
   sSubnetMask        : STRING(15);
   sDefaultGateway    : STRING(15);
   sDnsServer         : STRING(15);
   sTargetName        : STRING(20);
END_VAR

bBusy: This output remains TRUE until execution of the command is complete.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in iErrorId.

iErrorId: Contains the command-specific error code of the most recently executed command (see table).

sMacId: Returns the MAC ID of the Bus Controller, for example '00-01-05-13-45-63'.

sIPAddr: Returns the IP address of the Bus Controller.

sSubnetMask: Returns the SubNet mask.

sDefaultGateway: Returns the default gateway.

sDnsServer: Returns the default DNS server (assigned by the DHCP server).

sTargetName: Returns the Bus Controller's current target name.

Development environment | Target platform | PLC libraries to be linked
TwinCAT v2.7.0 and above | BC9xxx (165) firmware version >=0xB6 | TcIPUtilitiesBC.Lb6


FB_SetTargetName

With this function block a target name can be assigned to the Bus Controller.

INPUT

VAR_INPUT
   bStart           : BOOL;
   sTargetName      : STRING(20);
END_VAR

bStart: The function block is activated by a rising edge at this input.

sTargetName: A string containing the new target name of the Bus Controller.

OUTPUT

VAR_OUTPUT
   bBusy            : BOOL;
   bError           : BOOL;
   iErrorId         : WORD;
END_VAR

bBusy: This output remains TRUE until execution of the command is complete.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in iErrorId.

iErrorId: Contains the command-specific error code of the most recently executed command (see table).

Development environment | Target platform | PLC libraries to be linked
TwinCAT v2.7.0 and above | BC9xxx (165) firmware version >=0xB6 | TcIPUtilitiesBC.Lb6


Error codes

Hex | Description
0x8010 | invalid parameter
0x8011 | DNS server list is full
0x801F | Resource error (internal)
0x8020 | invalid host length
0x8021 | no hostname founded
0x802E | Heap error (internal)
0x802F | Resource error (internal)
0x8030 | invalid parameter
0x8031 | invalid hostname
0x8032 | Hostname too long
0x803F | Resource error (internal)
0x804F | Resource error (internal)
0x8050 | no valid IP-Address
0x8052 | no class-D IP-Address
0x8055 | Error inside stack (internal)
0x805F | Resource error (internal)
0x8100 | invalid parameter
0x8102 | no open connection
0x8104 | no remote data
0x8106 | Buffer overrun (only UDP)
0x8200 | Connection already opened
0x8201 | Connect error
0x8202 | Timeout
0x8203 | Resource error (internal)
0x8300 | Timeout
0x8301 | Remote connection shutdown
0x8302 | Internal error
0x8303 | Resource error (internal)
0x8304 | no remote connection
0x8400 | Connection not opened
0x8401 | Timeout
0x8800 | no valid network configuration, for example DHCP is still active
0x8F10 | Session not activated
0x8F11 | Session not ready
0x8F12 | invalid session ID
0x8F13 | invalid state (intern)
0x8F20 | no free slot. There are 2 sessions activated
0x8F21 | Error during task initialization
0x8F22 | Session is already closed