Sign in to follow this  
Followers 0
noorloai

Masking array in ladder logic

4 posts in this topic

Hi Guys,

I have an Array of BOOL [52].I want to mask this array based on size (SINT) . like if my array size is 12, I want to pass the first 12 elements of Array of Bool and block the rest. I am not sure how to use MVM.

Can someone help me with that ?

Thanks 

Share this post


Link to post
Share on other sites

According to the help file, the MVM instruction only uses SINT, INT, and DINT data types, not a BOOL array. If the elements you want to copy are contiguous (IOW, just the first 12 elements or 12 elements in a row somewhere in the array), use a COP instruction. You will need to move the size to a DINT tag instead of SINT.

 

Share this post


Link to post
Share on other sites

Sorry, I led you wrong. I just tried what I suggested and it won't work. The COP instruction won't work on a BOOL array. It's not as elegant or simple to troubleshoot later, but you can make a loop to move the desired bits over. Or just use a series of "XIC/OTE" pairs if it doesn't change dynamically at run time.

Share this post


Link to post
Share on other sites

If you create a UDT with one member of type BOOL[64], then tags of that data type can be manipulated with COP or FLL.

To do any masking with MVM, first copy the tag to an array of SINT's, INT's, or DINT's as you prefer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0