Resetting the PLC project
A reset of the PLC project stops the program and resets the variables to their initialization value. RETAIN variables and PERSISTENT variables are also reset depending on the type of reset.
- Reset cold: All variables of the active PLC project, with the exception of the remanent variables (RETAIN and PERSISTENT variables), are reset to their initialization value.
- Reset original: All variables of the active PLC project, including the remanent variables (RETAIN and PERSISTENT variables), are reset to their initialization value. The PLC project on the controller is reset.
The small sample program and the following instructions illustrate the behavior of the different resets to you.
See also:
- Reference Programming: Remanent Variables - PERSISTENT, RETAIN
- TC3 User Interface documentation: Command Reset cold
- TC3 User Interface documentation: Command Reset origin
Sample program
Declaration:
VAR
nVar : INT := 0;
END_VAR
VAR RETAIN
nVarRetain : INT :=0;
END_VAR
VAR PERSISTENT
nVarPersistent : INT:= 0;
END_VAR
Implementation:
nVar := 100;
nVarRetain := 200;
nVarPersistent := 300;
- 1. Execute the command Build.
- 2. Load the PLC project into the controller.
- 3. In the menu PLC or in the toolbar TwinCAT PLC Toolbar Options, select the command Login to switch to online mode.
- 4. Start the PLC program.
- Observe the variables nVar, nVarRetain and nVarPersistent.
Performing a Reset cold:
- 1. Select the command Reset cold in the menu PLC or in the TwinCAT PLC Toolbar Options.
- A query appears, asking if you really want to execute the command.
- 2. Confirm the dialog with Yes.
- The PLC project is reset. The variable nVar is set to the initialization value 0. The RETAIN variable nVarRetain and the PERSISTENT variable nVarPersistent retain their value
Performing a Reset origin:
- 1. Select the command Reset origin in the menu PLC or in the TwinCAT PLC Toolbar Options.
- A query appears, asking if you really want to execute the command.
- 2. Confirm the dialog with Yes.
- The PLC project is logged out. All variables are reset to their initialization value.