SQC's, SQO's, and timers

robertmee said:
A common culprit is illegal MATH operations. Make sure you don't have any possible DIV by zero cases or multiplication overflows. To guard against DIV by zero, precede your DIV (or CPT) box with a NEQ 0 on the denominator address. It is also common to include a line of ladder at the end of your program to reset the Overflow trap bit which faults the processor.

Just a simple OTU S:5/0

If you follow Robert's advice, think of it as a "force". You are forcing off a fault that is trying to report a programming error which could result in death destruction and loss of multiple paychecks.

It is my recommendation that you make a copy of the overflow or any other error bits before releasing them.

Code:
s2:5/0 B3/666 |
-] [----+----(L)----+
| s2:5/0 |
+----(U)----+
 
True...Although a processor screeching to an uncontrolled halt due to a fault can mean the same losses. That's why I like the fault routine capabilities of the CLX line of processors. You can emulate the same expanding upon Paul's suggestion. At the end of your ladder, latch the bit and unlatch the status bit. Then, following that line, call a JSR based on that bit being true that gracefully puts your process into a hold condition until the fault is identified/rectified.

Along those lines, Paul, does the SLC have a status word for the Rung #/File # that the fault occurred? I know PLC5 and CLX do, but I've never had luck finding an equivalent in SLC.
 
robertmee said:
A common culprit is illegal MATH operations. Make sure you don't have any possible DIV by zero cases or multiplication overflows. To guard against DIV by zero, precede your DIV (or CPT) box with a NEQ 0 on the denominator address. It is also common to include a line of ladder at the end of your program to reset the Overflow trap bit which faults the processor.

Just a simple OTU S:5/0

If you follow my experienced colleague Robert's advice, think of it as a "force". You are forcing off a fault that is trying to report a programming error which could result in death destruction and loss of multiple paychecks.

In a real world situation, take those faults very seriously. Your machine is down, and the pressure is on to get her up and flowing again, but take a few seconds before clicking the "Clear Error" button and do a "Go To Error".

Make a quick note of the fault code it shows you, and the rung and file number. An illegal indirect address instruction should leave behind that information for you to quickly analyze.

Then, (remember only ten-fiteen seconds have gone by):
Take a long moment to ensure your self that just clearing the fault and turning the machine back is the right thing to do. Most often, you want to fix the error first.

I have been fortunate in that my fault clearing career has been littered with relatively minor machine damage but never an injury.

For errors that "aren't gonna hurt anything": It is my recommendation that you make a copy of the overflow or any other error bits before releasing them. Do this by examining the error bit, when it contains a 1, latch (OTL) a user memory bit, then branch once and unlatch (OTU) the error bit. I will agree with Robert that this is common practice in situations where interim math my cause an overflow, but the result is later clamped or otherwise corrected. Simply adding an OTU rung is often more efficient than the logic required to avoid the math error.

If you are in class, working on an emulator, etc, then just use Robert's rung, and be sure to remove it before you install it in a running machine where safety's a concern.

Oh yeah, in case you haven't fixed the runtime bug yet, always put one of these in front of indexed addresses ...

LIM
Low: 0
Source Step_number
High: 32

Good chance that the program has an invalid indirect address.

Our student most likely allowed the download to change his file sizes when he downloaded his communication away earlier.

Always read and understand the implications of those warnings...

I can't think of a time when I wanted my data tables automatically resized...

See, David, you are learning so much more than sequencers, huh?

"Every stumble strengthens the knees."
 
Last edited:
robertmee said:
Along those lines, Paul, does the SLC have a status word for the Rung #/File # that the fault occurred? I know PLC5 and CLX do, but I've never had luck finding an equivalent in SLC.

Oops there I go criss-crossing platforms again... I don't have good access to check from home, but I think you are right, Robert.

Thanks,
Paul
 
robertmee said:
Along those lines, Paul, does the SLC have a status word for the Rung #/File # that the fault occurred? I know PLC5 and CLX do, but I've never had luck finding an equivalent in SLC.

Robert,

It appears that Micrologix, SLC 5/02, 5/03, 5/04 and 5/05 have words S:20 and S:21 representing fault (powerdown) rung and file respectively.

Some of the micrologix processors don't show those words in the structured view of the status file, but the comments are there when creating a new file.
 
I'm getting my money's worth here!

Having a little trouble with my timers, maybe I don't completely understand what you are doing with the MEQ. Would you mind taking a look?

oh, and to you have that excel file?
 
OkiePC said:
Robert,

It appears that Micrologix, SLC 5/02, 5/03, 5/04 and 5/05 have words S:20 and S:21 representing fault (powerdown) rung and file respectively.

Some of the micrologix processors don't show those words in the structured view of the status file, but the comments are there when creating a new file.

lol..You know, I saw those before, and for some reason, I had CLX in my head and thought that's odd, that there'd be a rung/file that would execute on a Fault. I didn't even think that it was REPORTING the rung/file. Can't see the forest for the trees sometimes. Then again, I do a SLC top to bottom once every two years if that ;)
 
In the output map file, delete rung 16, or move your timer there. There should not be an OTE with the address B3:140/15, since it is written by the SQO.

In my earlier revision, I put the spares in rungs like that just as placeholders. Note that rung 1 has the same thing going on. Also, I used OTU instructions to hold the places of items that were not defined in the output words. If you later use those outputs, be sure to locate them and remove the existing instructions.

That may not be your problem, though, as long as you are in AUTO, the rung would not affect the state of the address.

Since your timer is ENabled by SQO bit B3:140/15, and the test switch not being made, then it will not reset between consecutive steps in which bit 15 is set in the SQO file.

You will want to program a reset of T4:1 when the sequencer advances. If you also want your timer to reset when using the JOG step button, then you could simply program the reset in parallel with the SQO instruction.
 
structure and comments

I was short on time at work today, but now that I am home, I wanted to touch on some structure recommendations as you evolve your sequencer logic.

Move your timer, and your mode control logic to the MAIN routine.

Make sure that JSR IN_MAP is still first, then update the mode logic: Define AUTO, MANUAL, TEST, STOP, and any other machine-wide modes that you have.

Next comes the JSR to the sequencer.

Then, there is sequencer driven control logic, things like timers, speed references command logic, counters, production data, PID loops, drive controls, whatever you need to fill in hte meat of the program that is not covered by input mapping but does not directly drive an output.

Finally, at the end is the output map. That file shouldn't be used for anything except copying user data to actual devices. You may interpret the data in that file, change variable types, and interlock things but minimally. The output map is a good place to clamp analog values between limits, do alarm checking, and interlock things such as solenoid valves on opposite ends of a spool valve. The more interlocking that is done in the output map, the less control you will have in your main routine.

And, finally, comments, comments, comments. What is it?, what does it do? How fast? In which direction? What is the device name on the electrical drawings? What is the wire number? All that information will usually fit in a tidy little comment/symbol and make a world of difference as you work with the logic on screen, especially online.

The output map is always last, the inmap is always first, and they are intended to be mere interface files built to accomodate the portability and ease of use of the sequencer file and the rest of the meat in the main.

Your control section is going to be very short, so leave it in the main, no point having a file that is just three JSRs. If it gets more than a few dozen rungs, then maybe break it up into pieces, but I don't forsee that with your core program.

Then treat the In-Map, Sequencer, and Out-Map programs as functions.

Move the definition of the AUTO and MANUAL internal bits to the main, right after In-Map, but before the Sequencer call.

Put the timer logic after the sequencer call, even the reset instruction.

That's all I recall from memory since I can't use RSLogix from home.

Paul
 
Last edited:
Thanks for all the help, Paul; I don't know what I would've done without it!
I do happen to have another, unrelated question. A machine my boss picked up at auction has an old Allen-Bradley controller. Does series 6200 software, and PLC-5 Programming Terminal Software mean anything? I have the old product manual, which has a layout of the already existing program and it seems to call for a controller large enough to hold 47 inputs and 39 outputs with 23 and 18 spares respectively. Would it be feasible to try to adapt this to rslogix, because it seems very similar. What type of processor would be most compatible?
 
That is the DOS based software for a PLC5. The PLC5 is the most rugged and dependable PLC I have ever worked with. They are still being produced and supported, but the hardwre prices are very high. If the machine has a working PLC5, I would recommend you purchase RSLogix5 and ditch the old 6200 series software.

RSLogix5 is very much like RSLogix500, so you should be right at home with it. There are some significant differences in the hardware and some unique instructions but the basic instructions are identical.

Find out the model number of the existing PLC and start another thread...

Paul
 

Similar Topics

I am currently doing a project that involves two different robo cylinders. For each robo cylinder the outputs (programmed under the SQO...
Replies
9
Views
8,169
Can anyone give me an example of using the SQO and SQC functions together Example 2 Pneumatic cylinders Cyl A ext Cyl B extend Cyl B retract Cyl...
Replies
2
Views
3,751
Hello, Can anyone explain the sequencer compare instruction to a beginner PLC programmer, if you could use a actual real world application that...
Replies
9
Views
1,050
I need to convert a SLC SQC sequencer instruction to control logix. There is no SQC instruction in ControlLogix just SCI, SQO, and SQL. Has anyone...
Replies
1
Views
2,199
Hello all, I was hoping to get some advice on an issue I am having. We are doing a conversion slc to clx. The original code uses a SQC...
Replies
1
Views
2,424
Back
Top Bottom