Using Your Program To Store Data Permanently - Siemens Simatic S7-200 System Manual

Programmable controller
Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

CPU Memory: Data Types and Addressing Modes
7.4

Using Your Program to Store Data Permanently

You can save a value (byte, word, or double word) stored in V memory to EEPROM. This
feature can be used to store a value in any location of the permanent V memory area.
A save-to-EEPROM operation typically affects the scan time by 15 ms to 20 ms. The value
written by the save operation overwrites any previous value stored in the permanent
V memory area of the EEPROM.
Note
The save-to-EEPROM operation does not update the data in the memory cartridge.
Copying V Memory to the EEPROM
Special Memory Byte 31 (SMB31) and Special Memory Word 32 (SMW32) command the
CPU to copy a value in V memory to the permanent V memory area of the EEPROM.
Figure 7-19 shows the format of SMB31 and SMW32. Use the following steps to program the
CPU to save or write a specific value in V memory:
1.
Load the V memory address of the value to be saved in SMW32.
2.
Load the size of the data in SM31.0 and SM31.1. (See Figure 7-19.)
3.
Set SM31.7 to 1.
At the end of every scan, the CPU checks SM31.7; if the SM31.7 equals 1, the specified
value is saved to the EEPROM. The operation is complete when the CPU resets SM31.7
to 0. Do not change the value in V memory until the save operation is complete.
MSB
SMB31
sv
Save to EEPROM:
0 = No
1 = Yes
MSB
15
SMW32
Figure 7-19
Limiting the Number of Programmed Saves to EEPROM
Since the number of save operations to the EEPROM is limited (100,000 minimum, and
1,000,000 typical), ensure that only necessary values are saved. Otherwise, the EEPROM
can be worn out and the CPU can fail. Typically, you perform save operations at the
occurrence of specific events that occur rather infrequently.
For example, if the scan time of the S7-200 is 50 ms and a value was saved once per scan,
the EEPROM would last a minimum of 5,000 seconds, which is less than an hour and a half.
On the other hand, if a value were saved once an hour, the EEPROM would last a minimum
of 11 years.
7-16
LSB
7
0
0 0
0
0
0 s1 s0
V memory address
Specify the V memory address as an offset from V0.
Format of SMB31 and SMW32
Size of value to be saved:
00 - byte
01 - byte
10 - word
11 - double word
The CPU resets SM31.7
after each save operation.
LSB
0
S7-200 Programmable Controller System Manual
C79000-G7076-C230-02

Advertisement

Table of Contents
loading

Table of Contents