Wednesday, November 25, 2015

Communication between Allen Bradley PLC and Siemens PLC




How to Communication between Allen Bradley PLC and Siemens PLC ?
This article about this case, where Siemens PLC using Modbus and Allen Bradley PLC using DF1 protocol.
How to connect the two different communications and two different PLC?
I use the Arduino as a bridge between Allen Bradley PLC and Siemens PLC.
Arduino is used must have more than one serial port, and I use Arduino ATmega 2560 (Mega 2560).
In this case :
Input of Siemens PLC send to/display to Output of Allen Bradley PLC,
Input of Allen Bradley PLC send to/display to Output of Siemens PLC
more details can be seen in the picture below:


Communication between Allen Bradley PLC and Siemens PLC

let's watch a video demonstration :

Connecting between Allen Bradley PLC and Siemens PLC using Arduino ATmega 2560




The hardware required for Communication between Allen Bradley PLC and Siemens PLC

  1. Arduino ATmega 2560 (Mega 2560)
  2. Allen Bradley PLC with DF1 protocol support, I use MicroLogix 1000 PLC
  3. Siemens PLC with Modbus protocol support, I use Siemens S7-200 PLC
  4. s7-200 RS232 PPI Multi Master Cable
  5. RS232 PLC cable for  Allen Bradley MicroLogix 1000 PLC
  6. 2 Pieces TTL to RS232 Module: If RS232 FEMALE connector then use DB9 Male crossover cable
  7. For testing (optional): 6 Pieces Push Button

Hardware for PLC communication between Allen Bradley and Siemens


The Hardware Connections for Communication between Allen Bradley PLC and Siemens PLC

1. Connection between Allen Bradley PLC and Arduino


Connection between Allen Bradley PLC and Arduino

2. Connection between Siemens PLC and Arduino


Connection between Siemens PLC and Arduino



The software required for Communication between Allen Bradley PLC and Siemens PLC

  1. Arduino Software / IDE : I use HOURLY BUILDS version 1.6.6
  2. in link https://www.arduino.cc/en/Main/Software

  3. Arduino library : click here
  4. Unzip and Copy Paste to folder ..\arduino-nightly\libraries
    Only Folder : DF1 and ModbusMaster


Project file for Communication between Allen Bradley PLC and Siemens PLC

  1. for Upload to Arduino ATmega 2560  : click here
  2. for Download to Allen Bradley MicroLogix 1000 PLC : click here
  3. for Download to Siemens S7-200 PLC : click here


Arduino Code of Communication between Allen Bradley PLC and Siemens PLC


#include <SimpleModbusMaster.h>
#include <DF1.h>
//by program-plc.blogspot.com

#define MODBUSSlaveAddress 1
#define MODBUSbaud 9600
#define MODBUSformat SERIAL_8E1
#define MODBUStimeout 1000
#define MODBUSpolling 1
#define MODBUSretry_count 0
#define MODBUSTxEnablePin 13 

enum
{
  MODBUSPACKET1,
  MODBUSPACKET2,
  MODBUSTOTAL_NO_OF_PACKETS
};

Packet MODBUSpackets[MODBUSTOTAL_NO_OF_PACKETS];

packetPointer MODBUSpacket1 = &MODBUSpackets[MODBUSPACKET1];
packetPointer MODBUSpacket2 = &MODBUSpackets[MODBUSPACKET2];

unsigned int MODBUSreadRegs[1];
unsigned int MODBUSwriteRegs[1];


#define DF1destination 1
#define DF1baud 9600
#define DF1format SERIAL_8N1
#define DF1timeout 1000


enum
{
  DF1PACKET1,
  DF1PACKET2,
  DF1TOTAL_NO_OF_PACKETS
};
DF1Packet DF1packets[DF1TOTAL_NO_OF_PACKETS];

DF1packetPointer DF1packet1 = &DF1packets[DF1PACKET1];
DF1packetPointer DF1packet2 = &DF1packets[DF1PACKET2];

unsigned int DF1readRegs[1];

unsigned int DF1writeRegs[1];


void setup() {
modbus_construct(MODBUSpacket1, MODBUSSlaveAddress, READ_HOLDING_REGISTERS, 0, 1, MODBUSreadRegs);
  
modbus_construct(MODBUSpacket2, MODBUSSlaveAddress, PRESET_MULTIPLE_REGISTERS, 1, 1, MODBUSwriteRegs);
  
modbus_configure(&Serial1, MODBUSbaud, MODBUSformat, MODBUStimeout, MODBUSpolling, MODBUSretry_count, MODBUSTxEnablePin, MODBUSpackets, MODBUSTOTAL_NO_OF_PACKETS);
 
  
DF1_construct(DF1packet1, DF1destination, DF1_READ_N7, 0, 1, DF1readRegs);
  
DF1_construct(DF1packet2, DF1destination, DF1_WRITE_N7, 1, 1, DF1writeRegs);

DF1_configure(&Serial2, DF1baud, DF1format, DF1timeout, DF1packets, DF1TOTAL_NO_OF_PACKETS);

Serial.begin(9600);
Serial.println("Writen by Cartiman - program-plc.blogspot.com");
}

void loop() {
  modbus_update();
  DF1_update();

  //Read modbus register 40001 to write N7:1 
  DF1writeRegs[0] = MODBUSreadRegs[0];

  //Read N7:0 to write modbus register 40002
  MODBUSwriteRegs[0] = DF1readRegs[0];

}


Labels:








Newer Post Older Post Home

You may also like these ebook:

Get Free PLC eBook directly sent to your email,
and email subscription to program-plc.blogspot.com




We hate SPAM. Your information is never sold or shared with anyone.

Your Email Will Be 100% Secured !