Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 15261408, Entry date: 05/27/2003

Recipe administration with the Micro Memory Card (MMC)

  • Entry
  • Associated product(s)

How can I use the new memory concept to administrate recipes, based on the Micro Memory Card (MMC)?

Since the second half of the year 2001, S7-300 CPUs are available, using a Micro Memory Card (MMC)for the load memory. In comparison with the older CPUs, CPUs with MMC provide the following advantages:

  • The posibility to read the user data out of a load memory of a CPU in the running program.
  • The posibility to write the user data into the load memory of a CPU in the running program.
  • Data remanence without a back-up battery - in case of power failure- the data of the RAM will be memorized on the MMC.

Nowadays, the MMC is equipped with a S7-300 memoryspace up to 8MB , thus providing 166 times more capacity than the size of the RAM.

This article describes how the MMC can be used to administrate recipes (specified scheduled data sets for the process control). Additionally, an article at entry-ID 15261720 is available, which describes the saving of process data on the MMC.

The program example was rendered and documented to move the function modules into the application right away.
The program code of the modules is available and documented as source code (German), that allows to modify the program code and the used calls of the systemfunction SFC 83, if needed.

Detailed description:
A recipe is a collection of user data, which are needed to control a process.
The process control program gets its data sequentially (e.g. material qantities, coordinates, distances, cruises, temperatures) out of the recipe-DB and uses it for the specified determination of the process properties. Usually, the complexity of a recipe is that large that it can be stored within one DB without any waste of space. This example also deals with this presumption.

Usually, more than only one recipe is required to control a process. That means, that there are always more recipe-DBs which need to be configured and administrated. It deals with DBs, which are irrelevant for the procedure DBs, which are stored in the load memory and will not occupy any space of the RAM.

In this program excample, each recipe has a recipe source-DB. All recipe-source-DBs have the same structure. Its contents will be transferred one by one in form of a recipe-DB inside the work memeory, which provides the data for the running process.

Procedure of the configuration and loading of an user program

  1. In the programming device a DB with the required recipe structure will be configurated by the help of the DB-editor, which does serve as original for the whole system of non-relevant recipe source data blocks during the procedure.
  2. By copying and modifying of the configurated recipe-source-DBs, the complete sytem of recipe-source-DBs will be configurated.
  3. If necessary, additional DBs are to be created which are not intended for recipes.
  4. The STEP 7 - code blocks will be configurated.
  5. The complete user program (DBs and STEP 7 code blocks) will be transferred into the CPU.
    The load memory has to be active.

Following these steps the subsequent state has been reached:

  • The complete transferred program has been loaded into the loadmemory.
  • The work memory has only be loaded by the parts of the program which are relevant for the procedure.
    The system of the recipe-source-DBs is only located in the load memory and not in the work memory.

To execute this program, proceed as follows:

  • By means of the variable table "VAT_FC1" set the desired recipe number (1 to 10) inside a work data block at the address "Rez_Number" (DB2.DBW0).
  • Set input 0.7 -> flank marker set -> data block will be copied

Image 1: Illustration of the described procedure

Procedure FC 1: Block to administrate the recipes
The task of the recipe administration program consists of both finding a required recipe within the loadmemory located system of the "recipe-source-DBs" and transferring it afterwards into the recipe-DB of the RAM. After the transfer, the recipe-DB contains the latest recipe for the process control program.

As order for the transfer of a recipe, the recipe administration program receives a recipe number and afterwards, a set start marker ("Rez_Copy"), both by the process control program. The recipe number has the data format "Integer".
The recipes, included within this example, are determined from No. 1 to 10. The recipes are deposited in the data blocks DB10 to DB19. The DB-no.,required for the copying, will therefore be ascertained out of the recipe no. (DBW0 in the work-DB ) and an offset (absolute term with the value "9"), finally being deposited in the DBW2 within one work block. During the preparation of the copy procedure, the DB-no. will be passed over to the variable ANY-pointer "SRC_pointer" (actual parameter of the SFC 83). DB 4 is always required to copy the target-DB. Its number, in this case an absolute term, will be passed over to the ANY-pointer "DST_pointer" (actual parameter of the SFC 83).

After the rebooting of the CPU and every successful transfer, the start marker is being reset by the recipe administration program. Resetting the start marker after the transfer in the cyclic program, is the equivalent signal to the process administration program that the processing of the requested recipe may start.

The copying from the load memory into the work memory takes place using the SFC 83. The block has been integrated into the CPU as system fuction block. The description is available in the Step 7 online help.

The frequency of the reading accesses is not regards as critical, though it should be limited to the necessary quantum.

Figure2: Program process plan of FC1

The attached download contains the "STEP 7 project "Recipe_read_from_MMC" as self unpacking exe-data file with the described recipe administration program.


Copy the file "Reciperead_from_MMC.exe" into a seperate directory and start the file with a doubleclick. The STEP 7 project will be unpacked automatically and can be opened and worked on afterwards.

Continuative information:
Continuative information regarding the topic:

  • Memoryconcepts can be found in the manual of "Automation System CPU Specifications: CPU 31xC and CPU 31x". (Entry ID 12996906 )
  • Function calls (e.g. SFC 83) can be found in the manual "SIMATIC Systemsoftware for S7-300/400 system- and standardfunctions". (entry-ID 1214574 )

Procedure capability and test environment:
The excample is applicable for all S7-300-CPUs with Micro Memory Card (MMC).
The following table contains some components having created this ID and having verified the described mode of working.

Test environment Version
PC platform Intel Pentium III, 650MHz, 384 MB
PC-operating system Windows XP
STEP 7 STEP 7 V5.2
Add ons --
S7-CPU CPU 314C-2 PtP (314-6BF00-0AB0)

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.