MODBUS RTU Micrologix and S7-1200

*bj

Member
Join Date
Jun 2013
Location
Cro
Posts
15
Hello

I encountered a problem when connecting a Micrologix to a Siemens S7-1200 CPU using MODBUS RTU.
HW configuration is: Siemens S7-1200 with CM1241 connected via RS232 cable to Channel 2 of Micrologix 1400.

I have tried two solutions: 1) Micrologix as a slave, when S7-1200 writes data to holding registers of Micrologix, and 2) Micrologix as a master, when Micrologix reads data from holding registers of S7-1200. In both cases, I managed to successfully write/read data, if the length of elements (integer type) was 1. If I change the length to >1, the communication doesn't work. I'd like to copy several integers at once to the Micrologix.

I'd appreciate if anyone can share some insight on this matter.

Attached is the code.
 
The second byte sent by the Master is the Function code. This number tells the slave which table to access and whether to read from or write to the table.

Function Code Action Table Name
01 (01 hex) Read Discrete Output Coils
05 (05 hex) Write single Discrete Output Coil
15 (0F hex) Write multiple Discrete Output Coils
02 (02 hex) Read Discrete Input Contacts
04 (04 hex) Read Analog Input Registers
03 (03 hex) Read Analog Output Holding Registers
06 (06 hex) Write single Analog Output Holding Register
16 (10 hex) Write multiple Analog Output Holding Registers

If you are able to write and read single values then you should be able to just change the function code.

Regards,
 
I'm do a lot of Modbus, so I'm curious, is the function code (FC) 03 'read analog output holding register(s)' an exact Siemens description, or is the analog output partjust a casual restatement?

I find the designation as analog output registers somewhat exclusive of the wider use of Holding Registers in many products, where the Holding Registers (addressed by the 03 FC) frequently
- duplicate input registers
- are many times read/write, whereas input Registers are frequently read only
- contain math variables, results of calculations (like a totalizer), time/date data, calibration constants
 
http://www.simplymodbus.ca/FC03.htm
See the above link. You would have to see exactly what registers are allocated to this instruction for each PLC.
Example: Automation Direct Do-More PLC
Coil/Register Numbers Data Addresses Type Do-More PLC Table Name
00001-09999 0000 to 270E Read-Write MC1 to MC1023 Discrete Output Coils
10001-19999 0000 to 270E Read-Only MI1 to MI1023 Discrete Input Contacts
30001-39999 0000 to 270E Read-Only MIR1 to MIR2047 Analog Input Registers
40001-49999 0000 to 270E Read-Write MHR1 to MHR2047 Analog Output Holding Registers

Regards,
 
I finally addressed this issue again and resolve it. I managed to make it work in configuration, where the S7-1200 is MODBUS master and Micrologix is slave.
Problem was in addressing DATA_PTR parameter of MODBUS_MASTER function block of S7-1200.
Data, that is to be send, must be addressed as a pointer, either:
a) Memory location - If data is send from PLC memory M, pointer should be written e.g. P# M100.0 WORD 3. That are memory locations starting at M100.0 in length of 3 words.
b) Data block - Data can be in data block (global, standard, not optimized, absolute addressing) and arranged as an array, e.g. DATA array[0..2] of Int. The mistake I made, when calling this data in MODBUS_MASTER is that I set pointer to the first element, and the pointer must point to the array, e.g. P#DB1.DBX0.0.
 

Similar Topics

I have a spare Micrologix 1400 Series B I bought used on Ebay awhile back. I had thought of it as a spare PLC for my train project but I screwed...
Replies
4
Views
1,241
I been tasked with setting up communication between a heating cooling unit manufactured by Advantage Engineering and a Microloagix 1400 plc. The...
Replies
6
Views
2,497
Does anyone have an example program using control techniques EN drives?RSLogix 500 ver 6.3, to be put in the upload section on here. I’m wanting...
Replies
2
Views
1,342
Hey everyone, Ran into a bit of an issue with a Modbus RTU radio link on a MicroLogix 1100. Just for context, we have a remote lift station with...
Replies
31
Views
13,534
we use M580 which have an Modbus RTU port correct if iam wrong now should i have to read input data from ab micrologix through read var block and...
Replies
0
Views
1,850
Back
Top Bottom