How-to
How to Exchange Recipe Data Records Between an HMI and a PLC
Short answer
Bind every recipe element to an external tag whose data type and byte offset match the PLC data block, then move whole records with the system functions set data record to PLC and get data record from PLC. The records live in the panel's storage and the PLC holds only the current working values. Set tag synchronization so values move only on an explicit transfer, and prove the exchange with five checks ending in a delete test.

On this page
- What moves a recipe data record between the HMI and the PLC?
- How do I link each recipe element to a PLC tag?
- Which recipe setting controls automatic tag synchronization?
- How do I build the transfer step by step?
- How do I test the transfer in both directions?
- Why does the PLC stay unchanged or show scrambled values?
- How do I keep a transfer from hitting a running machine?
- Questions asked
The fix is two system functions on the buttons of your recipe view: set data record to PLC writes the selected record to the controller, and get data record from PLC reads the controller's current values back into the panel. Bind every recipe element to an external tag with the matching data type (bool, int, dint, real) and the matching byte offset in the PLC data block, for example REAL on byte 0.0, DINT on byte 4.0, INT on byte 8.0, BOOL on byte 10.0. Then set the recipe's synchronization to the explicit mode so nothing reaches the machine until set data record to PLC runs. The records live in the panel's recipe storage; the PLC holds only the current working values in a data block. Build the connection, the tags and the recipe in that order, then prove the exchange with five checks. On a 277 8-inch touch panel the whole exchange runs with the recipe template supplied with WinCC flexible plus a few buttons.
What moves a recipe data record between the HMI and the PLC? #
Two system functions do the whole job: set data record to PLC writes the values of the selected data record to the PLC addresses of the linked tags, and get data record from PLC reads the current PLC values back into the recipe view.
A download is a set: the operator picks the record for the next product and the machine takes those values. An upload is a get followed by a save, because the read values exist only on screen until the panel stores them as a record. How the transfers and the tag synchronization behave together is documented in the support entry Transfer of recipe data records, ID 18795593. One record set belongs to one panel; giving a second Comfort panel the same records is a panel-to-panel job, covered in sharing recipe data records between two Comfort panels.
How do I link each recipe element to a PLC tag? #
Create one external tag per recipe element in the Tag editor, give it the same data type as its data block member, and point it at that member's byte offset; an element on an internal tag transfers nothing to the controller.
The offsets come from the block declaration, and the arithmetic is fixed by the type widths. Take this example block laid out for absolute addressing:
| Member | Data type | Start | Width |
|---|---|---|---|
| Temp | REAL | byte 0.0 | 4 bytes |
| Count | DINT | byte 4.0 | 4 bytes |
| Speed | INT | byte 8.0 | 2 bytes |
| Enable | BOOL | byte 10.0 | 1 bit |
REAL ends at 0 + 4 = 4, so Count starts at byte 4; Count ends at 4 + 4 = 8, so Speed starts at byte 8; Speed ends at 8 + 2 = 10, so Enable takes bit 0 of byte 10. Point the Speed tag at byte 6 by mistake and it reads the low word of Count instead: with Count at 70000 the word is 70000 - 65536 = 4464, so the panel shows 4464 while the PLC counts 70000. The same fault shows up as a display that climbs to 65535 and wraps to 0 each time the counter passes a multiple of 65536. Compare offsets against the declaration, never against tag names. The address syntax for each controller family is in chapter 4, "Working with tags", of the WinCC flexible 2008 manual, and the same mechanics apply as in a step-by-step write of HMI device data into an S7-400 DB with an external tag.
Which recipe setting controls automatic tag synchronization? #
The recipe's synchronization setting decides whether the recipe view and the PLC tags follow each other continuously or only when a system function runs, and for production recipes you set it to move values only on an explicit transfer.
With continuous synchronization, an operator who edits a value in the recipe view changes the machine as soon as the tag updates, with no set function in between; that suits commissioning and nothing else. With the explicit mode, nothing reaches the PLC until set data record to PLC runs, so the record on screen is a proposal and the transfer is a deliberate act. The Runtime manual lists these settings as the ones that determine how recipe data records, recipe tags and the PLC interact. Choose the explicit mode at step 5 below and leave it there.
How do I build the transfer step by step? #
Work through eight steps in this order, because each step depends on the one before it: connection, data block, tags, recipe with its elements, storage and synchronization settings, a test record, buttons, download.
- Create the HMI connection to the controller in the project's communication settings, match the interface and address parameters to the PLC configuration, and bring the connection online.
- Declare the recipe values in a PLC data block with a fixed layout, one member per element, in types you will mirror exactly on the panel: bool, int, dint, real. Note each member's byte offset as you declare it.
- Open the Tag editor and create one external tag per member with the matching data type and address, as in the offset example above.
- Open the project's recipe editor and begin with the supplied recipe template, or add a recipe and define its elements. Assign each element its tag in the element list.
- Set where the panel stores its records, set synchronization to the explicit mode, and check that the planned record count fits the panel's recipe memory.
- Create at least one data record with test values that differ clearly from the current PLC values.
- Place a recipe view on a screen and attach the record functions to button events: get data record from PLC, set data record to PLC, and the functions that save, create and delete a data record.
- Transfer the project to the panel and start Runtime.
To prepare a large record set offline instead of typing it at the panel, use the CSV workflow described in editing WinCC Flexible recipes from a PC without the engineering tool.
How do I test the transfer in both directions? #
Run five checks in this order before the machine depends on the exchange: connection state, set direction, get direction, persistence, delete, and do not skip the delete test at the end.
- Connection: with the controller online, a plain external tag on a test screen shows a live PLC value and the panel raises no communication alarm.
- Set direction: select the test record and trigger set data record to PLC. The online view of the data block must show the record's values at the exact offsets you noted, for example Temp at 85.5 °C on byte 0.0.
- Get direction: change three values directly in the data block, then trigger get data record from PLC. The recipe view must show the three new values with every other value unchanged. Keep other screens from writing those tags meanwhile; whether manual PLC data block edits survive HMI writes decides how long the test edits last.
- Persistence: save the fetched values as a new data record, power-cycle the panel and reopen the recipe view. The record must be listed with the saved values.
- Delete: delete the test record. It must disappear from the record list, and no PLC value may change.
Why does the PLC stay unchanged or show scrambled values? #
Four causes cover nearly every failed exchange: an element bound to an internal tag, a tag type or offset that differs from the data block, a get with no save after it, and a set that ran while the connection was down.
- Internal tag on an element. The transfer completes without any error and nothing in the PLC moves. In the Tag editor, confirm every recipe tag is external and has a connection assigned.
- Type or offset mismatch. The offset arithmetic above gives the pattern: a value that wraps, jumps or reads as a fragment of its neighbor means the tag does not sit on the member it claims. Compare byte offsets against the declaration, not against tag names.
- Unsaved read. get data record from PLC fills the recipe view only; without a save in the sequence the values are lost when the operator changes screens, and the record list keeps the old contents.
- Dead connection. A set issued while the connection is offline never arrives, the block keeps its old values, and the fault looks like an ignored recipe. Clear any communication alarm first, then judge the recipe configuration.
How do I keep a transfer from hitting a running machine? #
Interlock the transfer in the PLC program, not on the panel: accept recipe writes only while the machine is stopped or a transfer-enable bit you create is set, because one press of set data record to PLC rewrites every linked value in a single operator action.
A set issued mid-cycle changes speeds, temperatures and setpoints under the program's feet, and the panel offers nothing that prevents it, so the guard belongs in the controller. Have the program ignore or hold recipe writes unless the interlock condition is true, and show that state to the operator through a tag the panel displays. Where the controller itself must start and acknowledge transfers, use the area pointer mechanism; the pointer layout and the faults that follow when it does not line up are covered in why WinCC flexible DB writes fail when area pointers do not match. Recipe transfer is a production function, not a safety function: machine safety stays with the safety circuit, whatever the recipe screen promises.
Questions asked
What is the equivalent setting on Comfort Panels and RT Advanced?
The TIA Portal generation documents the same choice under synchronization of recipe data records with the PLC. Enabling the option Manual transfer of individual modified values (teach-in mode) keeps edited values in the panel until an explicit transfer runs, which matches the behavior set up here for production recipes. Tag binding and the direction of the two transfers stay conceptually the same.
What does WinCC Unified use instead of these recipe functions?
WinCC Unified manages the exchange with the RecipeViewSynchronizeDataRecordWithTags system function, which synchronizes parameter values between the HMI and the PLC. The ideas carry over, with records in the panel and elements bound to tags, but the function names differ, so port a flexible 2008 design by rebuilding the functions from the Unified documentation rather than by copying names.
How many data records fit on a 277 8-inch panel?
No fixed record count applies: capacity is the panel's available recipe memory divided by the storage one record needs, and that storage grows with the number of elements. The example record above carries 11 bytes of payload, so 1000 such records need about 11 kB before overhead. Multiply your own record size by the planned record count and keep headroom before commissioning.

