The power-off preservation method of Siemens S7-200plc program data can be divided into three types. The data power-off preservation method and characteristics are as follows:
1. Set the power-down data hold function in the system block to save the data.
In the programming of the S7-200, there is a function in the system block for the power-off data hold setting, including V memory area, M memory area, time relay T and counter C (where the timer and counter only the current value can be maintained) And the timer bit or counter bit cannot be held). The basic work is mainly when the external power supply of the PLC is interrupted, and the super capacitor inside the PLC is used to supply power, and the value of the power-off data holding area set in the system block is kept unchanged, and the data value of the non-holding area is reset to zero. Due to the limitation of the capacity of the supercapacitor, it is stated in the Siemens data that it can only be stored for several days. For the first fourteen bytes in the M memory area (ie MB0-MB13), when the power-off data is set to be held, when the external power supply to the PLC is interrupted, the PLC automatically transfers the data of the above memory area to the EEPROM, so Achieve permanent power outages.
For longer RAM memory power-down data retention times, Siemens offers an optional battery card that continues to provide power after the supercapacitor is exhausted, extending data retention time (approximately 200 days).
Second, create a data block to save data during programming.
In the programming phase of the programming, the data block can be created in the programming and given the initial value required. After the programming is completed, it is downloaded to the RAM memory of the PLC together with the program, and the CPU automatically dumps it in the EEPROM at the same time as the EEPROM memory. The V data in the permanent storage area. Since the data storage of the EEPROM does not require power supply maintenance, permanent storage can be realized. If the corresponding V memory area is not set to power-down data retention in the system block, the CPU automatically reads the V data value in the EEPROM into the V memory area of ​​the RAM each time the PLC powers up. If the corresponding V storage area is set to power-off data retention, the CPU detects whether the power-off data is saved successfully each time the PLC is powered on. If successful, the corresponding V data in the RAM remains unchanged. If the save is unsuccessful, the corresponding V data value in the EEPROM is read into the V memory area of ​​the RAM. This method is only applicable to the power-off data saving of V data.
Third, use SMB31 and SMW32 to save data in the program.
Write the V memory address to be saved to SMW32 in the program, write the data length to SMB31, and set SM31.7 to 1. At the end of each scan of the program, the CPU automatically checks SM31.7. If it is 1, the specified data is stored in the EEPROM, and then SM31.7 is set to zero. The saved data will overwrite the V storage in the previous EEPROM. The data in the zone. Do not change the value of the V memory area in RAM until the save operation is complete. Saving an EEPROM operation will increase the scan time by 15 to 20 milliseconds. Because the number of EEPROMs is limited (minimum 100,000 times, typically 1 million times), you must control the number of times saved in the program, otherwise it will cause the EEPROM to fail.
Combining the above understanding and the experience of site debugging, in practical applications, if you need to maintain the program data, you need to combine multiple methods to achieve the best results. Different ways are needed to save the data in the program. For data that needs to be preset during the first run of the program and reset in individual cases during program operation, such as height, load and other related calibration parameters, data can be created in the data block of the program and given initial values. . At the same time, the SMB31 and SMW32 commands are programmed in the program, and the V data area of ​​the EEPROM is re-saved under the relevant conditions, and the previous initial value is modified. The example is as follows. When the parameter setting is made, set M0.0 to 1, and complete the EEPROM memory save operation of VD100 once.
For data that changes frequently during the running of the program and needs to be saved for a long time, the data can be stored in the MB0 to MB13 storage area, and the corresponding M storage area is set to be off in the power-down data saving setting of the system block. Electric data is saved. You can also use the V memory area in the program. If necessary, perform program data storage as shown in the above figure, but you can select it in the power-off data retention setting or not.
1000 Portable Power Station,1000 Portable Power Station Price, 1000 Portable Power Station product
Jiangsu Zhitai New Energy Technology Co.,Ltd , https://www.zhitainewenergy.com