Hi, i've got a serious looping problem over a fc input bool variables list - it should be easy but the heat makes me a heavy-thinker.
The function should read inputs set status bit in word and reset it if ack bit comes up.
And here is the problem - i'm not able to shift register for input variables. I've tried shifting like below ( +P#0.1 ) and the strange problem was - if I entered flags m55.0 and M55.1 for 2 first parameters, and other were left blocked with always 0 flag - trying on simulator the whole M55 word was read - even when not entered as function's parameter.
What am I doing wrong ?
The function should read inputs set status bit in word and reset it if ack bit comes up.
And here is the problem - i'm not able to shift register for input variables. I've tried shifting like below ( +P#0.1 ) and the strange problem was - if I entered flags m55.0 and M55.1 for 2 first parameters, and other were left blocked with always 0 flag - trying on simulator the whole M55 word was read - even when not entered as function's parameter.
What am I doing wrong ?
Code:
FUNCTION "Alarm_W" : VOID
TITLE =
VERSION : 0.1
VAR_INPUT
Alarm_00 : BOOL ;
Alarm_01 : BOOL ;
Alarm_02 : BOOL ;
Alarm_03 : BOOL ;
Alarm_04 : BOOL ;
Alarm_05 : BOOL ;
Alarm_06 : BOOL ;
Alarm_07 : BOOL ;
Alarm_08 : BOOL ;
Alarm_09 : BOOL ;
Alarm_10 : BOOL ;
Alarm_11 : BOOL ;
Alarm_12 : BOOL ;
Alarm_13 : BOOL ;
Alarm_14 : BOOL ;
Alarm_15 : BOOL ;
ACK_Group : BOOL ;
ACK_Tick : BOOL ;
END_VAR
VAR_IN_OUT
StatusWord : WORD ;
ACK_WORD : WORD ;
NewEvent : BOOL ;
END_VAR
VAR_TEMP
loop_count : INT ;
END_VAR
BEGIN
NETWORK
TITLE =
L P##ACK_WORD;
LAR1 ;
L P##StatusWord;
LAR2 ;
NETWORK
TITLE =
L 10;
L: T #loop_count;
A #Alarm_00;
S [AR2,P#0.0];
A [AR1,P#0.0];
A [AR2,P#0.0];
AN #Alarm_00;
R [AR2,P#0.0];
A #ACK_Tick;
AN #Alarm_00;
R [AR1,P#0.0];
L P#0.1
+AR1
+AR2
L #loop_count;
LOOP L;
END_FUNCTION