Sign in to follow this  
Followers 0
TigerLily

Array Comparison with a single Output for Equals/Not Equal

3 posts in this topic

I am a long time Omron user, but this is my first time using the Sysmac software, I want to compare the 16 bits of my array to zero, if any of the bits are on I want to turn on an output, I see the AryCmpNE and AryCmpNEV, but they have a seperate bit for each item in the Array, is there any way to do this without using Unions?

 

Thank you!!

Share this post


Link to post
Share on other sites

Use the ArySearch function.

Knipsel.JPG.16e7947ff0cf96291f95368c0df1      Each Boolean in the array is compared to 1. If any bit in the array is 1 the output (FOUND) wil turn on.

2 people like this

Share this post


Link to post
Share on other sites

Posted (edited)

If you are using ST language, you can do so as follows:

FOR i := 1 TO SizeOfAry(myArray) DO
	IF myArray[i] THEN
		isArrayNonZero := TRUE;
		EXIT;
	END_IF;
END_FOR;

 

Edited by Moayad
1 person likes this

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