HELLO guys
I'm working with a module containing an ASI_MASTER_(1or2).
It contains an ASI_(1or2)_binaryIO, Itself containing ASi INPUT bin and ASi Output bin.
Inside i have the address %IB1 of type ARRAY[1..31] OF BYTE.
INPUT :
So %IB1 contains bits %IX1.0...%IX1.3 of type BOOL,
%IB2 contains bits %IX2.0...%IX2.3 of type BOOL
and so on up to 31.
OUPUT:
Same way as the INPUT expect : %QB1.........%QB31.
%QX1.0......%QX1.3
Question : My code looks like this;
For idx := 0 to 31 do
case idx of
1 : IF %IX1.0 = TRUE THEN
%QX1.0 = TRUE
end_if
IF %IX1.1 = TRUE THEN
%QX1.1 = TRUE
end_if
2 : IF %QX1.0 = TRUE THEN
%QX1.0 = TRUE
end_if
IF %QX1.1 = TRUE THEN
%QX1.1 = TRUE
end_if
.
.
.
31 : ...................
END_IF
idx := idx + 1;
end_case
end_for
The program works correctly. But i want to know if there is another method that will allow me to not copy the same thing 31 times.
I hope I have been clear enough.
Thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HELLO guys
I'm working with a module containing an ASI_MASTER_(1or2).
It contains an ASI_(1or2)_binaryIO, Itself containing ASi INPUT bin and ASi Output bin.
Inside i have the address %IB1 of type ARRAY[1..31] OF BYTE.
INPUT :
So %IB1 contains bits %IX1.0...%IX1.3 of type BOOL,
%IB2 contains bits %IX2.0...%IX2.3 of type BOOL
and so on up to 31.
OUPUT:
Same way as the INPUT expect : %QB1.........%QB31.
%QX1.0......%QX1.3
Question : My code looks like this;
For idx := 0 to 31 do
case idx of
1 : IF %IX1.0 = TRUE THEN
%QX1.0 = TRUE
end_if
IF %IX1.1 = TRUE THEN
%QX1.1 = TRUE
end_if
2 : IF %QX1.0 = TRUE THEN
%QX1.0 = TRUE
end_if
IF %QX1.1 = TRUE THEN
%QX1.1 = TRUE
end_if
.
.
.
31 : ...................
END_IF
idx := idx + 1;
end_case
end_for
The program works correctly. But i want to know if there is another method that will allow me to not copy the same thing 31 times.
I hope I have been clear enough.
Thank you