Hello Guest it is October 02, 2023, 11:49:07 PM

Author Topic: S7-200 modbus connection example  (Read 16455 times)

0 Members and 1 Guest are viewing this topic.

S7-200 modbus connection example
« on: January 18, 2011, 06:39:17 PM »
Hi all.
First, sory for my eng.
Finaly i have 10 min. free time to share my story about connecting mach3 with PLC Siemens S7-200 series Cpu.
The Modbus work, i dont write great because (probabli with bad seting or somthing else) the communication response is slow. From my point of sight.
If someone has a idea or experience, pleas post it here.
First what you need.
- a Siemens PLC (i have S7-222 CPU, with EM233 module16in-16out and analog module 4in-1out). I recomend a S7-224 because has two communication
 ports buit in. Then the troubleshooting is easy with Step7 and modbus runnig at the same time.
-Software for programming PLC Step7 micro/win
-you need to buy a MODBUS Lybrari and install it to Step7, or write a new modbus program. (Its not so easy)
 here is the instaled lybrari

-A RS232 to PPI converter. I have one from China (with optoisolation)
-Mach3  :)
 First set the modbus parameter in PLC programm, Execute this block only on first scan.
 here is an example

 These al seting here mus correspond with serial port setting in control panel in PC and mach.
 Look at HoldStart parameter. (here tel you PLC where is the start of holding registers, in this examle start at VW800 and parameter MaxHold
 tell how long this registers wil be 100)
 The baud rate is set to 115200, look at maximum baudrate of your converter!
 Then insert in main PLC program a Modbus slave function and execute it every scan.
-Some months i proved ten numbers of setting but without stable connection. This one is stable but with some strange things.
 Here is Modbus setting in mach3

The one of strange thing is when you change the #Registers in Input or Output block the connection fail.
 When you change the start register the connection fail. So these is the only working setting. (for my case)
 Again, post your experience.
 I write an overwiev of input output here is:

The Input and output in green are the wirtual input output and are not present in Hardware modules. Its used only for program communication.
The other strange thing, (weeks of testing ;D) is that when you go to Modbus test the CPU input- output dont work. But only the CPU I0.0 to I0.7 and
Q0.0 to Q0.5. Why? i dont know. All input and output work great.
The holding registers start from VW800 ( in this case) and mach adress is 64
Here is short macro example how to read the values:

For all error posted here i apologize.I am only an begginer.