Integration into TwinCAT
TX1200
16
Version: 1.1
5.2
Integration in TwinCAT (CX9020)
This example describes how a simple PLC program for MP-Bus can be written in TwinCAT and how it is
linked with the hardware. The task is to control an individual flap drive and change it with a button.
Unpacking the example files https://infosys.beckhoff.com/content/1033/tcplclibmpbus/Resources/
Hardware
Setting up the components
The following hardware is required:
• 1x digital 2-channel input terminal KL1002 (for the Open and Close functions)
• 1x end terminal KL9010
Set up the hardware and the MP-Bus components as described in the associated documentation.
This example assumes that the address of the flap drive is known.
Software
Creation of the PLC program
Create a new PLC project for PC-based systems (ARM) and add the
TcMPBus.lib
library.
Next, generate the following global variables:
VAR_GLOBAL
bOpen AT %I* : BOOL;
bClose AT %I* : BOOL;
arrKL6771_IN AT %I* : ARRAY[0..11] OF BYTE;
arrKL6771_OUT AT %Q* : ARRAY[0..11] OF BYTE;
stDataKL6771 : DataKL6771;
END_VAR
bOpen:
input variable for the Open button.
bClose:
input variable for the Close button.
arrKL6771_IN:
input variable for the MP-Bus terminal.
arrKL6771_OUT:
output variable for the MP-Bus terminal.
stDataKL6771:
required for communication with MP-Bus (see
).
All function blocks with MP-Bus must be called in the same task.
Therefore, create a MAIN program (CFC) in which the
and
function blocks are called. Make sure to link the communication block with
arrKL6771_IN
,
arrKL6771_OUT
and
stDataKL6771
.
Содержание TwinCAT 2 TX1200
Страница 1: ...Manual EN TX1200 TwinCAT 2 PLC Library TcMPBus 2022 06 02 Version 1 1...
Страница 2: ......
Страница 79: ......