5. CONFIGURATION
byStatus:= 2;
END_IF
102: // Execute pulse OFF
// Valids the pulse duration
IF byPulseTime > 1 THEN
// Check if there is already an active command on this point
IF ptDbpVarAdr^.ON OR ptDbpVarAdr^.OFF THEN
// Returns that there is already an active
byStatus:= 6;
ELSE
// Enables TRIP output
ptDbpVarAdr^.ON:= FALSE;
ptDbpVarAdr^.OFF:= TRUE;
// Next step: execute pulse OFF
byState:= byCmdType;
// Returns started command
byStatus:= 5;
END_IF
ELSE
// Returns the out of range pulse
byStatus:= 2;
END_IF
ELSE
// Returns invalid command
byStatus:= 1;
END_CASE
// Memorizes the instant of the pulse end
udiPulseEnd:= SysTimeGetMs() + BYTE_TO_UDINT(byPulseTime)
*
10;
101, 102:// Continues the pulse execution ON/OFF
// It returns that the command is running
byStatus:= 5;
// Checks the running parameter change
IF byCmdType <> 100 AND byCmdType <> byState THEN
// Returns the running parameter change
byStatus:= 3;
END_IF
// Checks pulse end
IF SysTimeGetMs() >= udiPulseEnd THEN
// Disable TRIP and CLOSE outputs
ptDbpVarAdr^.ON:= FALSE;
ptDbpVarAdr^.OFF:= FALSE;
// Returns finished command, only if the command has not changed
IF byCmdType = 100 OR byCmdType = byState THEN
byStatus:= 7;
END_IF
// Next state: initial
byState:= 0;
END_IF
END_CASE
// Checks digital module (DBP point) quality
IF stQuality.VALIDITY <> QUALITY_VALIDITY.VALIDITY_GOOD THEN
204