PLC TO PLC Communication as Masster and Slave

3 min read 1 month ago
Published on Aug 02, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial will guide you through setting up PLC communication where one PLC acts as a master and the other as a slave. By following these steps, you will learn how to configure hardware, set up data blocks, and utilize system functions for effective data exchange between the two PLCs.

Step 1: Create a Project for Master-Slave Communication

  • Open your PLC programming software.
  • Create a new project for PLC Master to PLC Slave communication.
  • Insert the master PLC and slave PLC into your schematic manager.
  • Name the master PLC and the slave PLC accordingly for easy identification.

Step 2: Configure Hardware

  • Insert the appropriate CPU for each PLC:
    • For the master, select CPU type 217 PN DP.
    • For the slave, select CPU type 37 TDP.
  • Set the communication parameters for each PLC:
    • For the master PLC, configure it as a master.
    • For the slave PLC, configure it as a slave.

Step 3: Set Input and Output Addresses

  • Define input and output addresses:
    • For the master PLC, set input address as 256 and output address as 256.
    • For the slave PLC, use the same addresses for consistency.
  • Specify the length of data to send:
    • From the master, you will send 20 bytes.
    • From the slave, you will receive 32 bytes.

Step 4: Create Data Blocks

  • Create two Data Blocks (DB) for each PLC:
    • For the master PLC:
      • DB 100 for sending data.
      • DB 101 for receiving data.
    • For the slave PLC:
      • DB 200 for sending data.
      • DB 201 for receiving data.
  • Ensure DB 100 and DB 200 are parameterized for data transmission.

Step 5: Program Data Transmission

  • To send data from the master to the slave, use the system function 50:
    SEND (Address: 256, DB: 100, Start: 0, Length: 20, Error Code: Word 4)
    
  • To receive data from the slave to the master, use the system function 40:
    RECEIVE (Address: 256, DB: 101, Start: 0, Length: 32, Error Code: Word 4)
    

Step 6: Configure OB for Communication Errors

  • Add Organizational Block (OB) 82 to handle communication errors:
    • This block will ensure that both PLCs are synchronized and can manage faults effectively.

Step 7: Download and Monitor the Program

  • Connect your PC to both PLCs using the appropriate protocol.
  • Download the configuration to both the master and slave PLCs.
  • Monitor the data transfer to ensure successful communication:
    • Check the master PLC to confirm it is sending data.
    • Verify on the slave PLC that it is receiving data correctly.

Conclusion

By following these steps, you have successfully configured PLC communication between a master and a slave. This setup allows for efficient data exchange, which is essential in automated systems. As a next step, you may want to explore advanced error handling or integrate additional PLCs into your system for more complex automation tasks.