Every PLC support a JUMP to back?

J. M.

Guest
J
Hi,

Using the Instruction List language:
i. can i use a JUMP instruction to a previous label?
ii. always?
iii. is this a standard feature?


If i need reexecute the PLC program twice, how can i do that?
(INPUT - EXECUTE - EXECUTE - OUTPUT)



I don´t have any kind of PLC, but i need write a program in IL using this features...

Many thanks!

João
 
J. M. said:
Hi,

Using the Instruction List language:
i. can i use a JUMP instruction to a previous label?
ii. always?
iii. is this a standard feature?
4.
If i need reexecute the PLC program twice, how can i do that?
(INPUT - EXECUTE - EXECUTE - OUTPUT)

i. usually no, it is not good idea for any programming languages including pc-languages
iii. some for-next loops work like that, but not backward jumps what I know.
4. debends of PLC-type it is possible use sub-routines that could call as many time as needed in one program scan..
 
Backward jumps and double PLC scans

My first reaction to your post is Why?
I'm sure that with a little work you can get it done, but it seems to me that you re going against some basic rules of PLC programming here.
A PLC is geared for optimal scan time; it reads inputs, processes logic, writes to ouputs, maintains comms and does housekeeping before re-initializing its scan cycle; all this in the shortest time possible. Anything tht slows this scan cycle is to be avoided if you want to maintain adequate control of the process.
So: a jump in ST usually goes to a downstream label, because you do not want the logic to be read any other way than linearly and once per request (call) in the main program. And program logic is normally executed once per scan only so the cycle is as short as can be.
Specific mechanisms are used to modify scan cycles for specific purposes (interrupts, conditionnal sub-routines)so you have some impact on the execution of the program. But I do not recommend introducing programming techniques that defeat the original purpose of the controller.
Hope this helps,
Daniel Chartier
 
Daniel's answer is good explanation why not. Daniel's explanation behove for PC-programming as well.
If you tell what for you like use it, so someone can try explain how you can avoid it.
 
Tanks,
but...

I agree with yours opinions in general.

I need, yes, I need, reexecute the program after the PLC read the inputs and before the outputs are issue.

I'm doing a Post-processing of a IL-program.

João
 
Joao M. said:

I need, yes, I need, reexecute the program after the PLC read the inputs and before the outputs are issue.
Basically PLC works as follow:
PLC copyes physical Inputs to PLS's process image they are called inputs. Next PLC executes program one time and make process image for the outputs and finally PLC copy outputs process-image to physical outputs. After that everything repeated 'until world have end'.
 
Seppo's last post reminded me that Terry (remember him?) wrote an excellent story about how a PLC scan works. It took a bit of searching, but I finally found it.

Click HERE and start reading... 📚

beerchug

-Eric
 
The technical name for this is "Recursion" and as several people have pointed out already, it is a very dangerous programming tool. The principal reason is that all (with no exceptions that I am aware of) PLCs have a 'watchdog timer' whose primary purpose is to make sure that the PLC either completes a program scan or faults at the end of the watchdog time. A recursive program does not allow the program scan to complete until all recursions have been completed, running the risk of the watchdog timing out and faulting the processor.
Having said this, yes, it is possible to jump to a previous point in the program and repeat it without going through the I/O scan but you must be sure that your error handling allows the program to fall through to the end before the end of the watchdog time. Hope this explains to your satisfaction.
 
This is not recursion!

controlsguy3 said:
The technical name for this is "Recursion" and as several people have pointed out already, it is a very dangerous programming tool.

Recursion is when a subroutine CALLS itself either directly or indirectly. There has been no mention of that in these threads.

Joao, if you want to execute code twice then put it in a subroutine and call the subroutine twice from the main loop.
 
Eric Nelson said:
Seppo's last post reminded me that Terry (remember him?) wrote an excellent story about how a PLC scan works. It took a bit of searching, but I finally found it.

Click HERE and start reading... 📚

beerchug

-Eric
Thanks Eric, I red Terry's excellent article in Aug 2002. I found this forum in Jan 2003 and thats why I didn't know that.
Actually I don't know what for J. M. likes to do it twice ?
 
Hi,

I need a little more than reexecute the program and i know the danger os JUMP backward.

I d'ont want call a function 1, 2,.. times!

But my question is: We can always JUMP bckward? Is a it a standard feature of any king of PLC?
(I'm sorry but I live in the PC-world!)


It is possible disable the PLC scan of the inputs? and the outputs?

About the watchdog timer:
- It is programmed by PLC operating system, right?
(time = PLC scan time + user program time + max. delay ?)
- We can access to this timer?

Thanks
João
 
Even though jumping BACK is generally not recommended, it is indeed possible. Maybe not in all PLC's, but at least in AB and Siemens.

Another possibility is to use a FOR-NEXT loop. AB PLC5 has this feature (but not the SLC500). Siemens S7 also has a similar method, but it is not as straightforward.

A FOR-NEXT loop has the advantage over a JUMP instruction, that the loop cannot continue forever because there must be an increment variable that increments forward for every pass of the loop. The loop continues until the variable achieves a set final value.
 

Similar Topics

I need to change my program to increase a IP transducer by 0.5 psi every 5 seconds. I am making a automated pressure tester using a pump, IP...
Replies
6
Views
1,038
I added several topics to an RSLinx Classic Professional (3.70) installation and was unable to add tags from the topics to Historian SE in...
Replies
1
Views
1,782
Hello. I'm pretty new to PLC things, come from a C etc. programming background. Found this nice thread here...
Replies
26
Views
11,925
Is there a way to use the FAL instruction to do +=2 instead of +=1? I have an array that is organized with alternating "data" and "flag" values...
Replies
5
Views
123
Back
Top Bottom