grnick50
Lifetime Supporting Member
Dear all, I have the following program in codesys with a "Case of" statement. If one of the IF Statments is valid, the step0 variable will become 10. At this point I want the code to interrupt and go to pointer 10 instead of carrying on to the next if statement. I fixed that by making the if condition as follows:
IF (LPF9E_1_CG_CMD <> LPF9E_1_CG_CMD_old AND Step0<>10)...
The question is if there is a GOTO or a JUMP instruction I could use instead, at the end of each IF statement.
IF (LPF9E_1_CG_CMD <> LPF9E_1_CG_CMD_old AND Step0<>10)...
The question is if there is a GOTO or a JUMP instruction I could use instead, at the end of each IF statement.
CASE Step0 OF
(*Initialization*)
0: Step0 := 1;
xKNX_SND_EN1 := FALSE;
xKNX_SND1 := FALSE;
xUDP_EN1 := FALSE;
xUDP_SND1 := FALSE;
(*Checking, whether a value changed and
defining the corresponding values. *)
1: IF (LPF9E_1_AE_CMD <> LPF9E_1_AE_CMD_old) THEN
strDEST_ADR := '8/0/0' ;
xWert := LPF9E_1_AE_CMD;
LPF9E_1_AE_CMD_old := LPF9E_1_AE_CMD;
Step0 := 10;
END_IF
IF (LPF9E_1_BF_CMD <> LPF9E_1_BF_CMD_old) THEN
strDEST_ADR := '8/0/1' ;
xWert := LPF9E_1_BF_CMD;
LPF9E_1_BF_CMD_old := LPF9E_1_BF_CMD;
Step0 := 10;
END_IF
IF (LPF9E_1_CG_CMD <> LPF9E_1_CG_CMD_old) THEN
strDEST_ADR := '8/0/2' ;
xWert := LPF9E_1_CG_CMD;
LPF9E_1_CG_CMD_old := LPF9E_1_CG_CMD;
Step0 := 10;
END_IF
(*The corresponding values are defined.
Enable the FB generates the KNX frames*)
10: xKNX_SND_EN1 := TRUE;
IF xKNX_SND1 THEN (*Wait till the FB is ready*)
Step0 := 20;
END_IF
(*Enable the FB, which sends the generated
KNX frames via UDP to the KNX system*)
20: xUDP_EN1 := TRUE;
IF xUDP_SND1 THEN (*Wait till the FB is ready*)
xUDP_EN1 := FALSE; (*Set/Reset the handshake bits*)
xUDP_SND1 := FALSE;
xUDP_SND1_Reset := TRUE;
xKNX_SND_EN1 := FALSE;
xKNX_SND1 := FALSE;
xKNX_SND1_Reset := TRUE;
strDEST_ADR := '' ;
Step0 := 1; (*Go to Step0:=1*)
END_IF
END_CASE