Somachine basic modbus TCP help

bob.southall

Member
Join Date
Jan 2017
Location
Ely, UK
Posts
16
Hi all

I tried to piggyback onto the back of an old thread, but I think I need to ask for help on here.

I am trying to get two M221 plcs to communicate via modbus.

Now I cant use serial (which I can get to work on the bench), because the distance is too far >15M

So I am left with TCP. Which I cant for the life of me figure out.

Any help or guidance appreciated.
 
The signal does not die at 15m. I've had RS-232 work up to 35m.

There are RS-232/RS-485 converters; consider putting one on each end. 485 is rated for longer distance.
 
I have had good success with Modbus TCP/IP between two M221's. Check out the templates in SoMachine 1.5. The one named xSample_ModbusTCP_Wireless Push Button_ReadStatus is an up and working program. Set the IP of your server PLC under Configuration/ETH1/Modbus TCP. These program will read MW0 in the server to MW7 in the client. Hopefully this gets you started. To read more bits and words, you will have to make changes in the ctrl_tables.
 
The signal does not die at 15m. I've had RS-232 work up to 35m.

There are RS-232/RS-485 converters; consider putting one on each end. 485 is rated for longer distance.

Usually there is writed limit of 15m or 50feet for RS232 (19200b), but if you slow down comms then limit goes bigger.

https://www.lammertbies.nl/comm/info/RS-232_specs.html

RS232 cable length according to Texas Instruments
Baud rate Maximum cable length (ft)
19200 50
9600 500
4800 1000
2400 3000


For RS485 limit is 1200m (standard), but hardware can make it less and you need isolators or amplifiers.
 
If you want to use RS232 just put in a RS232 to RS422 (not RS485) converter on each side.
RS422 is duplex communication and doesn't require fail-safe bias resistors as RS485 do. Basically RS422 is the long range industrial replacement of RS232.

Otherwise modbus tcp is basically modbus embedded in a tcp package. You have an ip adress that has to be right. Other than that it is 99% the same.

The difference is that the checksum has been removed (because tcp communication have it's own checksum).

Also what is called slave address on serial is called unit id on modbus tcp. It should not be used by either the server or the client according to the standard but a lot of manufacturers screw that up. So it unit id/slave address has to be right as well.

"Server" on modbus tcp is the same as slave on serial modbus.
"Client" on modbus tcp is the same as master on serial modbus.
That can be a cause of confusion as well.
 
Last edited:

Similar Topics

Hi all, I've been trying to develop modbus rtu program between uv balasts and plc ı'have 6 slave balast.I am reading fault run voltages etc...
Replies
0
Views
1,165
Hi all, I have a HACH sc200 controller with 2 sensors which I hope to connect an M221 plc to via Modbus RS485 in order to display the info on a...
Replies
4
Views
2,239
Hi All, I am a newbie to Modbus tcp communication, and need some directions in this regard. I have TMCE221CE16R with SoMachine Basic as my...
Replies
9
Views
5,266
Hi, Does anyone have any examples on how to use the Modbus IO Scanner on the Schneider M221 controller? I have one on test bench with a Delta...
Replies
4
Views
5,870
hello eveyrone I want to make an application with M221 PLC in SOMACHINE BASIC program. I request your valuable help. I have a 50 ms pulse...
Replies
1
Views
1,581
Back
Top Bottom