adccommunitymod (AutomationDirect) asked a question.

click program questions

Created Date: August 08,2014

Created By: napierm

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

I am new to plc programing I took a basic class 2 years ago and have watched videos but never actually tried writing a program. I have a chance to do one now so I am just trying to get a few concepts straight in my head. Could someone tell me on the click plc if I put and estop input in the main program will that be ignored while a sub routine is running?


  • adccommunitymod (AutomationDirect)

    Created Date: August 09,2014

    Created by: milldrone

    I am new to plc programing I took a basic class 2 years ago and have watched videos but never actually tried writing a program. I have a chance to do one now so I am just trying to get a few concepts straight in my head. Could someone tell me on the click plc if I put and estop input in the main program will that be ignored while a sub routine is running?

    napierm,

    Forgive me if I'm misunderstanding your question.

    The main program is always being scanned. So the results of actions in the main will always happen. It is possible that a subroutine may also be scanned every scan cycle also. This depends if the subroutine is unconditionally called or conditionally called.

    There are many reasons for using subroutines. I will attempt to list some of them, note: I'm sure I will have forgotten some of them.

    1. Dividing the logic into smaller chunks so that a person can find just the section he is interested in. Think of a file cabinet, all of the information is inside the cabinet but there also file folders inside that divide the subjects into smaller more useable chunks.

    2. Sometimes the length of time the PLC takes to scan is critical to the process. So some programmers break the logic into subs that will be active or scanned during the appropriate state of the machine. An example of this might be an "auto subroutine " and a "manual subroutine ". There would be no need to scan the logic that was needed for "manual " if the machine was in "auto ". Note: the handling of conditional subs needs to be very carefully considered otherwise some very undesirable side effects may happen.

    3. Sometimes machines need to do specific things after a PLC first powers up. Homing, testing certain actions, loading parameters. An example of loading parameters would be the setup of com ports. This comes in handy if the PLC needs to be replaced, as the logic needed to setup the com port will happen on the first scan.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 10,2014

    Created by: Tinker

    Could someone tell me on the click plc if I put and estop input in the main program will that be ignored while a sub routine is running?

    The answer to the question you wrote is yes.

    Also, for certain definitions of "Running " an input will generally be ignored while the main program is "running ". A PLC will typically read all the inputs at the beginning of a scan, store the values and then use the stored values while "running " the program, then after processing all the instructions, it updates the outputs. The scan, including reading the inputs, is however repeated many (perhaps hundreds) times a second so it generally appears as though stuff is happening in nearly real time.

    (The CLICK does have a modification for the input instruction that will read the current value of an input, but it slows the program down and so is only used in special cases)

    However , the answer to the question you almost certainly meant to ask is no.

    The difference is in understanding how a the typical PLC scan works. If you are old enough you may remember when running a PC program, if you, say, started printing a document, you might as well go out to lunch because you were not going to be doing anything with your PC until it was done with that task.

    The typical PLC does not work that way, a subroutine can not take control of the system. There is very little if any looping capability other than the main scan which ALWAYS (on a simple PLC like the CLICK anyway) includes main. The instructions in the program (main and optionally subroutines) are scanned through just once and then control returns to the top of the main program (where the scan repeats, over and over). Note that if the subroutine can not complete its task in one scan you will have to keep calling it until it is done. Also if there is a "More than one scan "step that must be finished before proceeding with other steps it can get interesting with condition bits and stuff.

    One can not do something like, for example filling a bottle on a conveyor;

    Begin:

    Turn on conveyor until bottle is under fill nozzle and then stop.

    Turn on flow until bottle is full, then stop.

    Done:

    Instead it has to be something like:

    Begin:

    IF bottle is NOT at fill nozzle, turn on conveyor motor (note that when bottle is at fill nozzle condition will be false and motor will be turned off)

    IF bottle is at fill nozzle AND bottle is NOT full, turn on flow (note that there is no wait after we turned on the motor in the previous step, this step will be evaluated right away, so we have to explicitly check if the bottle is in position)

    Go back to Begin (endlessly):

    If the bottle is at the fill position and it is full then the two steps above will not do anything, but they will be evaluated, over and over and over

    Note that while the last instruction in a CLICK program (and many, most? PLCs) is "END " it is really more like "GOTO beginning "

    Oh, and not to be pedantic, a properly implanted E-Stop does not depend on the PLC (unless using a safety rated PLC, which is a rare beast not sold by ADC, the CLICK is definitely not one). A proper E-Stop will remove power from any dangerous parts of the machine independently of any other control devices.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 11,2014

    Created by: kewakl

    Oh, and not to be pedantic, a properly implanted E-Stop does not depend on the PLC (unless using a safety rated PLC, which is a rare beast not sold by ADC, the CLICK is definitely not one). A proper E-Stop will remove power from any dangerous parts of the machine independently of any other control devices.

    Tinker, I would not consider that 'pedantry! '

    I see poor E-Stop implementation too often!

    .. Normally Open E-Stop contacts - no wire-break detection

    .. E-Stop to PLC input only / No E-Stop input to PLC

    .. E-Stop simply removing power to PLC

    .. No E-Stop reset (no safety-rated relay.. non-latching E-Stop circuitry)

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 11,2014

    Created by: napierm

    Thanks

    Thanks very much for taking the time to respond with such detail to my question, I really appreciate it. I was aware of the estop information, the input to the plc is not the only disconnect but thanks for checking.

  • adccommunitymod (AutomationDirect)

    Created Date: August 08,2014

    Created by: napierm

    I am new to plc programing I took a basic class 2 years ago and have watched videos but never actually tried writing a program. I have a chance to do one now so I am just trying to get a few concepts straight in my head. Could someone tell me on the click plc if I put and estop input in the main program will that be ignored while a sub routine is running?