This repository contains official sample code for the product TF5500 | TwinCAT 3 MC3 Base offered by Beckhoff Automation. The sample code is provided as-is under the Zero-Clause BSD license.
TwinCAT 3 MC3 requires TwinCAT 3.1 Build >= 4026.23.1 and TE1300.ScopeViewProfessional.XAE is recommended.
These samples were created with TwinCAT 3 MC3 version 4.0.6.
Make sure to install the following packages for engineering system:
- TwinCAT.Standard.XAE
- TE1300.ScopeViewProfessional.XAE
- TF5500.MC3.Base.XAE (no runtime installation required - automatic deployment of runtime components to the target system during activation of configuration)
Make sure to install the following packages for runtime system:
- TwinCAT.Standard.XAR (Windows)
- TF3300.ScopeServer.XAR (Windows)
- tc31-xar-um (Beckhoff RT Linux® Runtime)
| Sample | What it shows |
|---|---|
| Gearing/Gearing | Electronic gearing (master/slave coupling) with MC_GearIn (stationary and with moving master) and MC_GearInPos (position-synchronized coupling), driven by a command state machine. Also demonstrates error propagation between coupled axes via ReactionToMasterError/ReactionToSlaveError and MC_TriggerError. |
| LoadControl/LoadControl | Pressure/load-controlled motion using MC_LoadControl on top of MC_MoveAbsolute moves. After a fast then slow approach, control switches from position to regulating a constant target pressure and generating pressure with a given curvature. |
| LoadControl/PressToTarget | A press-to-target workflow combining MC_MoveAbsolute/MC_MoveRelative with MC_LoadControl. The axis presses to position, builds up a defined load, then retracts to an intermediate position and returns home. Quiet similar to LoadControl sample. |
| PTP/AsyncAccessHwParameter | Non-blocking retrieval of hardware/drive parameters (identity, versions, motor nameplate, temperature, torque limits) via the AXIS_REF_EXTENDED.HardwareDrive.Parameter properties and ReadAsync() pattern from Tc3_MC3Ptp_Preview. Reads parameters sequentially, advancing only on completion to avoid blocking the cycle. |
| PTP/AxisParameter | Synchronous reading/writing of axis parameters (e.g. default acceleration) two equivalent ways: via the generic MC_Parameter function block and via direct property access on AXIS_REF_EXTENDED from Tc3_MC3Ptp_Preview, including parameter access error handling. |
| PTP/CouplingDifferentCores | Master/slave coupling with MC_GearIn across axes running in different tasks, priorities and CPU cores. The master runs in velocity mode while geared slaves follow, then all are halted, demonstrating synchronized multi-core coupling. |
| PTP/ErrorPropagation | How errors propagate between coupled master/slave axes through several selectable use-case function blocks plus a reset scenario. Focuses on understanding and controlling fault reactions in coupled motion. |
| PTP/ExperimentalExtSg | Custom external setpoint generation using MC_ActivateExternalSetpointGeneration with a user FB that computes a third axis's trajectory as the arithmetic sum of two other axes' setpoints or mathematical description. |
| PTP/ExternalSetpointGenMc3Nc2 | An MC3 axis following an NC2 master axis through an external setpoint generator implementing the MC3 setpoint-generator interface. Each cycle it reads the NC2 master's setpoint position/velocity/acceleration and feeds them into the MC3 slave, bridging the NC2 and MC3 platforms. |
| PTP/ReverseSequence | A basic reciprocating point-to-point motion using MC_Power and MC_MoveAbsolute driven by a simple state machine: move out, dwell, return, dwell, repeat. A fundamental forward/reverse positioning pattern. |
Each folder contains a self-contained TwinCAT solution (.sln) that can be opened and run independently:
- Open the sample's
.slnfile in TwinCAT XAE (Visual Studio / TcXaeShell). - Select your target system (local runtime or a remote target) via TwinCAT > Choose Target System.
- Build the solution (Build > Build Solution) and activate the configuration (TwinCAT > Activate Configuration), confirming the switch to Run mode.
- Log in and start the PLC (PLC > Login, then Start). The axes run in simulation by default, so no physical hardware is required.
- Open the
MAINprogram and use the declared trigger/command variables to step through the sample. In most cases setbStarttoTRUEto start the sample. Some samples provide a selection of different use cases or commands to be executed. - Where included, open the Scope/Measurement project to visualize the motion.
The samples use the included trial/simulation axis licenses. To run on real hardware, adapt the axis and drive configuration to your setup.
Should you have any questions regarding the provided sample code, please contact your local Beckhoff support team. Contact information can be found on the official Beckhoff website at https://www.beckhoff.com/contact/.
Further information about this sample code can be found on the Beckhoff Information System in the TF55xx | TwinCAT 3 MC3 documentation.