Flagging ?????

MiPilot

Member
Join Date
Nov 2009
Location
Michigan
Posts
27
Can you guys help me understand using a flag.

It's probably simple but I just can't quite get my mind around it.

This is what is suggested: Example: You might add a new rung to the beginning of your program, and insert instructions to test that the motor is stopped, and all switches are released... Latch bit B3:0/0 True (ON) if so, and name it something like "Ready-To-Start".... Now you can add an XIC instruction addressed to this "Ready-To-Start" bit to both your existing Motor UP, and Motor Down control rungs, and this will confirm that the motor may be started.. Of course you will need to unlatch the "Ready-To-Start bit once the motor is started.

Not looking for someone to solve this just help me understand it.

Thanks Steve
 
What inputs do you have that indicates the motor is running? If there is one consider an "XIO" instruction to latch B3:0/0.
 
Just curious, but what is the defenition of a flag as it applies to the example? I understand what the example is getting at, but what part of it is a flag? It may be the key to getting a clearer explanation...
 
A 'flag' is typically a 1 bit (Yes/No) indication that a complex condition exists or did exist. This single bit then is used instead of repeating the complex logic testing. If the bit is set (latched) (that is ... it stays true even after the original conditions return to false) then some other condition or conditions must be evaluated to reset (unlatch) th4e flag.
 
Here is the entire exercise:
In this exercise we want you to add one final touch which will possibly extend the life of the door hardware. Starting and stopping the door motion obviously puts a strain on the door hardware, but reversing the direction of the door without giving it a chance to fully stop causes an even greater strain. We want you to modify your program to prevent the possibility of immediate reversal. As we don't need much of a delay, the following additional criteria should suffice:


  • [*]If the door is currently opening, pressing the Close Switch will immediately halt movement. Door movement will remain halted when the switch is released.
    [*]If the door is currently closing, pressing the Open Switch will immediately halt movement. Door movement will remain halted when the switch is released.
    [*]Once movement is halted, and all push buttons have been released, then door motion in either direction can once again be initiated by pressing the appropriate Open or Close button.
    [*]The utilization of Binary or Integer Table bits to Flag specific conditions within your program would be appropriate. Also, the retentive OTL and OTU instructions may be utilized freely at your discretion.
Hint: If you review the foregoing criteria carefully, you should note the the motor should only be permitted to start after a specific set of conditions have been met. The conditions being that the motor is stopped, and all switches are released.. Since this same set of conditions will apply to both the door opening, and door closing operations, this may be the ideal time to use flagging.... By flagging, I mean that you will use a bit in the PLC memory (such as B3:0/0) to indicate that a specific condition, or set of conditions exist.
Example: You might add a new rung to the beginning of your program, and insert instructions to test that the motor is stopped, and all switches are released... Latch bit B3:0/0 True (ON) if so, and name it something like "Ready-To-Start".... Now you can add an XIC instruction addressed to this "Ready-To-Start" bit to both your existing Motor UP, and Motor Down control rungs, and this will confirm that the motor may be started.. Of course you will need to unlatch the "Ready-To-Start bit once the motor is started.
BTW: Almost any unused bit may be used as a flag, but since RSLogix has set aside the B3: memory area, and this memory area displays in binary format by default, it's commonly used for this purpose.. N7:1/12 would work however, but the N7 area is normally used as place for storing integers as this memory area is displayed in decimal by default... Additionally, it is sometimes possible to use an Operator Panel lamp as flag if the conditions suit.
 
.....Also, the retentive OTL and OTU instructions may be utilized freely at your discretion.

Slightly O/T, many of my clients/customers would take exception to this statement and I have to agree with them. I've had to debug programming by others that over used them and it was a nightmare. Personally, I only use them if I want to remember the state if the power goes off, otherwise I just seal them.
 
Bernie's explanation is dead on. Don't let the name confuse you.

A "flag bit" is used to concisely convey a whole bunch of information quickly, just like the colorful bit of fabric it's named after.

You could hang a sign outside a US embassy that says "this bit of real estate is to be considered part of United States territory, and US law and protection for it's citizens applies to all who enter here." Instead we just hang a US flag on the wall to convey the same thing with one item. A flag bit does the same thing - it simply collects may logic and control requirements, and if its "on" they've all been met. If it's not "on" some of the conditions aren't true.
 
What do you use for non-complex conditions that exist or did exist - an ensign ?
 
Last edited:
What do you use for non-complex conditions that exist or did exist - an ensign ?
Hahaha. No, in the US Navy it is a signals officer or the cook, whichever happens to be handy.
 

Similar Topics

Hi Using RSView32 RSTrend, it there a way to mark places on a graph where data exceeds 50 and 60. My first thought was to make a tag / pen...
Replies
0
Views
1,643
Back
Top Bottom