Does Writing a New Program to a PLC Overwrite the Original Program?

This is a common question among PLC beginners, when a new program is successfully written (downloaded) to the PLC, the existing old program in the PLC is completely deleted and replaced.

1. When using programming software (such as Siemens STEP 7) to perform the “download” operation, the internal process is as follows:

1. Compilation: Your programming software first compiles the source code on your computer into machine code executable by the PLC.

2. Connection and Stop: The software connects to the PLC via a network cable. To write a new program, the PLC usually must be in STOP mode. The software will prompt you, and if necessary, it will automatically switch the PLC to STOP mode.

3. Clear and Write: The PLC will clear the original program storage area and then write the new program completely into the program memory.

4. Start Running: After the download is complete, you can choose to switch the PLC back to RUN mode, and the new program will start executing.

So, this process is more like giving the PLC a “new brain” rather than “adding memory” to its original brain.

2. Important Exceptions and Considerations: Although the old program will be deleted, there are some key points to pay special attention to:

1. Data Blocks / Retentive Storage Area:

If your new program contains data blocks (DB), the initial values in the data blocks (e.g., preset recipes, timer settings, etc.) will overwrite the corresponding values in the PLC’s retentive storage area during the download.

If your new program does not contain data blocks, the current values in the PLC data area (including the retentive storage area) will usually remain unchanged. This explains why sometimes after downloading a new program, certain data (such as counter values) may still be old.

2. System Blocks (Hardware Configuration): System blocks contain the PLC’s hardware configuration parameters, such as digital input filter times, analog calibration values, communication port parameters, etc.

If “System Blocks” is checked during the download, the new hardware configuration will overwrite the old one.

If “System Blocks” is not checked, the PLC will continue to use the old hardware configuration, which may cause the new program to not work as expected. Therefore, it is recommended to always include modified system blocks during the download.

3. Operational Recommendations:

1. Always back up before downloading: Before making modifications to a running PLC, perform an “upload” operation to completely save the current program, system blocks, and data blocks from the PLC to your computer. This prevents loss of the original program in case of a download error.

2. Complete Download: To ensure the PLC’s behavior matches exactly what is seen in the programming software, check “Program Blocks”, “Data Blocks”, and “System Blocks” (if you have modified them) during the download.

3. Clear Operation: Most programming software provides a “clear” or “reset” function. This function will format the PLC’s storage area, deleting all programs, data, and configurations, restoring it to factory settings. This is more thorough than a regular download operation.

Conclusion:

Writing a new program will delete the old program, but whether the values in the PLC data area change depends on the content you download. Understanding this is crucial for the safe and correct maintenance and debugging of PLC programs.

Leave a Comment