timerplc

Stopping a PLC Timer


This is kind of a basic question, but I am new to PLC's, so please bear with me. I am working on a basic PLC program with the Do-More designer and Simulator for a process mixer. The mixer has two sensors that detect when the tank is empty or full. When empty, Solenoid A opens the input valve until the full sensor detects the tank is full. A motor powering the mixing armature turns on for 10 seconds, then the outlet valve (Solenoid B) opens to drain the tank. My problem is with the timer. I want it to automatically produce an output that will turn off the motor and have tried several ways to do this, but I can't get it to work. The timer will reset itself to zero, and turn on y5, but y2 only resets momentarily and the timer starts counting again.

Picture of code using tmra timer

Alternatively, I can turn off the motor using a different timer, but then the timer will not reset itself to zero, it runs until the end of the program.

Code using ONDTMR

If anyone knows how to make the timer stop counting in either case, I would appreciate the help. Also, as a side question, is it okay to have multiple outputs on the same rung?


Solution

  • The problem is that the X3 input (Full_Sensor) is continuously setting (turning on) Y2 (Motor_On). T0.Done resets Y2, but on the next scan Y2 is back on again as soon as rung 3 executes again, which then runs the timer again.

    Set and Reset coil instructions can get you in trouble with things like this if you aren't careful. If you want Y2 to turn on at an event (the on-transition of X3), but not to be continuously turned on, use a one-shot instruction (in Do-more, this is called "Leading Edge One-Shot on Power Flow"), which will only run the set instruction for one scan. Your Rung 3 would look like this:

    Rung 3 with one-shot instruction

    With that in place, Rung 5 will turn off Y2, which will turn off the Timer, and Y2 will not turn on again (and the timer will not run again) until X3 (Full_Sensor) goes off and then on again.