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 function blocks for the access to system functions of the PLC Controller (BCxxxx Controller).

Requirements

Newer firmware version of the PLC Controller:

BC2000 version : B5 and upwards

BC3100 version : BF and upwards

BC4000 version : B3 and upwards

BC7300 version : B3 and upwards

BC8x00 version : B2 and upwards

BC9000 version: B4 and upwards

Some of the functions have dummy input parameter ( bDummy : BOOL ). The compiler requires at least one input parameter for functions. You can set this parameter to TRUE or FALSE.

Contents of the library:

Function block

Name | Description
GetSysInfo | Reads the system information of the PLC Controller
GetSysTick | Reads the the internal system tick of the PLC Controller
PresetSysTick | Sets the internal system tick of the PLC Controller
GetFBusStatus | Reads the fieldbus state of the PLC Controller
GetTBusStatus | Reads the terminal bus state
TrigTBusCycle | Triggers the terminal bus state
Reboot | Reset of the PLC Controller


GetSysInfo

TwinCAT PLC Library: System BC

FUNCTION GetSysInfo

The "GetSysInfo" function allows system information relating to the PLC Controller to be read.

FUNCTION GetSysInfo : WORD

VAR_INPUT

VAR_INPUT
    bDummy: BOOL(*At least one input required for functions*)
END_VAR

The system information is encoded in the return parameter as follows:

Return value | Description
Bit 0 set | The fieldbus and terminal bus status information is available
Bit 1 set | The system tick is present (controllers with older firmware do not support this feature).
Bit 2 set | The PLC cycle time watchdog monitoring is active.
Bits 3- 15 | reserved
Development environment | Target system type | PLC libraries to include
TwinCAT v2.7.0 and above | BCxxxx (165) | PlcSystemBC.Lb6


GetSysTick

FUNCTION GetSysTick

The "GetSysTick" function can read the value of the internal system tick. The PLC Controller's system tick is a 32 bit counter that is incremented every millisecond. The counter is cleared by a reset or when the controller is powered down, but can be set to a particular value by means of the PresetSysTick function.

FUNCTION GetSysTick : DWORD

VAR_INPUT

VAR_INPUT
    bDummy: BOOL(*At least one input required for functions*)
END_VAR

Development environment | Target system type | PLC libraries to include
TwinCAT v2.7.0 and above | BCxxxx (165) | PlcSystemBC.Lb6


PresetSysTick

FUNCTION PresetSysTick

The "PresetSysTick" function can set the value of the internal system tick. The PLC Controller's system tick is a 32 bit counter that is incremented every millisecond. When successful, the function supplies the new value of the system tick as its return parameter.

FUNCTION PresetSysTick : DWORD

VAR_INPUT

VAR_INPUT
    iVAlue : DWORD;
END_VAR

iValue: The new value of the system tick.

Development environment | Target system type | PLC libraries to include
TwinCAT v2.7.0 and above | BCxxxx (165) | PlcSystemBC.Lb6


GetFBusStatus

FUNCTION GetFBusStatus

The PLC Controller can be connected to a fieldbus as a participating device. The status of the fieldbus can be determined with the function "GetFBusStatus".

FUNCTION GetFBusStatus : WORD

VAR_INPUT

VAR_INPUT
    bDummy: BOOL(*At least one input required for functions*)
END_VAR

The fieldbus status is encoded in the return parameter as follows:

Controller type | Value | Description
BC2000 | 0 | Fieldbus OK
 | Bit 0 set | Fieldbus error
 | Bits 1- 15 | reserved
BC3100 | 0 | Fieldbus OK
 | Bit 0 set | Fieldbus errors
 | Bits 1- 3 | reserved
 | Bits 4- 5 | DP-State: 0: Slave in WAIT-PRM (no connection to the Master) 1: Slave in WAIT-CFG (start-up) 2: Slave in DATA-EXCH (OK)
 | Bits 6- 7 | WD-State: 0: Baud rate is being sought 1: Baud rate found 2: Communication monitoring activated
 | Bits 8- 11 | Baud rate: 0: 12 Mbaud 1: 6 Mbaud 2: 3 Mbaud 3: 1.5 Mbaud 4: 500 kbaud 5: 187.5 kbaud 6: 93.75 kbaud 7: 45.45 kbaud 8: 19.2 kbaud 9: 9.6 kbaud
 | Bits 12- 15 | reserved
BC9000 | Bit 0 set | Error in AMS/ADS communication
 | Bit 1 set | Error MODBUS/TCP
 | Bits 2- 14 | reserved
 | Bit 15 set | No LINK (no communication with the fieldbus)

Development environment | Target system type | PLC libraries to include
TwinCAT v2.7.0 and above | BCxxxx (165) | PlcSystemBC.Lb6


GetTBusStatus

FUNCTION GetTBusStatus

The terminal bus status can be read by the function "GetTBusStatus".

FUNCTION GetTBusStatus : WORD

VAR_INPUT

VAR_INPUT
    bDummy: BOOL(*At least one input required for functions*)
END_VAR

The return parameter has the following significance:

Return value | Description
Bit 0 set | General K-bus error
Bit 1 set | General configuration error
Bits 2- 3 | reserved
Bit 4 set | PLC cycle time monitoring
Bits 5- 15 | reserved
Development environment | Target system type | PLC libraries to include
TwinCAT v2.7.0 and above | BCxxxx (165) | PlcSystemBC.Lb6


TrigTBusCycle

FUNCTION TrigTBusCycle

The "TrigTBusCycle" can be used to trigger an additional terminal bus cycle from the PLC task.

FUNCTION TrigTBusCycle : INT

VAR_INPUT

VAR_INPUT
    iProcessImage 	: UINT; (* 0-3 *)
END_VAR

iProcessImage: The number of the process image. Permitted values 0-3.

The error codes are encoded in the return parameter of the function as follows:

Return value | Description
0 | no error
1 | Terminal bus error
2 | Access was refused. Terminal bus is active.
3 | Process Image not initialised
-2 | Invalid number for the process image. The permitted range is 0 - 3

Development environment | Target system type | PLC libraries to include
TwinCAT v2.7.0 and above | BCxxxx (165) | PlcSystemBC.Lb6


Reboot

FUNCTION Reboot

The function Reboot resets the bus terminal controler (BCxxxx).

FUNCTION Reboot : WORD

VAR_INPUT

VAR_INPUT
    bDummy	: BOOL(*At least one input required for functions*)
END_VAR

Development environment | Target system type | PLC libraries to include
TwinCAT v2.7.0 and above | BCxxxx (165) | PlcSystemBC.Lb6