IMDHMIControls LibraryShop main store

How-to

S7-1200 CM 1242-5 DP slave to an S7-400 PROFIBUS master

Industrial networks Published 7 min read By IMDHMI controls team

Short answer

A 1214C AC/DC/RLY with a CM 1242-5 exchanges cyclic data with a CPU 416-5H PROFIBUS DP master once both projects agree on a unique station address in the 0–125 range, byte-identical transfer areas and consistent word access. Prove the byte map with known values before any output is enabled.

On this page
  1. How the data path works
  2. Commissioning steps
  3. Station address and area limits
  4. Verify the map before you enable anything
  5. When the link misbehaves
  6. Questions asked

The CM 1242-5 turns your 1214C AC/DC/RLY into an intelligent PROFIBUS DP slave, and the CPU 416-5H's onboard PROFIBUS interface runs the segment as the DP master. The two exchange cyclic data — commands out, status back — once three things agree on both ends: a station address unique on the segment within the 0–125 range PROFIBUS station addressing gives you, transfer areas of identical length and order in both projects, and consistent access to every multi-byte field. Nothing else crosses the link. The 1214C's own I/O stays inside the S7-1200; the S7-400 can only move the machine through values your S7-1200 program decides to accept. Configure both projects, then prove the byte map with known values before you let anything act on an output.

How the data path works #

PROFIBUS DP, the cyclic fieldbus standardized in IEC 61158, assigns every slave to exactly one master: that master parameterizes the station and then exchanges its configured input and output bytes with it every bus cycle. A DP master system needs one DP master and at least one DP slave; here the master role belongs to the CPU 416-5H interface and the slave role to the CM 1242-5.

The CM 1242-5 is an intelligent DP slave, and that word carries weight: what crosses the bus is not the 1214C's physical I/O but transfer areas, blocks of bytes mapped into the S7-1200's process image. You create them in the S7-1200 project and mirror them in the S7-400 project, byte for byte, from each side's own point of view:

On the CPU 416-5H On the CM 1242-5 In the S7-1200 program
Output bytes: commands, setpoints Input-type transfer area Read as %I
Input bytes: status, actual values Output-type transfer area Write as %Q

So the master's outputs land in the slave's image as inputs, and the slave's outputs travel back as the master's inputs. The byte-level rules those areas must satisfy are laid out in What I-slave transfer areas an S7-1200 CM 1242-5 slave must publish.

Commissioning steps #

Work both projects before the first download, in this order:

  1. Wire the segment. Run PROFIBUS cable from the CPU 416-5H's DP interface to the CM 1242-5's 9-pin D-sub female connector, with active termination switched on at the two physical ends of the segment only.
  2. Configure the slave project. Insert the CM 1242-5 behind the 1214C AC/DC/RLY in the S7-1200 project and give its PROFIBUS interface a station address unique on the segment; 5 works as an example.
  3. Create the transfer areas on the slave. For this example: one input-type area of 8 bytes beginning at %IB 64 and one output-type area of 8 bytes beginning at %QB 64, both inside the 1214C's process image.
  4. Configure the master project. Set the CPU 416-5H's PROFIBUS interface to DP-master mode, give that interface its own unique station address (2 is the usual choice) and create the DP master system on the segment.
  5. Insert the intelligent slave. If both devices sit in the same TIA Portal project, connect the S7-1200 under the DP master system directly; otherwise install the CM 1242-5's device description file supplied by the manufacturer and configure the slave entry by hand.
  6. Mirror the areas in the master. Recreate the same two areas, same lengths, same order, at master-side addresses: for this example, 8 output bytes at QB 8 and 8 input bytes at IB 8, low addresses that sit inside even the smallest default process image.
  7. Set consistency. Every field wider than one byte gets word or doubleword consistency and is moved with a single 16-bit or 32-bit access in the program. Never split a setpoint across two separately handled transfers.
  8. Map the application. The master writes commands into its output bytes. The S7-1200 copies the 8 received bytes into a data block, range-checks every field, drives its own physical outputs locally, and writes status into its 8 outgoing bytes, which the master reads as inputs.
  9. Download and check presence. Download the slave project first, then the master. Bus diagnostics on the S7-400 must show the slave at its address and in data exchange, and the CM 1242-5 must report its master present.
  10. Prove the map. Run the two tests below. Only when every byte arrives where both projects expect it do you begin transferring values that act on outputs.

Station address and area limits #

Four numbers govern this link, and each has a job:

  • 0–125. PROFIBUS station addressing gives you addresses 0 through 125; leave 126 out of your plan, because it is conventionally reserved for the programming device. The master and every slave draw from this range, and no two stations on the segment share one. A duplicate does not fail cleanly: the master finds a station that answers but cannot trust which one it is.
  • 128. The 1214C's process image is 128 bytes deep in each direction, so a transfer area must end by byte 127 — that is why the example uses %IB 64 and %QB 64 rather than a higher address.
  • Address plus length on the master side. The mirrored areas occupy input and output bytes in the S7-400's process image. Keep that sum inside the image, or read and write the bytes as peripheral data (PIB and PQB in the classic S7-400 language). When a configured address lands above the image, the symptom is the one worked through in the S7-300 PROFIBUS gateway fix for a module address above the process image: slave detected, but no I/O data. The same arithmetic applies on an S7-400.
  • Area count and total length. The CM 1242-5 device manual states how many transfer areas the module supports and how long they may be in total. Keep your map inside those caps; build it small like this example and extend it only when the application genuinely needs the extra fields.

Verify the map before you enable anything #

Two tests, both with numbers you can check by hand.

Byte-position test. Put a recognizable value into one byte at each end. In the S7-400, move 16#5A into the first byte of the slave's output area; 16#5A = 5 × 16 + 10 = 90, so the first byte of the CM 1242-5's input-type area must read 90 in the S7-1200. Reverse the direction: have the S7-1200 move 16#A5 into the first byte of its output-type area; 16#A5 = 10 × 16 + 5 = 165, and the master's first input byte must read 165. If 90 arrives at the second byte instead of the first, the two projects disagree on the order of the areas. If every value lands shifted by a constant number of bytes, one side's address is off by exactly that amount.

Consistency test. Step a two-byte setpoint across a byte boundary: send 1023, then 1024 — that is 16#03FF, then 16#0400, where 1024 = 4 × 256 + 0. If the slave handles the two bytes separately, it can combine the new high byte 16#04 with the old low byte 16#FF and read 16#04FF = 4 × 256 + 255 = 1279: a value the master never sent, 255 above the true setpoint. Word consistency on that field plus a single 16-bit move closes the window.

One safety rule while testing: write your known values into bytes that cannot command motion, or keep the machine's outputs disabled, until every field has passed both tests. Test data on an unproven map has started real machines before.

Three symptoms cover most of what you will see, and each has its own fix:

  • The master reports the slave absent. Work through power at the CM 1242-5, the station address you set in step 2, connector seating, then cable continuity — in that order, cheapest test first.
  • Detected, but no data exchange. The station answers but rejects its parameterization or configuration: the device description does not match the installed module, or the transfer areas differ in length or order between the projects. Re-do the mirror step until both projects match byte for byte.
  • It runs, then drops out. Look at the physical segment before suspecting software: termination active at exactly the two segment ends, termination powered by stations that stay on, shields landed per the installation instructions, and a transmission rate the cable length supports. A terminated end station that loses power takes its termination with it, which is why a segment that works fully powered can fail after a shutdown. The segment-level causes are worked through in the walkthrough of intermittent PROFIBUS dropouts on an S7-400 network.

The decision for each case: an absent slave is an identity or cable problem, so fix that before touching the map; a detected slave without data exchange is a configuration mismatch, so fix the mirror; dropouts are segment hardware, so fix termination, rate or shielding. The standing decision for the build itself: with an existing PROFIBUS backbone and a free slot, this is the right link — CM 1242-5 as slave, CPU 416-5H as master, command authority over the S7-1200's outputs kept inside the S7-1200 program, which accepts, checks and only then executes what the DCS sends.

Questions asked

Can the S7-400 read the S7-1200's physical inputs over this link?

No. The CM 1242-5 is an intelligent slave, so only the configured transfer areas cross the bus. If the DCS needs a sensor value wired to the 1214C, the S7-1200 program must copy that value into the output-type transfer area first. Build those copies into the map at design time, because adding a field later means editing and downloading both projects.

Why use PROFIBUS between the controllers when PROFINET is more common?

Because the segment already exists. With a PROFIBUS backbone installed, a spare station address and a free slot for the CM 1242-5, DP is a fully supported cyclic link and reuses the cable you have. On a new build, PROFINET avoids the extra module and moves data faster. The installed cable decides, not protocol fashion.

Can one CM 1242-5 exchange cyclic data with two masters?

No. PROFIBUS DP assigns each slave to one master, which parameterizes it and owns its cyclic exchange — here the CPU 416-5H interface. A second, class 2 master may share the segment for diagnostics and acyclic reads, but the cyclic I/O map belongs to the single DP master that configured the station.

How does the S7-1200 program notice that the master has stopped?

The transfer areas carry no data-valid flag, so a failed master leaves the last received bytes frozen in the S7-1200's image. Add a heartbeat: the S7-400 increments a counter byte each scan, and the S7-1200 raises its own local alarm if that byte stops changing within a timeout you choose, for example two seconds.

How large can the transfer areas be?

The supported count and total length are stated in the CM 1242-5 device manual, and the map must also fit the 1214C's process image on the slave side and the S7-400's process image on the master side. Begin with a map this small and extend it only when the application genuinely needs more fields.

Keep reading

  • Troubleshooting

    What I-Slave transfer areas an S7-1200 CM 1242-5 slave must publish

    A PROFIBUS master reads only the I-Slave transfer areas configured in the CM 1242-5, never the S7-1200 data blocks directly. Define matching transfer areas, copy your DB values into them each scan, and have the master select cyclic modules in the same order, length and direction.

    Industrial networks

  • Explainer

    Why a MicroLogix needs a Modbus gateway to join PROFIBUS

    No MicroLogix has a native PROFIBUS interface, and the 1769-DPM is documented for CompactLogix only. Run each MicroLogix 1100, 1200 or 1500 as a Modbus RTU slave on its serial port, polled by a gateway that is Modbus RTU master and PROFIBUS DP slave. The bus master sees only the gateway's process image, and data age is the serial poll cycle plus one bus cycle.

    Industrial networks

  • Explainer

    What decides a PLC to legacy DCS communications link

    A PLC links to a legacy DCS only when both ends meet on one protocol with complementary roles: the Quantum 140 CRP 811 00 is a PROFIBUS DP master, so the DCS station must run the DP slave role, and the Teleperm 1333 card must be the Modbus variant rather than the 3964R/RK512 one. Trace endpoint identification, physical layer, protocol and role, and data contract in that order; where the installed pair cannot meet, convert through a gateway instead of re-labeling the protocol.

    Industrial networks

Send VS725 measurements to an S7-300 over PROFIBUS