How-to
Program a two-pump station with flowmeter pulses on an FX3U
Short answer
Build the station in staged rungs: a master fault latch, a start/stop run latch, pump 1 on the level call, pump 2 after 30 s (T1 K300 on the 100 ms base) or on a pump 1 overload, and the flowmeter counted on high-speed counter C235 at up to 100 kHz, scaled to L/min as pulses per second × 60 ÷ K-factor.
On this page
Build this station in stages and prove each stage before adding the next. The program is four blocks: a master fault latch, a start/stop run latch, pump 1 with a 30 s assist timer that brings in pump 2, and the flowmeter counted on high-speed counter C235 with a one-second sample scaled to L/min. The one hardware decision that matters is the counter: C235 counts a one-phase pulse train up to 100 kHz in hardware, while a standard counter in the C0–C199 range only catches pulses the scan can see. Flow in L/min is pulses per second × 60 ÷ K-factor.
What the FX3U hardware decides for you #
Set the counting and timing budget before writing rungs. C235 counts one-phase pulses at up to 100 kHz, and the high-speed counter inputs are X000–X005. The standard range C0–C199 is evaluated with the scan, so a pulse shorter than the scan disappears — the same effect behind why a PLC misses short input pulses. A flowmeter is exactly that kind of fast repetitive input, which is why its pulse lands on X000 and is counted on C235.
| Resource | Devices | Basis and limit |
|---|---|---|
| One-phase high-speed counting | C235 | Up to 100 kHz, counted in hardware on X000–X005 |
| Standard counting | C0–C199 | Read with the scan; pulses shorter than the scan are lost |
| 100 ms timers | T0–T199 | K1 = 100 ms; maximum preset 3,276.7 s |
| 10 ms timers | T200–T245 | Maximum preset 327.67 s |
| 1 ms timers | T246–T249 | Maximum preset 32.767 s |
| Retentive 100 ms timers | T250–T255 | Value survives a power-down |
| General data registers | D0–D7999 | 16-bit each; C235 counts 32-bit |
I/O assignment for the station #
| Signal | Address | Wiring |
|---|---|---|
| Flowmeter pulse | X000 | NPN open-collector or 5–24 VDC pulse; C235's counting input |
| Start pushbutton | X001 | N/O, momentary |
| Stop pushbutton | X002 | N/C — a broken wire reads as a stop |
| E-stop channel | X003 | N/C monitor contact from the safety relay |
| Pump 1 overload | X004 | N/C contact of the overload relay |
| Pump 2 overload | X005 | N/C contact of the overload relay |
| High level switch | X006 | N/O, closes at high level |
| Low level switch | X007 | N/O, closes at low level |
| Pump 1 contactor KM1 | Y000 | Contactor coil |
| Pump 2 contactor KM2 | Y001 | Contactor coil |
| Fault lamp | Y002 | Panel lamp |
| Run lamp | Y003 | Panel lamp |
The floats are the process call: X007 closes at low level to call for pumping and X006 closes at high level to end the run. A station that latches between two floats with no pushbutton latch follows the pattern in latch two level inputs for pump start and stop control. Keep the pulse cable at least 100 mm (3.94 in) away from contactor-coil and power wiring — the separation the FX3U hardware manual asks for between control lines and main-circuit or power lines — and land the meter's pulse output on X000.
The ladder, rung by rung #
- Decide what a fault is, then latch it. M100 is set by the E-stop channel alone: X003 is fed through N/C wiring, so the channel reads ON when healthy and the inverted contact /X003 closes only on a press or a broken wire. Clearing it is manual: /X002 in series with M100 drives RST M100, so the operator presses stop to reset once the safety circuit is healthy again. The X003 contact only lets the program react and light a lamp — the E-stop itself opens the contactor-coil circuits directly through the safety relay, a channel designed and validated to ISO 13849; PLC logic is never the safety function.
- Latch the run. (X001 OR M0) AND X002 AND /M100 AND /X006 drives M0. The start button seals itself around M0. X002 is fed through the stop button's N/C side, so the plain contact drops the latch on a press or on a wire break; /M100 ends the run on a master fault and /X006 ends it at high level.
- Run pump 1. M0 AND X007 AND /X004 AND /M100 drives Y000. The low-level switch is the call, and pump 1's own overload X004 appears inverted here so a trip stops pump 1 only — that is what lets pump 2 cover for it in step 5.
- Time the assist. Y000 drives T1 with preset K300: 300 × 100 ms = 30.0 s of pump 1 running before assist.
- Run pump 2. ((M0 AND T1) OR (M0 AND /X004)) AND X007 AND /X005 AND /M100 drives Y001. Pump 2 assists after the 30 s, or takes over at once when pump 1's overload drops; /X005 keeps pump 2's own overload out of the rung. Keep both conditions in one rung — a second Y001 coil elsewhere trips the duplicate-coil diagnostic in GX Works2. This is assist, not alternation: pump 1 leads every cycle, and runtime equalization is the pattern shown in write alternating lead lag pump logic in RSLogix Micro. With pumps on drives instead of contactors the assist question becomes a speed question, which variable-speed pump lead/lag assist control programming covers.
- Count the pulses. M8000, the always-ON special relay, drives the count coil DCNT C235 K999999, with the pulse arriving on X000. The preset is never reached because RST C235 clears the count every second.
- Sample once a second. M8000 drives T2 with K10 (10 × 100 ms = 1.0 s), and the timer resets itself through its own contact. On the T2 contact execute MOV C235 D0, then RST C235, then RST T2, in that order — move first, then clear, or D0 reads zero.
- Scale to L/min. MUL D0 K60 D10, then DIV D10 K100 D2, for a K-factor of 100 pulses per litre. MOV C235 D0 is a 16-bit move on a 32-bit counter: above 32,767 pulses in the window the transfer truncates, and that is the point to switch to DMOV and 32-bit math such as DMUL.
- Drive the lamps. Y002 = M100 OR /X004 OR /X005; Y003 = M0.
/X003 [ SET M100 ]
/X002 M100 [ RST M100 ]
( X001 OR M0 ) AND X002 AND /M100 AND /X006 ( M0 )
M0 AND X007 AND /X004 AND /M100 ( Y000 )
Y000 [ T1 K300 ]
( (M0 AND T1) OR (M0 AND /X004) )
AND X007 AND /X005 AND /M100 ( Y001 )
M100 OR /X004 OR /X005 ( Y002 )
M0 ( Y003 )
M8000 [ DCNT C235 K999999 ]
M8000 [ T2 K10 ]
T2 : MOV C235 D0 ; RST C235 ; RST T2
M8000 : MUL D0 K60 D10 ; DIV D10 K100 D2
Worked example: turning 100 Hz from a 100 pulse/L meter into L/min #
Inputs: an injected 100 Hz pulse train on X000 (the commissioning signal), a K-factor of 100 pulses per litre (the meter's calibration figure, a typical value for this class of meter), and the 1.0 s sample window set by T2 K10. Rule in words: litres per minute equal the pulses counted in one second, times 60 seconds per minute, divided by the pulses per litre.
- Pulses in the window: 100 Hz × 1.0 s = 100, so D0 = 100
- Pulses per minute: 100 × 60 = 6,000
- Litres per minute: 6,000 ÷ 100 = 60, so D2 = 60 L/min
Decision: on the injection test D2 must read 60 — a different number means a broken chain (C235 not enabled in the parameter, or RST C235 ahead of the MOV), not a different flow. The count of 100 sits far below the 32,767-pulse 16-bit ceiling, so the MOV, MUL and DIV path stands for this meter; go to DMOV and DMUL only when the window can hold more than 32,767 pulses, which at this 1 s window is a pulse rate of about 32.8 kHz. And 100 Hz is a thousandth of C235's 100 kHz ceiling — the counter is never the limit at this station, while a standard counter would be.
Commissioning checks #
- In GX Works2, enable the built-in high-speed counter for C235 under PLC Parameter, download the parameter and the program with the PLC in STOP, switch to RUN, and confirm C235 and D2 read 0.
- In monitor mode, close X001: M0, Y000 and Y003 pick up; open X002 and all drop.
- Drop the X003 channel: Y000 and Y001 fall out at once and Y002 lights; restore the channel, press stop to clear M100, then restart.
- Drop X004 while running: Y000 stops, Y001 starts immediately, and Y002 lights. Restore, restart, and confirm the other path: from Y000 on, Y001 waits the full 30 s of T1.
- Inject the 100 Hz signal on X000: D2 shows 60 within a second, D0 updates to 100, and C235 clears every second.
- Confirm Y000 and Y001 each appear in exactly one rung; two coils on one output is the classic duplicate-coil fault.
When it misbehaves #
| Symptom | Likely cause | Fix |
|---|---|---|
| C235 stays at 0 with pulses present | C235 not enabled in PLC Parameter | Enable it and download the parameter again |
| D0 reads 0 while C235 counts | RST C235 ahead of the MOV | Keep MOV C235 D0, RST C235, RST T2 in that order on the T2 contact |
| Pump 2 starts together with pump 1 | Timer on the wrong base | T1 K300 is 30 s only on the 100 ms group; the same K300 on a 10 ms timer is 3.0 s |
| Outputs will not come at all | M100 latched from an earlier E-stop | Press stop to fire the RST M100 rung, then restart |
Questions asked
Why does the flowmeter need C235 instead of a standard counter like C0?
Standard counters in the C0–C199 range are read with the scan, so any pulse shorter than the scan time is never seen and the total runs low or jumps around. C235 is counted in hardware up to 100 kHz regardless of scan time, which is why the meter lands on X000 with the count coil DCNT C235 K999999.
What preset gives a different assist delay, or a timer on the 10 ms base?
T1 sits in the 100 ms group T0–T199, where K1 is 100 ms, so K300 gives 30.0 s and K600 gives 60.0 s. If the delay sat on a 10 ms timer from the T200–T245 group instead, 30 s would need K3000. The 100 ms group tops out at 3,276.7 s, so long delays belong there, not on the faster groups.
How do I rescale D2 when the meter's K-factor is not 100 pulses per litre?
Replace the K100 in the divide with the meter's calibration value, because L/min = pulses per second × 60 ÷ K-factor. A meter of 250 pulses per litre at the same 100 Hz injection gives 100 × 60 ÷ 250 = 24 L/min, so D2 must read 24 after the change.
Does wiring the E-stop channel into X003 make the station safe?
No. X003 only lets the program drop outputs and light the fault lamp. The E-stop has to open the contactor-coil circuits directly through the safety relay, and that channel is designed and validated to ISO 13849 against the machine's risk assessment. PLC logic is monitoring, never the safety function.