Assigning INT values with ladder logic

Join Date
Nov 2013
Location
Sacramento
Posts
8
Hello,

I have a new downtime reporting system at work that connects to the PLC and monitors downtime. The reporting system works by reading a INT value inside the PLC and determining the downtime reason that way. For example 0 is off, 1 is running, 3 is starved for product, 4 is blocked downstream, 5 is break/lunch, etc. The ladder logic assigns the value of the INT tag.

I cannot figure out how to assign values with the ladder logic. I know the logic; for example if the machine is on but there is no product at the infeed sensor then the downtime state is "starved" and therefore I want to assign the INT value for the downtime reason to "3." If the machine is on and there is product at the entrance sensor then I want to change the downtime reason to "running" or an INT value of "1."

I'm using RSLogix 5000 on a brand new CompactLogix PLC. So it has the latest and greatest addressing scheme.

I scoured the internet for an answer and am totally defeated. I'm begging for mercy. Please share your knowledge.
 
Just an additional note the MOV cmd needs to be turned off or it will keep the last value.
Sorry if I am telling you to suck eggs

Welcome to the site by the way
 
Hello,

I have a new downtime reporting system at work that connects to the PLC and monitors downtime. The reporting system works by reading a INT value inside the PLC and determining the downtime reason that way. For example 0 is off, 1 is running, 3 is starved for product, 4 is blocked downstream, 5 is break/lunch, etc. The ladder logic assigns the value of the INT tag.

I cannot figure out how to assign values with the ladder logic. I know the logic; for example if the machine is on but there is no product at the infeed sensor then the downtime state is "starved" and therefore I want to assign the INT value for the downtime reason to "3." If the machine is on and there is product at the entrance sensor then I want to change the downtime reason to "running" or an INT value of "1."

I'm using RSLogix 5000 on a brand new CompactLogix PLC. So it has the latest and greatest addressing scheme.

I scoured the internet for an answer and am totally defeated. I'm begging for mercy. Please share your knowledge.

However you determine your plant status, you'll want to set you INT tags to values that represent your process's "status".

You can do yourself, and everyone who reads your code later, a big favour by creating a User-Defined Data-Type (UDT for short), containing named INT members that reflect the statuses you want to convey to your reporting system.

Once you've created your UDT, you can create a tag from it (make it a constant so no-one can play about with it), set the values for the named status's in the tag, and then when you want to set a status, your MOV instructions will look something like these....

MOV Status.Starved ReportINT
MOV Status.Off ReportINT

In this case, the UDT tag is called Status, and I'm moving the constant values I have set for "Starved" (3), and "Off" (0) to the report integer.

Who needs documentation when the tagnames themselves convey the meaning...?

All you need to do is ensure that only one MOV instruction is "active" ay any one time, or you can use One-Shot (ONS) instructions to make them fire only once when each condition becomes true.
 
although the MOV instruction is preferred, you could also use a COP instruction, just be aware that they have their differences, the COP instruction copies bit by bit. Another aspect to be aware of the MOV instruction is that it also automatically converts data types for you if the source and destinations are of different data types. For example if your moving a Real Source value of 15.45 to a destination DINT tag, once the MOV executes the value in the DINT tag will be 16 rounded to the next number. If you used a copy instruction instead your DINT tag will contain a totally different value. Experiment and play with them.

EDIT*** But from a general standpoint a COP instruction is used to copy elements from one array to another, for your application the MOV instruction would work best
 
Last edited:
.........For example if your moving a Real Source value of 15.45 to a destination DINT tag, once the MOV executes the value in the DINT tag will be 16 rounded to the next number......

15.45 will be rounded to 15, not 16

FYI...

15.5 will be rounded to 16

and

16.5 will also be rounded to 16

No prizes for knowing why, but if you want an explanation, just ask...:)
 
@ daba you are right, typo on my end, i agree that 15.45 will read 15 and that 15.5 will read 16, now based on that one would think 16.5 will be rounded to 17 so why is that rounded to 16??
 
Note that the "Round-to-Even" method was adopted for Logix5000 systems.

Earlier platforms, e.g. Logix500 and Logix5 used the more "traditional" xx.5 rounds up to the next highest integer.

This actually did cause an issue with some maths that was converted from a PLC5 system to ControlLogix, and it had to be re-written.
 
The MOV instruction

Take a look at the attached screen shot. Each rung has a different conditional input. If rung 1 is true the value of the INT is 1, if rung 2 is true the value of the INT is 2 and so on. In other words use several MOV instructions that reference the same INT variable. The MOV instructions should have different conditional logic.

You can also check out this link for more help:

Instuctions

Mov.PNG
 
but say you want your int value to be a random number assigned by the user via keypad. e.g. the user wants the int to be 99 randomly, so he will press 9 twice on a keypad and then enter the number. How would this be possible? the screenshot you have is how I have coded, but one cannot enter double digit numbers unless i assign the numbers a key. would simple and/or operations solve this?

I believe if i had the Rs logix 500 i would be able to use compute for a simple solution, but with the free software compute is not available
 

Similar Topics

I can't seem to figure out how to add descriptors to I/O points on an RMC using PCCU. Say, for example, I want to use "Valve_1" as a descriptor...
Replies
0
Views
60
Hello all. A little ashamed of myself that I can't remember how to do this but..... I have a 1734-AENT that I set the wheels to "888" applied...
Replies
9
Views
3,816
Hey everyone I'm working on a PLC project for a series of 4 vacuum pumps. I need to be able to rotate each pump into a different priority based on...
Replies
18
Views
6,445
Hi all, I am in the throes of commissioning a single S7-1517 cpu and I'm utilising both ethernet ports, X1 and X2, with individual IP addresses...
Replies
2
Views
1,678
With FactoryTalk ME is it possible to use a single Trend object and list of pens being displayed using macros? Would like to have one Trend object...
Replies
2
Views
1,739
Back
Top Bottom