2 Programs on 1 PLC

Jezz

Member
Join Date
Dec 2002
Location
Kendal
Posts
399
Hi Does anyone know if you can boot a recovery program from epromm on a SLC 5/02 and then once recoverd boot back to the original program???

Thanks Jezz :(
 
Eeprom

I don't beleive it's possible. PLC memory is an all-or-nothing game. If the PLC loads from an eeprom, it replaces the program with that of the eeprom, without leaving a trace of the old program. The old program will simply cease to exist, unless you download it again.

But what is your definition of a "recovery program"? It's possible to set up the SLC to run a "Fault Routine". This is a special ladder file that you program to do whatever you feel is necessary when a fault occurs (clear specific registers, sometimes even clearing the PLC fault itself (See RSLogix help files under "Recoverable Errors" and "Error Codes".) Just enter the ladder file of the "recovery code" in S:29.

You can also make "Power Up" a "fault condition" by setting S:1/9. From the RSLogix help:

Startup Protection Fault S:1/9

When this bit is set and power is cycled while the controller is in the REM Run mode, the controller executes the user fault routine prior to the execution of the first scan of your program.

RSLogix 500 - Copyright Rockwell Software 2000
.

This will be all one program, that your EEPROM would have. You would then one or more of the bits on the Memory Module tab in RSLogix to load the whole program from the EEPROM.
 
I am not sure what you are recovering from, BUT, try writing a file that is activated at power up (first scan) to reset all bits and outputs to correct settings. Then jump to main programming.

David :)
 
Thanks for the replies what I was trying to do was run a machine backwards and to save a bit of programming (disabling all the forward program) I was wondering if I could run 2 programs but hey ho I'm just going to have to mod all that code :eek: .

Thanks Jezz
 
Jezz

In that case yes you can but not exactly the way you explained it.

I think what you really want to do is have two files on the same PLC, have one file for forward run and one file for reverse run. Jump the file you don't want to run. That is my opinion of how to accomplish what I preceive you are wanting to do. If not, I am sure I'll get hammered but none the less you will get the answer here.(Allen-Bradley)

Good luck
Roger :rolleyes:
 
Last edited:
Double-coiling

I'm not a big fan of double-coiling (driving the same output from two different rungs), even if you can get away with it by having the two coils in seperate subroutines and only enabling one routine at a time. It sounds, Roger, like this is what you are advocating.

It confuses the heck out of anyone trying to troubleshoot it (often even the author) because it's too easy to accidentally wind up in the wrong subroutine when searching for where this bit or that bit is used.

I'm a big propenent of seperating the sequences from the actions, and this is a good example of why.

When you "run the machine backwards", you can't just go from step 5 to step 4 to step 3. The transition conditions that take you from step 4 to 5 are very likely different from those that would take you from step 5 to step 4.

"Running the machine backwards" is a whole different sequence from "running the maching forwards", and deserves it's own seperate subroutine (just to segregate the code). But it shares resources with the "forwards" routine.

It's a lot better to share outputs using a branch ('OR') one a single rung than to have two (hopefully) mutually-exclusive rungs.
 
Thanks for the replies what I was trying to do was run a machine backwards and to save a bit of programming (disabling all the forward program) I was wondering if I could run 2 programs but hey ho I'm just going to have to mod all that code

I am still not positive exactly what you want to do BUT it looks to me like you want to make the machine operate 2 different ways from the same PLC.
YES
That can be done..others will explain better than I but you basically write 2 ladders...one for forward and another for backward, you could use a selector switch or anything to change from using one ladder to another. The Main Ladder would just have a line of code to enable one of the 2 ladders dependng on condition...Selctor switch on Forward enables JMP to Forward Ladder (Ladder 3 maybe).
Hope I explained this correctly.

I see Allen doesnt care for this method so ignore it, just a thought, actually something I have done but then I am not really a programmer.
 
Last edited:
Allen misunderstood what I was trying to convey, I hope you don't as well. I assumed that you have a program written that runs a machine in the forward direction as well as the reverse direction and you wanted to disable the forward direction and only run the machine in the reverse direction. If that were the case then it would serve you well to have the program in two different files so you could disable either direction at will in the future. I am not even sure what type of process we are talking about here, so all I can do is suggest and if you deem it fits your needs, then do it. I don't see how Allen came up with me advocating the use of double instructions but to set the record straight I do not advocate double use of instructions either, too many other viable options.

Roger
 
Last edited:
Don't know if this will help in your situation, but I've actually had to make parts of a machine run in reverse order. A shift register controls all the sequences in the manufacturing of the parts. I used bit shift left as my forward and bit shift right as my reverse.
I won't go to far with this because it may be of no help to you.
Good Luck
Tim
 
AN

I don't see anything different in this statement than what Rsdoran and I were suggesting. A subroutine of its own.
please clarify.

(Quote:)
"Running the machine backwards" is a whole different sequence from "running the maching forwards", and deserves it's own seperate subroutine (just to segregate the code). But it shares resources with the "forwards" routine."

Roger
 
Somewhere, somehow I thought it was kind of a standard procedure to use Lad2 as a Main then JMP to Lad3 or 4 etc...ie subroutines that offer the option of being enabled by the code in Lad2 (Main).

Is this an incorrect procedure, if so why do I see it so much?

I know this is nothing unusual but "I am confused again".
 
I'm doing a lot of "reading between the lines" with Jezz' state of affairs.

It sounds like he's already writen the code to make the machine run forwards, and has run into a problem when the PLC looses power. The machine (I picture a pick-and-place, just for reference) is somewhere in the middle, and he wants to "run it backwards" to go to the start position.

He was hoping that he could solve this problem by having a seperate program in the EEPROM to home the machine, and which would self-destruct, bringing up the original code when it was done.

In that completed code, he already has logic to drive every output that his PLC has.

So your telling him to add a subroutine to program the "run backwards" logic and disabling the "run forward" logic might be interpreted as advocating using coils to drive outputs that exist somewhere in the disabled code - i.e., double coiling.

What I advocate (as a first principle) is for Jezz to have (at a minimum) THREE routines.

One is the "run forward sequence". One is the "run backwards sequence". The third is the "Output control routine".

With this model, it's easy to disable the forward logic, run the backwards logic, and avoid double coiling.

If he only has two routines (with each including the output coils), then it will work, but double coiling will be required.



Ron:

Yes, having a LAD 2 that contains nothing but JSRs is common, popular, and can lead to good code. Unfortunately, putting the entire program in LAD 2 is also common practice (I'm talking about programs over 100 rungs, of course. It might not make sense to divide up short programs).
 
Last edited:
Oh geez I have seen 5000 rungs of code in LAD2...I take anything that is broken into multiple LAD files...as long as it makes sense.

PLEASE divide and conquer.

BTW I said JMP didnt I, when it should have been JSR..what a duh.
 
Good point Allen. (At least three routines.)

Ron, I too sometimes interchange jump with JSR, lazy I guess.

When I attended robotics school there were a few items destroyed when the HOME button was pressed. Ahhhhhh....the good old days.

Roger
 
Last edited:

Similar Topics

Hey guys, I've a requirement that a two different PLC program should work in same system depending upon user input. Consider Program A is used...
Replies
11
Views
1,894
Scenario: 1. An employer has a machine that isn't up to code/standards: hydrogen gas torch systems without safety shutoff valves, industrial...
Replies
54
Views
8,914
Hi all, Searching the site, this is the newest/closest to my question thread I found on safety PLCs, editing the safety task, etc...
Replies
10
Views
3,887
is there a way to open a compact logix plc program and then compare that to the program that is actually running in the plc Thanks
Replies
1
Views
1,067
Hi there, I am new to PLC as I am studying it in my Mechatronic college course. I came across this question that I can't get my head around to...
Replies
2
Views
2,249
Back
Top Bottom