Codesys Case of statement

grnick50

Lifetime Supporting Member
Join Date
Nov 2010
Location
Ptolemaida
Posts
332
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.

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
 

Similar Topics

Hello, I am using a Hitachi Micro EHV+ for a small project, and I wanted to have a Web visu, done with Codesys V3.5 SP13 Patch 2. I test the...
Replies
6
Views
287
Hello, I have a requirement to manage the text alignment dynamically. So, for example: 1. English Texts should be displayed from Left in...
Replies
0
Views
90
Hello, I am new to Codesys, and am trying to learn about it for a project we're developing. I've got a couple questions, but first a little...
Replies
1
Views
139
Hi everyone, as this is my first experience with Rockwell Software i would like to know what's the best way to make Enumerations?
Replies
10
Views
501
I am trying to get Codesys to work with a couple of Moxa ioLogik E1200 series DIO devices (E1210 and E1211). I am able to write to the E1211 DOs...
Replies
2
Views
167
Back
Top Bottom