Description:
This entry describes how to work with Micro Memory Cards (MMC). A sample project is also included in Point 4. The program shows how you can check whether specific data in a data block is located in the load memory.
1. How should I save blocks or configuration data on the MMC which are transferred online to the CPU?
When you load blocks (OB, FC, FB, DB) and system data (from the HW Config among other places, for example) into the CPU, they are automatically saved in such a way as to be safeguarded against voltage failure. The MMC is a flash EPROM medium.
2. Is there still need for the "Copy RAM to ROM..." function?
Not for saving blocks. However, if you have changed data blocks, for instance if you have optimized control parameters, this function also allows you to save the changed data values on the MMC (i.e. on the load memory), which means that these new values are also available following general PLC resetting (including in cases where the MMCs are used as spare parts in another CPU).
Warning:
Please note carefully that the "Copy RAM to ROM..." function affects all data blocks that are identified as "unlinked". In the case of these data blocks, when the "Copy RAM to ROM..." function is performed, the initial values in the load memory (on the MMC) are overwritten with the actual values in the main memory.
For all data blocks, the initial values are taken as new values after an overall reset. In the case of non-remanent data blocks the initial values are also taken as new values after POWER OFF/ON or after STOP/RUN operating modes.
If you want to save individual data blocks or data block elements in the load memory, you can use SFC84 to do that. Here, please note the following Point 3.
3. Can I save data blocks on the MMC via the user program, i.e. use the content as new initial values in the load memory?
CPUs with MMCs feature the SFCs 82, 83 and 84 for this purpose:
- SFC82 allows you to set up a data block in the load memory.
- SFC83 allows you to copy data areas from the load memory to the main memory, and
- SFC84 saves data areas in the load memory, i.e. it performs the function which is formulated in the question. However, bear in mind that the MMCs support a limited number of writing cycles (according to the manufacturer's details, 100,000 writing cycles are possible). For details about the memory concept of CPUs (load memory, main memory... ), please refer to the FAQ in Entry ID 7302326.
4. How can I check whether the data is really saved in the load memory with SFC84?
A check is possible if the data block is declared as "unlinked".
After copying an "unlinked" DB with SFC83 to the working area of another DB you can make a check. In the load memory itself it is not possible to access with a variables table or via "Monitor/control variable", because access is made here to the working area. There is an example of how to work with SFC83 attached. This illustrates how the SFC 84 works.
Please also bear in mind that SFC 83 and SFC 84 work asynchronously. This means that the SFCs might need several cycles to complete a job.
If the data block in the load memory has the attribute "unlinked", you can make the check by loading the DB into the PG. Here, STEP 7 retrieves the current values from the load memory during each loading process. In this regard, also refer to the FAQ in Entry ID 21688777.
Sample project:
Save the "MMC_S7_300_SFC83.zip" file in a separate directory and then dearchive it. The S7 project then unpacks with all the associated subdirectories. You can use the SIMATIC Manager to open and process the extracted project.
MMC_S7_300_SFC83.zip ( 158 KB )
5. When is it useful to compress an S7-300 CPU with MMC?
Deleting blocks on the CPU creates gaps in the load and main memories. The gaps are not automatically closed when new or changed blocks are transferred. When you compress, the gaps are closed by copying the existing or new blocks. The procedure is comparable with the defragmenting of hard disks in Windows.
You reduce cycle times by compressing. That is why it is only useful to compress in order to close a large number of gaps after blocks have been deleted frequently in the CPU.
Compressing just after performing the "Load user program onto memory card" function is not useful, because the MMC is deleted when the function is performed and the blocks can be transferred without any gaps onto the MMC.
Warning: Compressing, transferring and deleting blocks extends the cycle time of the CPU.
In the STOP operating mode you can perform compressing completely. In the RUN-P operating mode, blocks that are open because of the running program cannot be moved when compressing is performed.
|