PLC Rung Scanning

ControlLogix

Member
Join Date
Feb 2003
Location
Southern Ireland
Posts
62
Hi folks,

I am having a little trouble with a rung of code which appears at the bottom of the msg (Sorry, don't know how to paste it in here :( ). The tag called TmpInt is used to called a program within an Emerson servo drive. There is an offset of 4 within the Emerson setup so to call program 1, a value of 5 has to be actually sent to the Emerson. Therefore TmpInt will contain a value of 1, 4 is added to it and Emerson1.Seq.Function2 is latched.

Now TmpInt is calcualted via the 1st instruction (the CPT). Now all values for TmpInt will be in the range of -1 to 10...I know that for a fact since I worked through all possible values for all the variables. Now to my problem....

If I have a value of 1 in TmpInt after I do my CPT instruction, the LIM instruction will be true and therefore move a value of 9 into TmpInt. That now means however that program 13 will always be called regardless of the value of the calculated TmpInt...which should in theory call program 5 in my Emerson drive. Am I correct in what I am saying or is TmpInt recalulated prior to the Add instruction?

Any feedback on this would be much appreciated.

Regards,

A boggled mind!!

CPT(TmpInt,LowRamLevel-RamLowLimit)[LIM(10,TmpInt,-1)MOV(9,TmpInt)MOV(InsertionMgr.RamHighLimit,InsertionMgr.LowRamLevel),ADD(TmpInt,4,Emerson1.ProgNum)OTL(Emerson1.Seq.Function.2)];
 
LIM fun and games

Look again at your LIM instruction. I'll draw out the rung here:



+--------- LIM ---+ +-------- MOV ---+
---| LOW LIM: 10 |----| SOURCE: 9 |
| TEST: TmpInt | | DEST: TmpInt |
| HIGH LIM: -1 | +----------------+
+-----------------+


`
What this code is saying is that if TmpInt is OUT OF RANGE of -1 to 10, move a 9 into it.

Notice that the HIGH value is -1 and the LOW value is 10. Normally you put the smaller number (-1) in the Low and the larger number (10) in the High. When you do it this way, it reverses the logic of the LIM instruction. The LIM solves TRUE if Test is GREATER than 10. It also solves TRUE if Test is LESS than -1. But because High is less than Low, it solves TRUE when you have only one condtion, not both.

It's a dirty trick, but very useful.
 
Last edited:
Allen,

Thanks for your reply. I knew that I was starring too long at the code to see an answer. A fresh pair of eyes made all the difference.

Thanks for your input,

Rgds,

A Crystal Clear Mind
 

Similar Topics

I have often seen statements that arranging rungs so that the condition most likely to make the whole rung TRUE (or FALSE) should be placed to be...
Replies
29
Views
8,468
I added a rung comment then which is associated to an OTE. I moved the comment to a different rung but the yellow "highlite" is still where the...
Replies
4
Views
1,953
Recently had an issue that I tracked down to a frozen rung of logic. The PLC is an AB PLC5/40E. the rung of logic is simple. (I hope the text...
Replies
4
Views
3,622
Not Sure why I can't implement this piece of PLC-5 logic in a Micrologix 1100 !!!!!! In Micrologix 1100, S:42 = RTC Seconds Register. I...
Replies
31
Views
26,150
Hello, I have an automation direct d2 262 plc and C-more HMI EA9T6CL-R. I need to prepare a program, scheduled to be performed on a future date. I...
Replies
1
Views
27
Back
Top Bottom