CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sun Dec 16, 2018 5:13 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Nov 14, 2018 10:35 am 
Offline

Joined: Thu Apr 05, 2018 3:55 pm
Posts: 1
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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited