Communicating S7-200 Smart PLC over modbus rtu


Requisites

1. S7-200 Smart CPU ( we are using 6ES7 288-1ST20-0AA0)
2. ATV 12 AC Drive ( we are using ATV12H075M2)
3. Communication Cables Lan for PLC Programming and RJ45 to Sub D9 Male 9 Pin RS485 cable for Modbus communication between PLC and AC Drive (Pinout given below).
4. Multimeter Meco 9A06 and Screw Drivers Taparia 810 and 803.
5. Connection Wires and Power Cables, since we are using DC CPU hence 24VDC SMPS is required.

Software / Manuals required

1. Step 7 Microwin Smart V2.3 for PLC Programming
2. User Manual and modbus parameters address of ATV12 ( Link below )

Modbus Cable 

Follow below given diagram to prepare cable

AC Drive Setting

Set below given parameters in AC Drive

CtL-           Fr1                   Mdb       Frequency command is set from modbus
                   CHCF              Sin         - Not separate mode, (command and reference come from the same channel)

Conf-       FULL       CON-
                                              Add      -   2          Drive's Modbus slave ID is set as 2
                                              tbr        -   19.2     Comm speed is set at 19200 bits per second
                                              tFO      -    8n1     Comm format is set as 8bit no parity 1 stop bit


Now we need to check modbus parameters

control word CMD address is 8501 - we can start or stop AC Drive by writing bits of this register.
Frequency Setpoint LFR address is 8502 - we need to write desired frequency X 10 as integer to this register.

PLC Settings

We need to call MB_CTRL2 from modbus master library v2, on each scan cycle along with proper parameters as communication settings, remember to keep communication settings same on all devices on the bus.






Next we need to call MB_MSG2 along with proper slave id and register address, keep RW 0 for read and count 2 for reading 2 registers

in our example we need to put
2 in slave
0 in RW
40001 + 8501 = 48502 in Addr
2 in count
and &VB500 in DataPtr

after read operation you will get
current value of CMD i.e holding register 8501 value in VW500
current Set Frequency LFR in VW502 (500 for 50Hz and 0 for 0 Hz)


Library Memory

In the last you must assign memory to modbus library,  right clicking program in left pane and then selecting library memory will get you to a dialog for selecting starting address of library memory, read the instructions and then click OK







Now you are good to go, compile and download program, then whenever m2.0 is switched on PLC will communicate to modbus slave 2 and get register values of 8501 and save it to VW500, and register value 8502 to VW502. Use done bit of MBUS_MSG2 block to reset m2.0.


Disclaimer 

If you opt to follow this tutorial, do so at your own risk, kindly confirm each and every setting with the manual of corresponding product and follow manual in case of any confusion/doubt.

Comments