Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY

 

How to validate 2 channel DI  

This section describes how to read and validate a 2 channel digital input.

 

This example uses the following libraries:

SafeConversion library

SafeDataValidation library

 

 

S_ADCToVoltageOrCurrent, S_VoltageToDI and S_DebounceDI POUs are included in the code template generated by MultiTool Creator.

 

 

 

The following image is an architecture example for a 2 channel DI validation.

 

SafeConversion library version 1.1.0.0 or newer.SafeConversion library version 1.1.0.0 or newer.

 

SafeConversion library version 1.0.1.2SafeConversion library version 1.0.1.2.

 

Example code

When the following example is used with non-safety I/O, the I/O variables are generated in Inputs program instead of S_Inputs.

 

The following example shows the validation of 2 safety related DIs done by Switch1 and Switch2 DI inputs defined in MultiTool Creator.

 

Safe PRG:

 

 

 

Init method:

 

IF NOT initDone THEN

ValidateSwitchDI.Init(

S_i_InvertedCh2:=TRUE ,

S_i_DiagnosticDelay:=30 ,

S_i_SafeOutputState:=FALSE ,

i_pEventCode:=ADR(S_Inputs.o_EventCode_Switch1) ,

i_pEventCodeCh2:=ADR(S_Inputs.o_EventCode_Switch2) );

 

initDone:=TRUE;

END_IF

 

 

See also

 

 

 

Source file topic100376.htm

Last updated 19-Dec-2024