Plc5 scanning

yasirkhi

Member
Join Date
Oct 2011
Location
Toronto
Posts
136
Hi There,

May be this is a duplicate question. But I am stuck, understanding a PLC5/60 program. In LAD3 in the last rung JMP instruction is used which is looping again and again. And it seems no way out to move to LAD4 scanning.

Is there any difference between scan cycle between SLC5/05 and PLC5/60?
 
Last edited:
Thanks Mickey.
I checked the program MCP. Only LAD2 is used.

I found that LAD3 "TND" instruction is used which means processor suspend the scanning. RET is not used because there are 7 JSR used in LAD3 already.
 
In LAD3 in the last rung JMP instruction is used which is looping again and again. And it seems no way out to move to LAD4 scanning.
It sounds like that you expect the "scan" to move from Lad3 to Lad4. Remember that Jump to Label (JMP) and Jump to Subroutine (JSR) instructions are used where you DO NOT want the scan to follow its normal route of going to the next line, but instead to either jump backwards (maybe back to the Main Lad 2), or skipping forward to Lad 5 or Lad 6.
RET is not used because there are 7 JSR used in LAD3 already.
Most of the time, the RET is left off, because the automatic END at the end of a subroutine serves the same function.

JSR [Jump to Subroutine]
Rockwell Software

Description
When rung conditions are true for this output instruction, it causes the processor to jump to the targeted subroutine file. You can only jump to the first instruction in a subroutine. Each subroutine must have a unique file number (decimal, 3-255).

Do not program a JSR in nested output branches with the Fixed or SLC 5/01 controllers.

Nesting subroutines let you direct program flow from the main program to a subroutine and then on to another subroutine. The following rules apply when nesting subroutines:

Fixed and 5/01 processors - you can nest subroutines up to 4 levels.

5/02, 5/03, 5/04, 5/05 and MicroLogix processors - you can nest subroutines up to 8 levels.

If you are using an STI subroutine, I/O event-driven interrupt subroutine, or user fault routine, you can nest subroutines up to 3 levels from each subroutine. With MicroLogix 1000 processors you can nest subroutines up to 3 levels from the HSC Interrupt subroutine.

I found that LAD3 "TND" instruction is used which means processor suspend the scanning.
Not exactly. It only stops scanning the current file, then resumes at Rung 0 of the Main Lad 2 file.
When the logic preceding this output instruction is true, TND stops the processor from scanning the rest of the program file, updates the I/O, and resumes scanning at rung 0 of the main program (File 2).
Rockwell Software
 
Last edited:
Did you miss LAD2 rungs 374 through 386? Those are all JSR's except for 380.

The last rung in LAD3 isn't "Looping and Looping". It is odd program flow, but it goes to the (previously JMPed over) LAD3 rung 1, which ends with a TND at rung 75.
 
If TND comes it cancels the current routine scanning and start over to LAD2 "0" rung or continue further downward scanning from LAD2 with JSR instructions?

One more question here. If one complete scan of whole program is not done, and in one routine "ONS" rung scanned 100 times due to loop, would ONS will pulse 100 times?

Thanks
 
Last edited:
TND ends the current routine, sort of an automatic jump to the end rung of the routine.

A ONS will only have a single scan pulse unless the input to it transitions.

In essence, the ONS memory location is a storage location to reflect the state of the logic before the ONS. The only time it will have an output is if the conditional logic transitions to a true, while the ONS storage location is false. The next scan of the ONS instruction, the input is true, and the ONS is true, so the output is false again, and remains so till the ONS is reset by a false input.
 
If TND comes it cancels the current routine scanning and start over to LAD2 "0" rung or continue further downward scanning from LAD2 with JSR instructions?
Sorry, I may have confused you. I forgot that you are using RSLogix 5. There is a big difference in the TND instruction between RSLogix 5 and RSLogix 500. The TND for RSL 5 does not jump to Rung 0 Lad 2, but simply halts everything - a Temporary End function.
TND - Temporary End
© Rockwell Software Inc.
Description
This instruction stops the processor from scanning the program any further when its rung goes true. Use in conjunction with an input instruction on the same rung for step-by-step program testing.
 
Thanks Lancie.
There are several routines under the LAD3 that are scanned.

You meant to say TND is temporary end the program/routine, and considered the current routine scanning done.
 
In essence, the ONS memory location is a storage location to reflect the state of the logic before the ONS. The only time it will have an output is if the conditional logic transitions to a true, while the ONS storage location is false. The next scan of the ONS instruction, the input is true, and the ONS is true, so the output is false again, and remains so till the ONS is reset by a false input.

Thanks. Sorry little confusing. If LAD 3 used ONS with conditional logic and there are 100 times loops cause the ONS scanned 100 times but whole program is not scanned yet. And input condition goes to false and true and true to false several times. How the output will react?
 

Similar Topics

I am using the following formula and I am getting error, Invalid Expression - too many closing parenthesis. when i copy the formula to notepad or...
Replies
4
Views
152
Preface: Kinda long, so I made section titles Intro: I just want to see if anyone here has seen anything similar. A PLC5-40 series C enhanced...
Replies
3
Views
365
Hi, can anyone help me get a pdf file for this RSP files. They are from a PLC5. Thanks
Replies
5
Views
516
Hello all, I am seeing this behaviour where an integer file (N46:33), has an integer in binary (11110) which is 30 in decimal. I did a...
Replies
7
Views
515
Back
Top Bottom