Supported platforms: CODESYS 2.3, CODESYS 3.5

 

JCD_DirSwitchLogic (FB)

Description

JCD_DirSwitchLogic function block is used for monitoring direction switches of the joystick and comparing their status to the calibrated control signal. An error output is activated when the direction switch status is not active within a given time while the control signal becomes active to the same direction. An error output is also activated when both direction switches are active simultaneously for a given time.

After first call of the function block, both direction switches status must be false at the same time for at least one program cycle (joystick is centered), until then, the error output is active. This startup check ensures that neither of the direction switch inputs is not wired directly to the supply voltage or the switch is not jammed in the active position.

Limitations

This function block is primarily intended for JoystickCalibrationAndDiagnostic library's internal use.

 

It should be noted during calibration that directional switches should be activate before the calibrated control signal activates, which means that deadband should be calibrated so that directional switches activate within the dead band range.

 

 

 

 

Inputs

Input variable name

Data type

Range

Description

i_ControlSignal

INT

-32767..32767

Calibrated control signal.

i_DirSwitch_Pos

BOOL

FALSE/TRUE

Direction switch status for positive direction.

i_DirSwitch_Neg

BOOL

FALSE/TRUE

Direction switch status for negative direction.

i_ErrorDelay

UINT

0..65535 ms

Defines the time that Direction switches are allowed to be on simultaneously or how long direction switch status can be missing while Control signal is active.

Outputs

Output variable name

Data type

Range

Description

o_PosDirSwitchMissing

BOOL

FALSE/TRUE

Positive direction switch has not activated when it should.

o_NegDirSwitchMissing

BOOL

FALSE/TRUE

Negative direction switch has not activated when it should.

o_BothDirSwitchesActive

BOOL

FALSE/TRUE

Both direction switches are active at same time.

o_DirSwitchesNotResetAfterStart

BOOL

FALSE/TRUE

At least one of the direction switches has not been false after startup, controlling is disabled until that.

 

See also

-

 

Source file Topic000367.htm

Last updated 21-Feb-2025