Hi there,
Sorry for the previous post, but I hit send button before I completed my message.
I experienced a weird trouble programming a Wago 750-842 ethernet
programmable coupler.
I am mostly using Structured Text language and it happened something
like this:
I had FB, suppose something like this:
FUNCTION_BLOCK TDummy
VAR_INPUT
VarIN: BOOL;
END_VAR
VAR_IN_OUT
VarExchange: BOOL;
END_VAR
VAR_OUTPUT
VarOUT: BOOL:=FALSE;
END_VAR
VAR
LocalVar: WORD;
END_VAR
From the calling program I wrote a code like this:
VAR
Dummy: TDummy;
a,b:BOOL;
i:BYTE;
ArrBool:ARRAY [1..10] OF BOOL;
END_VAR
FOR i:=1 TO 10 DO
Dummy(VarIN:=a;VarExchange:=ArrBool);
b:= b OR Dummy.VarOUT;
END_FOR
My problem came from a very weird behaviour. Debugging the code, I found that
inside the FB I hadn't the real value I passed in VarExchange.
I finally found a solution, and it was all about passing a temporary BOOL
single variable into VarExhange, like this
FOR i:=1 TO 10 DO
TempBoolVar:=ArrBool;
Dummy(VarIN:=a;VarExchange:=TempBoolVar);
ArrBool:=TempBoolVar;
b:= b OR Dummy.VarOUT;
END_FOR
Just this way my ArrBool array got modified the proper way, w/o data alteration.
Anybody experienced such a trouble?
Any explanation?
Ciao
Luca
Sorry for the previous post, but I hit send button before I completed my message.
I experienced a weird trouble programming a Wago 750-842 ethernet
programmable coupler.
I am mostly using Structured Text language and it happened something
like this:
I had FB, suppose something like this:
FUNCTION_BLOCK TDummy
VAR_INPUT
VarIN: BOOL;
END_VAR
VAR_IN_OUT
VarExchange: BOOL;
END_VAR
VAR_OUTPUT
VarOUT: BOOL:=FALSE;
END_VAR
VAR
LocalVar: WORD;
END_VAR
From the calling program I wrote a code like this:
VAR
Dummy: TDummy;
a,b:BOOL;
i:BYTE;
ArrBool:ARRAY [1..10] OF BOOL;
END_VAR
FOR i:=1 TO 10 DO
Dummy(VarIN:=a;VarExchange:=ArrBool);
b:= b OR Dummy.VarOUT;
END_FOR
My problem came from a very weird behaviour. Debugging the code, I found that
inside the FB I hadn't the real value I passed in VarExchange.
I finally found a solution, and it was all about passing a temporary BOOL
single variable into VarExhange, like this
FOR i:=1 TO 10 DO
TempBoolVar:=ArrBool;
Dummy(VarIN:=a;VarExchange:=TempBoolVar);
ArrBool:=TempBoolVar;
b:= b OR Dummy.VarOUT;
END_FOR
Just this way my ArrBool array got modified the proper way, w/o data alteration.
Anybody experienced such a trouble?
Any explanation?
Ciao
Luca