RSLogix 5000 Add-On Instruction Global Output

JJH

Member
Join Date
Oct 2015
Location
South Carolina
Posts
57
Hi there,

I am trying to create an Add=On Instruction to help me manage some alarm conditions in my application. My AOI has one Boolean output that is used for messaging on the HMI, but I'd like to also have another output (Boolean or integer) that would be attached to o global parameter so that if any alarm is activated, it will create a master alarm that can be used for machine control, and possibly messaging. The reason for this is that I may have numerous alarms and I'm trying to avoid having to create a series chain of all those alarms to turn on a master alarm. My thought was that if I can get any alarm to make a global parameter go true, then I don't have to manage other bits if I delete or add an alarm block.

I'm having trouble coming up with a way to create that output that I can have load a TRUE value into a global parameter, though. I was trying to use an integer so that I could just load a '1' into the variable if any alarm goes off, and a master reset would reset the value to zero. But I'm apparently not setting up the AOI parameters just right.

Has anyone got a suggestion of how I can do this? I can share my block if that would help, it's nothing special, just a way for me to condense alarming features and this one seems to be a little tricky.

Thanks for your suggestions!
 
Hi there,

I am trying to create an Add=On Instruction to help me manage some alarm conditions in my application. My AOI has one Boolean output that is used for messaging on the HMI, but I'd like to also have another output (Boolean or integer) that would be attached to o global parameter so that if any alarm is activated, it will create a master alarm that can be used for machine control, and possibly messaging. The reason for this is that I may have numerous alarms and I'm trying to avoid having to create a series chain of all those alarms to turn on a master alarm. My thought was that if I can get any alarm to make a global parameter go true, then I don't have to manage other bits if I delete or add an alarm block.

I'm having trouble coming up with a way to create that output that I can have load a TRUE value into a global parameter, though. I was trying to use an integer so that I could just load a '1' into the variable if any alarm goes off, and a master reset would reset the value to zero. But I'm apparently not setting up the AOI parameters just right.

Has anyone got a suggestion of how I can do this? I can share my block if that would help, it's nothing special, just a way for me to condense alarming features and this one seems to be a little tricky.

Thanks for your suggestions!

Just use an In/Out parameter.

It'll have to be a DINT, not a BOOL, but just OTL bit 0 of the DINT in your AOI.

EDIT : use DINTs wherever possible. Using any other data-type slows the code down as they are always converted to DINTs for processing, then converted back again for storing. It may seem overkill to use a DINT when you may only want to store a number in the range 1 to 5 for example, but it uses no more memory than a SINT or an INT, and will preocess faster....
 
Last edited:
Hello,

Thanks for your prompt and accurate suggestion! I think the INT variable is what was tripping me up. After turning on the different bits of a DINT, I pretty much get the result I was looking for.

Much appreciated!
 
Hello,

Thanks for your prompt and accurate suggestion! I think the INT variable is what was tripping me up. After turning on the different bits of a DINT, I pretty much get the result I was looking for.

Much appreciated!

I don't think it is the data-type that caused you issues, my suggestion would work equally well with SINT, INT, or DINT. But using DINT is most economical on processing power.

The "trick" was the use of the In/Out parameter type, or, in other words, "by reference", as opposed to Input and Output parameters being "by value".

It actually occurred to me that you can have a BOOL In/Out parameter, for some reason I originally thought they were not permitted, so you could just pass a "Global_Alarm" BOOL flag as In/Out to the AOI, no need to use bits of an xINT data-type.
 
Just use an In/Out parameter.

It'll have to be a DINT, not a BOOL, but just OTL bit 0 of the DINT in your AOI.

EDIT : use DINTs wherever possible. Using any other data-type slows the code down as they are always converted to DINTs for processing, then converted back again for storing. It may seem overkill to use a DINT when you may only want to store a number in the range 1 to 5 for example, but it uses no more memory than a SINT or an INT, and will preocess faster....

I presume you're talking about a SINT or INT using the same amount of logic memory as a DINT. Surely they don't take up the same amount of data memory?
 
Yes, I used an In/Out BOOL for the AOI parameter and then used a DINT variable and the .0, .1, .2 etc bits of the DINT for the individual alarms. Then I used a NEQ block after all the alarms to create a "master" alarm.
 
I presume you're talking about a SINT or INT using the same amount of logic memory as a DINT. Surely they don't take up the same amount of data memory?

Yes they do... the controller has a 32-bit architecture, so the minimum allocation for data will be 1 32-bit memory word.

I have an L62 controller here with 4,146,928 bytes free data and logic memory.

I won't create any logic, just database tags......

After creating a SINT - 4,146,840 = 88 bytes used
After creating an INT - 4,146,756 = 84 bytes used
After creating a DINT - 4,146,668 = 88 bytes used

Not sure why the INT only consumes 84, but the SINT and the DINT both use the same amount, for a quarter the size of the physical data.

This is one reason why UDTs are so useful. Packing your data into UDT structures can reduce the amount of memory used considerably, although this isn't too much of an issue these days with MegaBytes to play with.

In a UDT, consecutive BOOL members are "packed" into one (or more, if you have more than 32 BOOL memebrs) memory word.

Consecutive SINTs are "packed", and so are INTs.

That is why, when creating UDTs, most efficiency is gained by creating the members in size order, either ascending or descending, it doesn't make any difference.

An example....

A UDT with three BOOLs, two INTs, two DINTS, and a Timer, created in this order....

bool1
int1
timer
dint1
bool2
int2
dint2
bool3

has a "size" of 32 bytes

re-ordering them in size order

bool1
bool2
bool3
int1
int2
dint1
dint2
timer

has a size of 28 bytes, 4 bytes less.

It might not sound a lot, but that saving is amplified the larger the data-type, and if you are creating large arrays of UDT tags, that extra saving can be dramatic.
 
There's not a thanks button, but much appreciated for that detailed response!

I've actually spent some time reading up on it since. Makes sense now.
 

Similar Topics

I am trying to add a device to my RSLogix 5000 program. The device is a Eaton PowerXL DG1 I downloaded the eds file from the website (it...
Replies
5
Views
1,734
Im trying to sum a running "Shift Total" production value and move it into a Month Total value that will continuously update for viewing...
Replies
1
Views
1,517
I am trying to add a generic Ethernet module to RSLogix and keep getting an invalid size error. There are no inputs, only outputs. I am using...
Replies
6
Views
5,485
I would like some guidance or a way to add SCL or SCP instructions to my Add-On I am using RS-Logix 5000
Replies
3
Views
2,029
Hello, I'm new to the PLC world. We are adding a Keyence cv-x152f to one of our lines. We want to talk over ethernet/ip. I see how to add the...
Replies
7
Views
5,688
Back
Top Bottom