Using Your Program To Save V Memory To The Eeprom - Siemens Simatic S7-200 System Manual

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

Advertisement

S7-200 Programmable Controller System Manual

Using Your Program to Save V Memory to the EEPROM

You can save a value (byte, word, or double word) stored in any location of the V memory area to the
EEPROM. A Save-to-EEPROM operation typically increases the scan time by a maximum of 5 ms. The
value written by the Save operation overwrites any previous value stored in the V memory area of the
EEPROM.
The Save-to-EEPROM operation does not update the data in the memory cartridge.
Tip
Since the number of Save operations to the EEPROM is limited (100,000 minimum, and 1,000,000
4
typical), you should ensure that only necessary values are saved. Otherwise, the EEPROM can wear
out and the CPU can fail. Typically, you should 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.
Copying V Memory to the EEPROM
Special Memory Byte 31 (SMB31) commands the S7-200 to copy a value in V memory to the V memory
area of the EEPROM. Special Memory Word 32 (SMW32) stores the address location of the value that is
to be copied. Figure 4-20 shows the format of SMB31 and SMW32.
Use the following steps to program the S7-200 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, as
shown in Figure 4-20.
3.
Set SM31.7 to 1.
At the end of every scan cycle, the S7-200 checks SM31.7;
if SM31.7 equals 1, the specified value is saved to the
EEPROM. The operation is complete when the S7-200
resets SM31.7 to 0.
Do not change the value in V memory until the save operation is complete.
Sample Program: Copying V Memory to the EEPROM
This example transfers VB100 to the EEPROM. On a rising edge of I0.0, if another transfer is not in progress, it loads the address
of the V memory location to be transferred to SMW32. It selects the amount of V memory to transfer (1=Byte; 2=Word; 3=Double
Word or Real). It then sets SM31.7 to have the S7-200 transfer the data at the end of the scan.
The S7-200 automatically resets SM31.7 when the transfer is complete.
38
SMB31
7
sv
0
0
0
0
Save to EEPROM:
0 = No
1 = Yes
SMW32
15
V memory address
Specify the V memory address as an offset from V0.
Figure 4-20 SMB31 and SMW32
Network 1
//Transfer a V memory location (VB100)
//to the EEPROM
LD
I0.0
EU
AN
SM31.7
MOVW
+100, SMW32
MOVB
1, SMB31
S
SM31.7, 1
Size of value to be
0
saved:
0
s1
s0
00 – byte
01 – byte
10 – word
11 – double word
The CPU resets
SM31.7 after each
save operation.
0

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents