MOULDLKnowledge BaseElectrical Knowledge Base3D Model DownloadsMembership
中文版Model Store »
Knowledge Base › Electrical Knowledge Base › How do you switch recipes with comparison and MOVE instructions in TIA Portal?
HomeModels
Table of contents

On this page

PLC & Programming (100 articles)

Quick Reference

  • PLC & Programming
  • Electrical & Electronic Basics (monthly)(每月更新中)
  • Electrical Control & Drawings (monthly)(每月更新中)
  • Drives & Actuators (monthly)(每月更新中)
  • Sensors & Detection (monthly)(每月更新中)
  • Industrial Communication & Networks (monthly)(每月更新中)
  • HMI & Host Systems (monthly)(每月更新中)
  • Industrial Robots & Motion Control (monthly)(每月更新中)
  • Mechatronic System Integration (monthly)(每月更新中)
  • Fault Diagnosis & Standards (monthly)(每月更新中)

How do you switch recipes with comparison and MOVE instructions in TIA Portal?

Switching a recipe means selecting one set of parameters by recipe number and then transferring the whole set into the running area in one go. Using comparison instructions to select the recipe and MOVE to transfer the parameters is the most direct and the most robust approach. The sections below cover how to organise the data, how to interlock the switch and how to validate the parameters.

1. How to organise the recipe data

A recipe is usually a group of parameters such as temperature, time, speed and position. There are two ways to organise them: one data block per recipe, moved as a whole on switching; or all recipes in one large array selected by index. The first is direct to call and easy to maintain individually; the second is easy to manage centrally and suits a large number of recipes with an identical structure.

2. Selecting a recipe with comparison instructions

The recipe number comes from the HMI or a selector switch. Use comparison instructions (equal, range) to map the number to a specific parameter set: equal to 1 moves recipe A, equal to 2 moves recipe B. With many recipes use a comparison chain or a step-by-step test, keep both sides of the comparison the same data type, and provide a default branch so an out-of-range recipe number does not simply do nothing.

3. Transferring parameters to the running area with MOVE

Once a recipe is selected, use MOVE or MOVE_BLK to copy its parameters into the "running parameter area", and let the program read only from the running area. In this way the whole set takes effect at once when switching, and parameters cannot be changed halfway through a move. With many parameters, move the block as a whole; item-by-item MOVE easily misses one.

4. Switching timing and interlocks

Switch a recipe when the machine is stopped or in a safe state. Use a status bit as an interlock: only move when "switching permitted" is 1, and set a "loaded" flag on completion for later logic to use. Forbidding switching while running prevents parameters changing mid-action, which would create quality and safety problems.

5. Parameter validation and clamping

After the parameters reach the running area, use comparison instructions to check they are within the permitted range, and refuse to load and raise an alarm if they are not, so a wrong recipe cannot cause over-temperature or over-speed. Put the check after the move and before enabling, and if it fails, leave the previous recipe unchanged.

6. Recipe-switching elements and how to do them

ElementRecommended wayKey pointNote
Recipe number from the HMIComparison mappingSame type, default branchAct on out-of-range values
Calling a single parameter setMOVE item by itemDirect when there are few itemsMany items are easily missed; use a block
Switching many parameters as a batchMOVE_BLK a data blockKeep running and recipe areas apartLengths must match
Recipes stored in DBsDB to DB copyItem by item or as a blockWatch optimised block access
Accept only in-range parametersComparison clampingRefuse to load if out of rangeRaise an alarm too
Switching must have the machine stoppedStatus-bit interlockForbid switching while runningConfirm the safe state
Signal completion of the switchSet a "loaded" flagUsed by the HMI and later logicDo not set it on failure
Keep the current recipe across power-downRetentive running areaAvoids reloadingRecheck parameters on power-up
Very many recipesIndex plus arrayAvoids a long comparison chainBounds-check the index

7. Notes

The real danger in recipe switching is not moving the wrong data but enabling it halfway through. Keeping the recipe area and the running area separate and using a flag to control when to enable avoids this. Looking back, comparison selects, MOVE transfers, and the interlock decides when to transfer; keep these three roles clear and nothing gets tangled.

8. References

The semantics of comparison and move instructions and the data type definitions follow GB/T 15969.3, Programmable controllers, Part 3: Programming languages (equivalent to IEC 61131-3). The safety requirements when device parameters are changed follow GB 5226.1 and the equivalent international standard IEC 60204-1. The exact instructions and data block access depend on the CPU version in use.

9. Points to watch

⚠️ Three common traps:
1. No default branch when the recipe number is out of range, so the program neither switches nor alarms and "pressing does nothing";
2. Switching a recipe while running so parameters change mid-action, producing over-temperature or over-speed;
3. Not validating parameters after the move, so a wrong recipe is enabled and, when a protective action trips, the cause cannot be traced.

Put the machine into a switch-permitted state before changing recipes, validate the parameters after loading, and confirm before starting work. Parameters tied to safety limits should have a hard limit or be backed by a further protective circuit.

Related reading

Related 3D models: Ready to build it? Download free 3D models & CAD drawings at MOULDL »
MOULDL · Electrical Knowledge Base · free self-study reference for electrical & automation engineers, 3D CAD models at MOULDL