PLC Control functions - fbarresi/Sharp7 GitHub Wiki
With these control function itโs possible to Start/Stop a CPU and read the PLC status.
| Function | Purpose |
|---|---|
| PlcColdStart | Puts the CPU in RUN mode performing an COLD START |
| PlcHotStart | Puts the CPU in RUN mode performing an HOT START |
| PlcStop | Puts the CPU in STOP mode |
| PlcGetStatus | Returns the CPU status (running/stopped) |
PlcColdStart
Description
Puts the CPU in RUN mode performing an COLD START.
Declaration
public int PlcColdStart()
Return value
- 0 : The function was accomplished with no errors.
- Other values : Either the PLC is already running or the current protection level is not met to perform this operation.
Remarks
This function is subject to the security level set.
PlcHotStart
Description
Puts the CPU in RUN mode performing an HOT START.
Declaration
public int PlcHotStart()
Return value
- 0 : The function was accomplished with no errors.
- Other values : Either the PLC is already running or the current protection level is not met to perform this operation.
Remarks
This function is subject to the security level set.
PlcStop
Description
Puts the CPU in STOP mode.
Declaration
public int PlcStop()
Return value
- 0 : The function was accomplished with no errors.
- Other values : Either the PLC is already stopped or the current protection level is not met to perform this operation.
Remarks
This function is subject to the security level set.
PlcGetStatus
Description
Returns the CPU status (running/stopped) into Status.Value.
Declaration
public int GetPlcStatus(ref int Status)
Parameters
| Name | Type | Note |
|---|---|---|
| Status | int | PLC status |
Status values
| Helper Const | Value | Meaning |
|---|---|---|
| S7.S7CpuStatusUnknown | 0x00 | The CPU status is unknown |
| S7.S7CpuStatusRun | 0x08 | The CPU is running |
| S7.S7CpuStatusStop | 0x04 | The CPU is stopped |
Return value
- 0 : The function was accomplished with no errors.
- Other values : see the Errors Code List.