Sign in to follow this  
Followers 0
kotermak

How long could be integer or DINT

4 posts in this topic

How long  could be INT array. For example can I build INT[365] or DINT[365]?

When I use more than [32] my controller fails.

Thanks. 

Share this post


Link to post
Share on other sites

Welcome to the MrPLC forum community !

The Logix operating system supports array tags of up to 2 megabytes, which would be an INT[1048576] array.   The software will warn you if you try to create a tag bigger than 1.5 MB, but it will be valid up to 2 MB.

Remember that arrays start with element zero.   If you have an INT[32] type array and the element index number is [32] or bigger the controller will throw a minor recoverable fault.

I'm in the habit of testing the index value before I execute an instruction with a variable array index, like LEQ(IndexValue,31) in the ladder rung.  

Some programmers are more thorough and use the SIZE instruction to determine the array size before putting in such a limit, so their limiting logic will still work even if the array size is changed later.

2 people like this

Share this post


Link to post
Share on other sites
On 10/10/2021 at 3:27 PM, Ken Roach said:

Welcome to the MrPLC forum community !

The Logix operating system supports array tags of up to 2 megabytes, which would be an INT[1048576] array.   The software will warn you if you try to create a tag bigger than 1.5 MB, but it will be valid up to 2 MB.

Remember that arrays start with element zero.   If you have an INT[32] type array and the element index number is [32] or bigger the controller will throw a minor recoverable fault.

I'm in the habit of testing the index value before I execute an instruction with a variable array index, like LEQ(IndexValue,31) in the ladder rung.  

Some programmers are more thorough and use the SIZE instruction to determine the array size before putting in such a limit, so their limiting logic will still work even if the array size is changed later.

Thanks for detailed response and explanation.

Looks like I resolved that issue. Now I have last couple rungs  of my routine where i want to add all values of my  Array[52].  Any idea how to write the short formula for the CMP (Compute) instruction which will give me the SUMM (total decimal value) of all DINs in my Array[52]? I tried these options {Array[value]}; Array{value} and others but all returned with error. I dont want to write formula with summary of 52 values : Array(0)+Array(1)+........Array(52).    I checked all manuals and instruction descripton so far found nothing. Do I missing something there? Thanks. 

Share this post


Link to post
Share on other sites

You could use an AVE instruction on the array and then MUL the average by the size of the array. You'll have to "blink" the AVE instruction since it only calculates once per rung-goes-to-true. I've tested that with either a flasher bit in front of it or by immediately unlatching the .EN and .DN bits of the AVE instruction's control tag. You can decide which is what you want to do.

ArraySum1.thumb.PNG.d5d6b84f50b4fe779e51

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