noorloai

setting BOOL [64] in Studio 5000

6 posts in this topic

Hi,

I need to set an output of bool[64] array when condition triggered but when I download the code to the controller it cause major fault see attached.

Can someone help me with that?

Thanks

 

code fault.png

major fault.jpg

Share this post


Link to post
Share on other sites

If you have declared an array as BOOL[64], there are 64 elements numbered 0 through 63. You should limit check your code to make sure the subscript tag is valid before using it.

Share this post


Link to post
Share on other sites

Thanks, but how can I do that in ladder ?

Share this post


Link to post
Share on other sites

oh do you mean I have to use LIM instruction to check my range and if its not within this range I write 0 then execute this rung ?

Share this post


Link to post
Share on other sites

for this specific problem, you just have to change   BOOL[64] data declaration to  BOOL[65]  and you can use  BOOL[64] bit in your program

Share this post


Link to post
Share on other sites

I would use the LIM instruction. What sets that index address? That code should also limit itself to a valid range of values.

For example, if you're indexing through them in order using an ADD instruction, you should have a GRT instruction right after the ADD that checks for it being greater than 63 (the highest valid value) and writing a 0 to it if it is.

 

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