Creating a PLC project and integrating PLC libraries

Here you can unpack the complete PLC sources: TcPlcLibIEC870_5_101Slave_TutorialSample.zip

 

  1. Start TwinCAT PLC Control.
  2. Create a new PLC project via File -> New. Select PC or CX (x86 or ARM) as the target system.
  3. A new MAIN program block will now be created automatically. Select ST (Structured Text) as the language for the block. Confirm. Rename the new program block to P_MAIN_LowSpeed.
  4. Add second program block and rename it to P_SerialComm_HighSpeed.
  5. Go to the task configuration and configure one fast task (T#1ms) and one slow task (T#10ms). Assign the P_SerialComm_HighSpeed to the fast task and the P_MAIN_LowSpeed to the slow task (see picture below).

Creating a PLC project and integrating PLC libraries 1:

  1. From the menu select Window -> Library Manager and then Insert -> Additional Library...
  2. Select TcIEC870_5_101Slave.Lib from the list of TwinCAT libraries and confirm.