Supported platforms: CODESYS 3.5 SAFETY

 

PowerSwitchSet (External FUN)

Description

This function manipulates the state of a power switch.

The function provides the second control route for deactivating outputs in case of control unit internal failure.

 

Limitations

All outputs are energized via power switches and the switch must be activated (closed) before outputs are controlled.

 

The switch can only be activated if

- control unit internal diagnostic has not noticed any internal errors,

- all IO's are configured and the IO-driver is in RUN state, and

- switch has not been deactivated.

 

The switch can be activated only one time from application.

If application deactivates the switch, it will remain deactivated until the next power-on reset and the error code (33528) is added to the firmware error log.

 

Note, the error code is not supported in firmware version 1.0.0.34

 

Outputs are de-energized when the switch state is changed to deactivated (open).

 

Inputs

Input variable name

Data type

Range

Description

i_powerSwitchNbr

BYTE

0..2

Power switch number: 0 = All, 1 = One, 2 = Two.

i_state

BYTE

0..1

Switch control state: 0 = deactivated (open),

1 = activated (closed).

Return value

Data type

Description

SYSTEM_ERROR_CODES

Retuned error code. See details in Data Types page.

Errors

Error code

Description

FW_ERR_SYSTEM_DIAGNOSTIC_NOT_OK

Control unit internal diagnostic has noticed an error.

FW_ERR_SYSTEM_IO_DRV_NOT_RUN_STATE

I/O initialization has not been done.

FW_ERR_SYSTEM_INVALID_SWITCH_NBR

Given power switch number is out of range.

FW_ERR_SYSTEM_INVALID_STATE

Given state is out of range.

 

Example code

-

 

See also

-

 

 

Source file topic001044.htm

Last updated 13-Jun-2024