Linking into a PLC Program 7 Linking into a PLC Program 7.1 Installation Installation is performed by copying the COMlibBC.LB6 and COMlibBC5b.LB6 libraries into the TwinCAT directory TwinCAT\PLC\LIB. The associated test program should be copied to any project directory of your choice, e.g. to TwinCAT\PLC. https://infosys.beckhoff.com/content/1033/tcplclibserialcombc/Resources/12264207755/.zip Link libraries Create a new PLC project with TwinCAT PLC Control in order to perform the library linking. Go to Library Management and add the ComLibBC.LIB library.
7.2 Adapting to the 5-Byte Mode The ComLibBC5B library is used instead of the ComLibBC library for programming the serial bus terminal in 5-byte mode, and for the serial interface of the BC8x00 bus controller. The KL6ControlBC function block is thus replaced by the KL6Control5B block. In addition to this, the data structures KL6inDataBC and KL6outDataBC are replaced by KL6inData5B and KL6outData5B respectively. It should be noted that the KL6xxx serial bus terminals are supplied factory-set for 3-byte mode, and must first be re-programmed using the KS2000 configuration software. Alternatively, appropriately programmed terminals are available as KL6xxx-0020.
7.3 Global Variables Four global data structures are needed to access a serial interface. Two provide the connection to the hardware in the send and receive directions. Two data buffers are also necessary for intermediate storage. VAR_GLOBAL Kl6InData AT %IB0 : Kl6inDataBC; Kl6OutData AT %QB0: Kl6outDataBC; RxBuffer : ComBuffer; TxBuffer : ComBuffer; END_VAR 7.4 Background Communication The communication between the serial hardware and the data buffer, of type ComBuffer [ } 12] , is performed with the aid of a separate block, ComControl. See also the Communication Principle [ } 10] . TX1200 18 Version: 1.1