FANUC PMC Ladder Diagram Beginner Tutorial: Basic vs Function Instructions + Complete Tool-Magazine & Coolant Timer Examples

There are already plenty of “what is PMC” intros online, but most stop at that question. This article skips the basics and does three more useful things instead: draw the difference between sequential execution and relay logic correctly, turn the basic instructions into a lookup table you can keep at hand, and write a complete, usable ladder example from scratch.

If this is your first time with ladder diagrams, read FANUC PMC: What Is It? Working Principle and Applications Explained first for background, then come back here.

Safety note: The ladder examples in this article illustrate programming logic only — they are not programs you can download straight to a machine. Any program that goes on a real machine must pass your plant’s review and simulation verification. Logic that drives the tool magazine, spindle, or guard door must have both software interlocks and hardwired (electrical) terminal interlocks.

1. What PMC Is (in one paragraph, no deep dive)

A FANUC system can be seen as two parts: the system side that controls the servos and spindle, and the PMC side that controls auxiliary electrical actions (coolant, tool magazine, lubrication, door switches, etc.). PMC is very similar to a general-purpose PLC; because it is dedicated to machine tools, it is called the “Programmable Machine Controller.”

A PMC program is called a sequence program. Its working principle is summed up as: top to bottom, left to right, looping, executed in sequence.

That single phrase — “executed in sequence” — is the most fundamental difference between PMC and a relay circuit, and the place beginners most often trip up. The next section is devoted to it.

2. Sequential Execution vs Relay Parallel: One Diagram to See the Difference

This is the most important section of the article. Many references draw it wrong, leaving readers baffled by “why doesn’t my program run the way the electrical diagram says?”

Suppose a contact A controls two coils B and C, and C’s normally-closed contact is in series with B’s circuit. After A turns on, how do B and C behave?

Key conclusion:

  • In a relay circuit, as long as B’s path is conductive before C operates, B gets a brief moment of energization — this property can be used to make a rising-edge pulse, i.e. B is only on for one scan cycle.
  • In PMC, the order of the rungs directly decides the result. Whether you write B before or after C changes the behavior.

Do not copy the electrical diagram directly — the electrical diagram is parallel, the ladder is serial, and a direct copy will very likely behave differently.

Two rule sets, same circuit, completely different results

  • In a relay circuit, B and C are energized at the same time; B turns on for an instant then is opened by C’s normally-closed contact.
  • In PMC, C’s rung executes first and C turns on; by the time execution reaches B’s rung, C’s normally-closed contact has already opened, so B never turns on at all.

What this means for real programming

  • Don’t copy the electrical diagram directly — parallel vs serial changes behavior.
  • To make a pulse, use the dedicated edge-detection instruction, not a “rung-order coincidence” that happens to produce a one-scan pulse. FANUC edge detection is DIFU (rising) / DIFD (falling) — see FANUC PMC Rising/Falling Edge Detection: DIF Instructions Explained.
  • Remember the hard rule: logic errors are fixed in code, timing errors are fixed by rung order — if the logic is right but the behavior is wrong, it’s probably a rung-order problem.

3. PMC-L vs PMC-M (translated into “which one are you editing”)

Early FANUC 0 systems used two PMC models, PMC-L and PMC-M, with different required hardware and performance. PMC-M needs a dedicated circuit board and has an expanded address range.

Scope warning: The table below is reference data for early FANUC 0 systems. Modern 0i-series and later PMC specifications are completely different — do not apply this table to the machine in front of you. Always use your machine’s actual PMC specification.

Translated into “which one are you editing,” three sentences matter:

  • Different program levels → different END structure. Level 2 is END1 → END2; level 3 is END1 → END2 → END3. A wrong END structure means some functions simply don’t execute, with no error. See FANUC PMC Sequence Program END1/END2/END3 Explained.
  • Different execution speed → re-evaluate timing-sensitive code. The same ladder on a 6 µs vs 2 µs machine has different scan cycles and different ability to catch narrow pulses.
  • Different program capacity → confirm the target can hold it before porting. Iron rule: what decides PMC resources is the PMC model, not the CNC model — two 0i-MF machines can still have different PMC resources. See FANUC 0i-MD / 0i-MF PMC Difference Comparison.

4. Basic Instructions: RD / AND / OR / NOT / WRT Side-by-Side Table

PMC instructions fall into two classes. Basic instructions only do AND/OR/NOT logic on binary bits; function instructions perform specific functions on binary bytes or words, and can also do math.

广告

The table below maps ladder symbol → mnemonic → meaning. Print it and keep it at hand.

Ladder symbol Mnemonic Meaning
Normally-open contact RD Reads the state of a contact (start of a rung)
Series normally-open AND Logical AND with the next contact
Series normally-closed AND NOT AND with the inverted next contact
Parallel normally-open OR Logical OR with the next branch
Parallel normally-closed OR NOT OR with the inverted next branch
NOT (invert) NOT Inverts the current result
Coil / output WRT Writes the result to an output/relay

Normally-open vs normally-closed (don’t reverse them)

The difference is whether the slash touches the right vertical line. See FANUC PMC Ladder Symbol Quick Reference for the diagram. One rule to remember: use normally-closed for interlocks, normally-open for action triggers.

SET vs ordinary coil (WRT): the fundamental difference

The difference is memory.

  • Ordinary coil: when the input condition opens, the output turns off immediately.
  • SET: after the input condition opens, the output holds — until a reset signal clears it.

Three hard rules for SET/RST:

  • SET and RST must be a pair on the same address — the classic mistake is SET and RST on different addresses, so the bit can never be turned off.
  • The SET condition must not be a sustained signal — otherwise it re-sets every scan, and the moment the reset is removed it sets again.
  • Consider the power-up initial state of that bit — what state is it at power-on, and could it cause a false action?

When you must write mnemonics instead of symbols

Basic instructions can be drawn as contact/coil symbols; function instructions (TMR, CTR, MOVE, CMP, etc.) use an instruction box where you fill in the control condition, parameters, and output address. That is the main place the “mnemonic” concept is used in PMC.

5. Function Instruction Grouping (by purpose)

Grouping function instructions by purpose beats memorizing them by number.

  • CNT is not the counter instruction — a common mistake. FANUC’s counter is the CTR family (CTR/CTRB/CTRC); edge detection uses DIFU/DIFD.
  • TMR format: TMR a(b) c(d) where b is the preset; actual delay = preset × time base. The time base lives in a PMC parameter and is invisible in the ladder — changing the time base shifts the speed of all timers at once while the ladder shows no change.
  • During TMR timing, the input condition must stay ON; a break resets it to zero. So the trigger must be a single pulse — a sustained signal resets it repeatedly.
  • The timer’s relay contact must be written after the TMR statement (sequential execution top-to-bottom; written before, it reads the previous scan’s old value).

Full detail in FANUC PMC Timer TMR Instruction Explained and Counter CTR Instruction Explained.

6. Complete Example 1: Tool-Magazine Rotation, Counting, and Position-Reached Output

This is the original part of the article. Tool-magazine control is the most typical comprehensive PMC application: it has counting, comparison, and position confirmation all at once.

Requirement

  • Each time the magazine rotates past a pocket, the proximity switch produces one pulse.
  • PMC must count the pulses to get the current pocket number.
  • When current pocket = target pocket, output a “rotation complete” signal and stop rotation.

Address convention (example; use your machine’s address table)

  • Count input: R50.0 (edge pulse)
  • Reset input: magazine origin signal X10.1 (clears the counter at origin, as the reference)
  • Count current value: R100

Ladder logic (three blocks)

Block 1 — Edge detection: the proximity switch stays ON while parked at a pocket, so counting it directly counts many times. Detect the edge first:

X10.0 ──[DIFU]── R50.0   ← R50.0 is ON for only one scan cycle
This is the real application of "a relay parallel circuit naturally produces a one-cycle pulse, but PMC must use DIFU."

Block 2 — Counting: increment on each pulse with CTR.

        ┌─────────────┐
R50.0 ──┤ CTR         │
X10.1 ──┤ (RST)       ├── R100 (current value)
        └─────────────┘

Block 3 — Compare + position-reached output: compare R100 (current) with R102 (target) using CMP.

        ┌─────────────┐
        │ CMP         │
R100 ───┤             ├── R200.0 (ON when equal)
R102 ───┤             │
        └─────────────┘
Then the position flag cuts the rotation output (use normally-closed — this is the interlock):
X10.2(start) ──| |──── R200.0 ──|/|────( Y10.0 )
 start        position NC    rotation out

5 things to remember from this example

  • Edge-detect before counting — otherwise one pocket counts dozens of times.
  • The counter needs a reset reference — clear with the origin signal, otherwise accumulated error makes every tool number wrong.
  • The position signal uses normally-closed to cut the output — standard interlock writing.
  • Start and position must both participate — position only means it cuts off right after start; start only means it never stops at position.
  • This is only the logic skeleton — a real machine also needs rotation timeout, shortest-path forward/reverse (ROT), and mechanical + electrical dual interlocks.

7. Complete Example 2: Spindle Coolant Timed On/Off (TMR + Interlock)

The second example is shorter but covers the classic timer pitfall.

Requirement

  • Spindle starts → coolant opens immediately.
  • Spindle stops → coolant stays on for a delay, then closes (to keep spindle and tool cooling).

Logic

X20.0(spindle run) ──[TMR off-delay]──( Y20.0 coolant )

Use the timer for “off-delay”:

  • X20.0 ON → Y20.0 ON immediately.
  • X20.0 OFF → timer starts; coolant stays ON during timing.
  • Timing reached → coolant OFF.

3 points to watch

  • The trigger must be a single pulse or stay ON until timing completes — a break during TMR timing resets it and the delay fails.
  • The timer’s relay contact must be written after the TMR statement — before it reads the previous scan’s old value.
  • Coolant and spindle need an interlock — coolant with no spindle running can damage workpiece or tool in some conditions; this interlock must also have a hardwired terminal interlock as backup.
广告

8. Special Program Segments in PMC

Besides the main logic, a PMC sequence program contains segments with special purposes. Names and divisions vary between references, but the core types are:

  • First-level / second-level programs (see FAQ below for why emergency stop goes in level 1).
  • Subroutines and jump structures.
  • Initialization and power-loss-hold areas.

Why these segments cause trouble: they are bound to data. Backing up only the ladder, not the symbol/comment table, leaves a program that runs but nobody can read — one of the “backup five-piece set” points stressed in FANUC PMC Backup and Restore. For the full data composition of a sequence program, see FANUC PMC Programming Core: 8 Data Components of a Sequence Program.

9. How I/O Addresses Are Assigned (Module Setup in Practice)

The X10.0 / Y20.0 you write in the ladder aren’t arbitrary — you must first assign addresses to the actual I/O modules.

Four elements of allocation

  • Use two or more I/O modules → set each separately, and addresses must not overlap.
  • Allocation takes effect only after power-off restart (some systems use [IOSTRT] to apply — follow your machine).
  • The module name must match the actual hardware — a wrong name mismatches the point count, showing as “first few points normal, the rest all wrong.”

Operation steps (general flow)

  1. Confirm hardware connection — I/O Link goes from the system interface (e.g. JD51A / JD1A), daisy-chains to the first module’s JD1B, then its JD1A to the next module’s JD1B.
  2. Open the I/O module information screen to see connected modules — typically SYSTEM → [+] → PMCMNT → [+] → I/O LINK (menu names vary). This confirms the hardware is recognized.
  3. Enable edit permission — allow “edit permission”, “save after edit”, “RAM writable” (usually PMCCNF → setting).
  4. Open the module address setting screen — usually PMCCNF → [module], operate → edit.
  5. Enter in the format group.base.slot./byte count — e.g. 0.0.1./16 means group 0, base 0, slot 1, assign 16 bytes input (from X0).
  6. Set X and Y separately — both directions.
  7. Save and power-off restart to take effect — the system prompts to write FLASH ROM; confirm, then must power off and restart.
  8. Verify — after effect, search the newly assigned address (e.g. X0) on the signal screen and check against the ladder.

For I/O address mismatch troubleshooting, see FANUC PMC ↔ NC Signal Exchange Abnormal; for address-type itself, see FANUC PMC Address Type Quick Reference: GRD.

10. Common Pitfalls (stop/run switch, missing interlock, scan cycle)

Pit 1: Output goes all 0 when switching stop/run or repowering

Symptom: PMC switches from run to stop, or after repower, Y outputs are all 0. This is a mechanism, not a fault — in the stopped state the sequence program doesn’t execute, so outputs are naturally refreshed to 0. Impact: clamp/brake actions that rely on Y holding may release. Don’t rely on Y self-holding for safety-related hold actions. See FANUC Ladder Y Output All 0 at Power-on.

Pit 2: Software interlock only, ignoring electrical interlock

This is the most dangerous kind. When the software interlock fails (hardware fault, program runaway, online-edit mistake), without a hardwired terminal interlock you get a crash or injury. Principle: have both software interlock and hardwired terminal interlock; never skip the electrical one.

Pit 3: Wrong understanding of the scan cycle

PMC is not real-time; it is a fixed loop: ① input sampling → ② sequential execution → ③ output refresh → ④ immediately back to ①. Typical value 8–32 ms; the exact value must be read from the machine’s diagnostic screen, not guessed. Sampling positions differ: X at ①, Y at ③, F at ①, G at ③, R at ②. Understanding this explains “why did I change R but another place in the same scan still reads the old value.”

Pit 4: Changed the program but behavior didn’t change

Most common cause: JMP/CJMP skipped the section you changed, or the section you changed isn’t inside the current executing END level. “Write succeeded but behavior unchanged” is the easiest to misjudge — the real cause is often not “not written in” but “the written section is never executed.”

Closing

Take these with you:

  • Sequential execution ≠ parallel: rung order decides the result; timing errors are fixed by rung order.
  • Basic instructions act on bits; function instructions act on bytes/words and can’t be drawn as symbols, only as instruction boxes.
  • SET vs ordinary coil is “memory”; SET/RST must be a pair, same address, and the condition must not be sustained.
  • Edge-detect before counting, and have a reset reference.
  • Software interlock + hardwired terminal interlock, both.
  • I/O addresses must be assigned before programming, and restart after changing.

Last sentence: PMC scans sequentially, not in real time. Many “the logic is right but it doesn’t act” problems root in that sentence.

Disclaimer: This article is a personal compilation of field experience. Instruction mnemonics, address-allocation rules, and menu paths follow your machine’s official FANUC PMC programming manual — PMC models and system versions differ. The ladder examples illustrate programming logic only, not downloadable programs. Logic involving magazine, spindle, or guard actions must have dual software/hardware interlocks and pass plant review and simulation.

Zero-base learning entry: PMC Ladder Video Course From Zero.

Related Reading

© 版权声明
THE END
喜欢就支持一下吧
点赞12赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容

广告