One two-position switch controls both valve outputs when it writes a single internal bit and the PLC decodes it: bit ON drives the open output, bit OFF drives the close output, with machine-on and in-cycle permissives in the same rungs. A cross-interlock keeps the two outputs apart.
A motorized valve with separate open and close coils needs two output addresses, one per direction, and one two-position switch on the screen is enough to command both. The switch never writes to either output address. It writes one spare internal bit, and a pair of PLC rungs decodes that bit: ON drives the open coil output, OFF drives the close coil output, with the machine-on and in-cycle permissives sitting in the same rungs. One bit gives the program a single owner for the valve, so the permissives, the interlock between the two directions and, later, a manual or automatic choice all stay in the logic where they belong. This article sets up the switch, writes the two rungs with example addresses, works the timing with real numbers and tests the pair before the valve moves.
Can one HMI switch control two valve outputs?
Yes: one two-position switch is enough for a valve with an open coil and a close coil, provided the switch writes a single internal bit and the PLC turns that bit into the two Y outputs, one rung per direction.
The switch holds exactly two states and the valve has exactly two coils, so one bit carries the whole command: ON selects open, OFF selects close. There is no single screen control that writes two addresses at once and drives both coils directly, so the decode belongs in the program. The same one-bit pattern runs a forward-off-reverse selector feeding a PLC state machine when a motor needs three commands.
What you need before opening the projects:
- The valve drawing, showing which Y address (yxxx in this program) energizes the open coil and which energizes the close coil, and the coil voltage, 24 V DC in the worked example.
- One spare internal bit in the PLC that no other rung writes.
- Two output points, one per coil, each sized to its coil's current.
- Access to the panel project, to place one two-position switch object on the 6-inch screen.
- Any existing rungs that already drive those two outputs, so the new decode becomes the only writer.
Why should the switch write one internal bit instead of two Y addresses?
Because a direct write to a Y address bypasses every condition the program owns: the permissives, the automatic sequence and the cross-interlock all sit in the PLC, so the switch hands over one command bit and the program decides when each coil energizes.
The rule on this panel family is blunt: never write directly to X or Y addresses. X inputs are read from the field, Y outputs are owned by the rungs that drive them, and a screen write to either one fights the program on its next scan. An internal bit breaks the fight: the switch writes the bit, the decode rungs read it, and everything the machine requires (machine on, in cycle, mode) sits between the bit and the coil. Controlling PLC outputs via HMI and SCADA using internal memory addressing walks through the same write-to-internal-address pattern for panel commands.
How do you set up the two-position switch on the screen?
Place a two-position switch object, point its write address at one spare internal bit such as C10, and label the ON position Open and the OFF position Close, leaving both Y addresses out of the object entirely.
- Open the panel project, place a two-position switch object on the screen layout, and give it a target about 20 mm across; standard HMI design guidance puts the smallest usable touch target near that size, and gloves make smaller ones miss.
- Set the switch write address to the spare internal bit,
C10in the worked example. Leave both Y addresses out of the object. - Label the ON position Open and the OFF position Close, so the control reads as a command. If the station also wants a status line that follows the bit, two text states driven by one PLC bit do it without a second tag.
Pick the bit once and write it into the project notes: any routine that also writes C10 turns the switch into a fight, because two writers on one address resolve by last write.
What PLC rungs turn the bit into the two outputs?
Two rungs do it: rung one energizes the open output when the bit is ON, rung two energizes the close output when the bit is OFF, and the machine-on and in-cycle permissive contacts sit in series in both rungs.
- Fix the example addresses and their meaning:
C10is the command bit the switch writes,Y1is the open coil output andY2is the close coil output; the real yxxx addresses come from the drawing.C10starts OFF at power-up unless the program makes it retentive, so the decode selects close the moment the permissives go true. If a close command at power-up is wrong for the process, keep one permissive false until the process is ready to run. - Write the open rung:
C10contact in series with the NC contact ofY2and the permissive contacts, driving coilY1. - Write the close rung: NC contact of
C10in series with the NC contact ofY1and the same permissives, driving coilY2. - Delete or rewrite any older rung that drove
Y1orY2from another bit, so the decode is the only writer the outputs have.
| Rung | Contacts in series | Coil |
|---|---|---|
| Open | C10, NC Y2, machine on, in cycle |
Y1 |
| Close | NC C10, NC Y1, machine on, in cycle |
Y2 |
The NC cross-contacts make the outputs mutually exclusive. When the bit flips while one coil is ON, the rung that was driving drops at the end of that scan and the other rung picks up on the next one, so a one-scan gap always separates the directions and the two coils never see power together. A small PLC finishes a scan in a few milliseconds, fast enough that the actuator never notices the gap.
What does the finished logic look like in a worked example?
One 6-inch panel, one spare bit C10 and two outputs run a motorized ball valve with 15 s of open travel and 15 s of close travel, and the switch command reaches the coil about 0.11 s after the flip.
Scenario: a motorized ball valve on a process line, coils at 24 V DC, 15 s of travel each way, driven from the 6-inch panel. The panel writes C10 on a 100 ms poll, and the PLC scan on this machine runs under 10 ms.
- An operator flips the switch to Open at t = 0 s.
- The panel writes
C10= 1 on its next poll, up to 0.1 s later. - The scan after the write reads the new bit, sees the permissives true and
Y2off, and setsY1: under 0.01 s more. - The open coil energizes about 0.11 s after the flip (0.1 s + 0.01 s = 0.11 s), and the valve reaches its open limit about 15.1 s after the flip (0.11 s + 15 s).
- Flip to Close at the 7 s point of the travel:
C10returns to 0 within 0.1 s,Y1drops andY2picks up across the one-scan gap of under 10 ms, and the actuator takes the close command; the actuator manual says whether it reverses under load or finishes the travel first. - Power-up:
C10is OFF, so with the machine on and in cycle the close rung holdsY2ON and the valve drives closed inside 15 s. Gate the permissives so both rungs stay blocked until the process is ready if a powered close at start-up is wrong for the line.
The decision the numbers give: one bit, two rungs, a coil command inside about 0.11 s of the flip, one direction at a time, and travel time set by the actuator.
How do you test the switch without moving the valve?
Test in two stages: first with the machine held out of cycle so the permissives block both rungs, then with the permissives true and the coil circuit disconnected, watching C10 change and exactly one output follow each flip.
- Stage one, permissives blocked: flip to Open and to Close.
C10follows each flip and both outputs stay OFF, which shows the permissives sit ahead of the coils. - Stage two, permissives true, coil circuit disconnected: flip to Open;
C10goes ON,Y1sets within a scan,Y2stays OFF. Flip to Close;Y2sets,Y1drops. - Restore the coil circuit and run one open and one close travel; the limit switch or position indicator at each end is the pass mark. An output that reads ON is not proof the valve moved.
Treat the first live travel as the moment the valve starts moving things downstream: confirm nobody is working on the line the valve isolates before you restore the coil circuit. If the operator should watch both coil states and both limit switches at a glance, one screen that displays 16 PLC input and output bits carries it.
What changes when an automatic sequence also drives the valve?
Add a manual and automatic selector owned by the program: in automatic the sequence's open and close commands feed the output rungs, in manual the switch bit does, and both paths pass through the same permissives and cross-interlocks.
With the screen as the only valve command source, the decode rungs are the whole job. With a sequence in the program, a mode decision comes first. Add one manual/automatic selector bit owned by the program, then feed each output rung from both sources:
- Open rung command input: (automatic AND sequence-open) OR (manual AND
C10) - Close rung command input: (automatic AND sequence-close) OR (manual AND NC
C10)
Both paths still pass through the NC cross-contacts and the permissives, so the outputs cannot overlap in either mode. Switching automatic to manual hands the command to the bit on the next scan; switching back lets the sequence's next command reassert the direction. The alternative, letting two writers hit one address and the last write win, is the fight described in two HMIs writing to one PLC: who wins the write, and the selector keeps the sources apart.
When does a two-position switch not fit the valve?
A two-position switch fits valves with exactly two commands: add a neutral stop, a pulse-type actuator or a spring-return coil and the valve needs a different command scheme, because the switch offers two states and nothing between them.
Match the command scheme to the actuator's input list:
- Open and close coils only: the two-position switch and the one-bit decode above are the fit.
- Open, close and stop: three commands need two command bits and a three-state selector; the rungs decode the pair, treat both-bits-off as neutral and keep the cross-interlock. OFF in the two-state mapping means close, so relabeling a two-position switch as open and stop is wrong: the bottom position would drive the close coil.
- Pulse-type actuators: the input list takes momentary pulses, and the rungs add the pulse timers behind the two command bits.
- Spring-return valves: one coil, energize to open, the spring closes on loss of power, so one output and one bit do the whole job and the close rung disappears.
Recommendation: For a motorized valve with one open coil and one close coil, point the two-position switch at one spare internal bit, decode it in two rungs with the machine-on and in-cycle permissives in series, and cross-interlock the outputs with NC contacts so a one-scan gap always separates the directions. Test with the permissives blocking first and the coil circuit live last, and take the pass mark from the valve's position indication. If an automatic sequence also commands the valve, add the manual/automatic selector rung before release; if the actuator lists open, close and stop, move to two command bits and a three-state selector.
Questions
What happens to the valve when the screen link drops?
The command bit holds its last written state, so the decoded output keeps driving that direction. Most HMI families publish a communications-health bit for exactly this case: put it in series with the machine-on and in-cycle contacts so both rungs drop when the link goes down, and the valve sits until the link and the operator bring it back. Ask for the bit's address in the panel manual before release.
Can the button toggle the bit so the PLC needs no rungs?
Some panels offer a toggle action that flips one bit on each press, which is fine for a lamp or a mode flag. For a valve, keep the decode: the toggle state lives in the panel and a reboot can reset it while the PLC bit keeps its value, so the next press can write the opposite direction. The rungs are what keep the screen, the bit and the two coils in step.
Do both coils share one output point?
No. Each direction applies power to its own coil, so each coil gets its own output point, sized to the coil's inrush and holding current from the actuator datasheet. Protect the two coil circuits separately so a fault on one coil cannot take both directions out at once, and label the points open and close at the terminal block so the wiring matches the drawing.
How does the operator see the real valve position?
The switch position shows the command, not the valve. Drive a position lamp from the open and close limit switch inputs so the screen shows where the valve actually sits, and treat the two lamp states as the pass mark during the live test. If the valve has no limit switches, a current or travel-time check on the actuator is the next best indication.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.