×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 17471561, Entry date: 08/26/2009
(8)
Rate

How do you perform non-volatile saving of changed parameter data as variable ranges in the CPU's internal EEPROM memory?

  • Entry
  • Associated product(s)

Description
When the backup time of the high-performance capacitor (depending on CPU type) or the battery module (200 days) expires, the changed parameters are lost. Using the subprograms from the operations library of this FAQ, you can perform non-volatile saving of changed parameter data as variable ranges in the CPU's internal EEPROM memoryMit den U during runtime (the system manual describes saving of a single variable).

Validity
The operations library can be used in STEP 7 Micro/WIN version V4.0 SP7 and higher.

Warning
During startup of the CPU, no memory module that contains a DB (data block) may be slotted. If a memory module with DB is slotted, the CPU reads out the memory module instead of the internal EEPROM and the data stored is written back incorrectly.

Incorporating the operations library

  1. Save the download "store_to_eeprom.zip" on your computer.
  2. Unpack the "store_to_eeprom.zip" file in a separate directory.
  3. Start the unpacked STEP 7 Micro/WIN library "store_to_eeprom.mwl" with a double-click.
  4. In the STEP 7-Micro/WIN dialog field that opens you confirm integration of the library.

The "EEPROM (v1.0)" folder added contains the subprograms "EEPROM_Direct" and "EEPROM_Indirect".


Fig. 01

Using the subprograms

  1. Insert the required subprogram from the "EEPROM (v1.0)" folder into your network.
  2. Assign the inputs and outputs of the selected subprogram call Notes on this are in the parameter tables of the examples.

Using appropriate connection logic to ensure that the trigger for executing the program remains 1 (high) at the "Start" input for the duration of the execution.

More information is also available in the comments of the subprogram.

Note
Do not store any data with high frequency in the EEPROM. Typically, only 100,000 memory accesses to an EEPROM are possible. If this value is exceeded, the CPU becomes defective. If you store values on the EEPROM by the hour, then the EEPROM has an expected service life of 11 to 12 years.

Example of direct addressing of the start address "EEPROM_direct"

 
Fig. 02
 

Parameters Variable type Explanation
EN BOOL Must always be 1 (high)
Start BOOL Trigger for program execution, activated by rising edge (0 ->1); must remain 1 (high) until BUSY bit becomes 0 (low).
V_Start INT Absolute specification of the start address, e.g. 200=VB 200
Length INT Number of bytes to be stored as from the start address
Memory INT Temporary memory for subprogram
Busy BOOL Processing status 1 (high), program in operation
Done BOOL Finished status 1 (high), storage completed successfully
Table 01

Example of indirect addressing of the start address "EEPROM_indirect"


Fig. 03
 

Parameters Variable type Explanation
EN BOOL Must always be 1 (high)
Start BOOL Trigger for program execution, activated by rising edge (0 ->1); must remain 1 (high) until BUSY bit becomes 0 (low).
Address DWORD Pointer to the first bit of the start address (the start address is read into a variable of the type DWORD)
Length INT Number of bytes to be stored as from the start address
Memory INT Temporary memory for subprogram
Busy BOOL Processing status 1 (high), program in operation
Done BOOL Finished status 1 (high), storage completed successfully
Table 02

Testing the program
After running the program, delete the retained V variables and load the stored data back into the CPU.
 

No. Remarks
1 Deleting the data
Navigate via "View > Component > System Block" to the "System Block" dialog and select the "Retentive Ranges" tab.


Fig. 04

Select the data area and enter the start address and start range. Click on the "Clear" button. Sample values are shown in the figure below.

 
Fig. 05

2 Loading the data
  • Switch off the CPU.
  • Switch on the CPU.

During startup of the CPU, the stored data is written from the CPU's internal EEPROM into the memory.

Table 03

Additional information

  • Information on inserting libraries in STEP 7 Micro/WIN is available in Entry ID: 16689345.
  • SP7 for STEP 7 Micro/WIN V4.0 is available for downloading free of charge in  Entry ID: 33005232 .

Download

 store_to_eeprom.zip ( 4 KB )

Keywords:
SMB31, SMW32

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
https://www.siemens.com/cybersecurity#Ouraspiration.
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.