MATH Instructions Questions

jaywillnot

Lifetime Supporting Member
Join Date
Apr 2015
Location
Alabama
Posts
69
Hey guys, I have recently started playing with MOV and ADD instructions using the LogixPro simulator. Needless to say, I have come up with some pretty neat light configurations but I'm not exactly sure what's happening during the scan cycle.
I am not attempting to write any specific program, I am only trying to learn what is taking place with the current instructions I've got plugged in.
Can someone help decipher it? Thank you

LadderRungs_Instructions.jpg
 
What do YOU think it's doing?

And why (in the second rung) do you have a contact that references T4:0 but not a T4:0 bit (like .DN, .EN, .TT).

And what is S4/7 doing in rung 003?

Have you accepted edits? Do you have any errors.
 
It looks like you've added instructions at random. THAT'S NOT HOW IT'S DONE.

1. Read the descriptions of ALL the instructions which also contain examples of usage.

2. Analyse your application. When just starting your first application can be as simple as 'one input controls one output'

3. Write this, download to the target PLC and analyse the operation.

4. Repeat from 2 but with a slightly more involved application. Maybe add a timer.
 
This has error definitely, jaywillnot, use the data type that is allowed in MOV / ADD function. And output bit should have a bit logic. You used Binary data type at a bit level in a EQU function, should be on a word level if you need it, B3:0.
 
From what I have noticed while watching the program run is O:2/0 through O:2/6 seem to be counting up by binary increments. I obviously forgot to give the timer on rung 002 a DN bit to activate the output. As for Rung 003, I'm using S:4/7 as a flasher for some of O:4 lights.
Basically, I am experimenting and trying to figure out what the MOV and Math instructions actually do, but more so, how to use them.

I am not a programmer, not even a beginner programmer. I just thought someone may be able to explain the uses and structure of these special instructions. I guess I should have just asked the obvious question....
 
It will take some time for me to learn, understand, and apply logic. Thank you all for your great responses!
 
I am not attempting to write any specific program, I am only trying to learn what is taking place with the current instructions I've got plugged in.

Can someone help decipher it? Thank you
Yes, I can help you.

First, you have several logic errors, resulting in some rungs doing nothing much. Rung 003 does nothing, because Bit B3:0/3 cannot be added to Word T4:0.ACC. (This would give you an error in the real RSLogix 500 program). Because the ADD does nothing, you would have the same effect if you simply MOVed T4:0.CC to Output Word O:8 (not bit O:4/8 which again causes an error in RSLogix). Anyway, the binary bits in Outputs O:4/0 to O:4/4 go on/off in descending order as decimal values from T4:0.ACC go from 0 to 15.

Rung 004: This rung moves binary bits from C5:0.ACC to Output Word O:2 (not O:2/0 which would result in an error in RSLogix). As the counter in Rung 002 counts from 0 to 15, the binary bit pattern of each decimal value gets moved to O:2, so those outputs from O:2/0 up to O:2/3 flash on/off.

Rung 005 resets the Counter, but this could be done easier with a simple XIC C5:0/DN instead of the EQU comparison.

Rung 6 can be deleted because it does nothing. You cannot compare a bit (B3:0/1) to a word value (2). Outputs O:6/0 to O:6/9 never go on or off.
 
It will take some time for me to learn, understand, and apply logic. Thank you all for your great responses!
If you want some more flashing lights that look random similar to the blinking lights on the Starship Enterprise, but really are not truly random, just a large number of repeating 16-bit patterns, then try this 8-rung LogixPro program.

It first generates 98 pseudo-random numbers (no repeating numbers allowed but the numbers will range in order from small to large), moves those to a sequencer, then starts the sequencer. The sequencer Output N7:1 is moved to word O:2 so that all 16 bits will flash at some point. Also the random Word N7:1 is subtracted from 65535 and moved to O:4, creating a second set of "inverse" flashing lights.
 
Last edited:
Hmm, interesting, I didn't know LogixPro would let you do things that Logix500 will not :)

Lancie has summed it up pretty well. To add to his info (not that it needs it!) - I'm not sure if LogixPro has the same help files as Logix500, but if it does (or if you have access to Logix500) then just drop in an instruction, click on it and press F1. The help files are very good and usually have examples of how the instruction is executed and what it does to the data in each case.
 
Speaking for those who are still learning like myself. I recommend you buy or obtain a book or program and start following it. You need structured lessons with specific learning progressions. ALWAYS begin writing your program with the end in mind first!! As a matter of fact that is how you must always approach this kind of work. Its not for the wandering or necessarily creative mind, at least in the real world at most levels. Most of the time your elbow deep into someone elses program, trying to figure out why they didn't follow a more logical process with their programming.
 
I'm not sure if LogixPro has the same help files as Logix500,
Unbelievably, LogixPro has a copy of the exact same Help file as RSLogix 500, through a permission that Bill Simpson got from Allen Bradley years ago.

LogixPro only has the basic RSLogix instructions (the more advanced instructions are missing from LogixPro even though the Help file has all of the RSLogix instructions), but LogixPro will let you put outputs in a series daisy-chain to your heart's content (not that I have ever had any need to do that).
 
Lancie1 said:
Unbelievably, LogixPro has a copy of the exact same Help file as RSLogix 500, through a permission that Bill Simpson got from Allen Bradley years ago.

Impressive. I'm gonna bet that that sort of thing will never happen again ;)
 
Wow! Thank you for the help Lancie! I bought some of the books that Phil Melore made on understanding PLCs. The books are quite helpful.
iadapt is right about what he said about wanting to know the end result before writing a program.
Thank you all so much for your help...you guys rock!!!!!!! \m/ \m/
 

Similar Topics

Can anybody explain me how to type the following formula in a CPT block in Controllogix. The formula is the following 10^[((0.6*UA)/1000)-3] where...
Replies
2
Views
1,177
How would one come up with an average flow from the live GPM from the flow meter? I have the SCP set up and can watch the live GPM but I have...
Replies
15
Views
4,208
Hello Guys,Any one please tell me how to scale an analog sensor which is 0-10v and it has to be scaled to 0-8v or something using math...
Replies
7
Views
3,697
Okay I have read my book and my instructor hasn't addressed this issue as of yet. I am working on rslogix 500 and I was wonder if anyone would...
Replies
3
Views
2,870
I have an expression in a structured text routine of a Logix controller that looks more or less like the following: ResultInteger := Integer1 *...
Replies
13
Views
422
Back
Top Bottom