0
0
FreertosHow-ToBeginner · 4 min read

How to Program Mitsubishi PLC: Step-by-Step Guide

To program a Mitsubishi PLC, use the GX Works2 or GX Works3 software to write ladder logic programs. Connect your PC to the PLC via USB or Ethernet, write your logic using contacts and coils, then compile and download the program to the PLC for execution.
📐

Syntax

Mitsubishi PLC programming mainly uses ladder logic. The basic elements are:

  • Contacts: Represent input conditions (e.g., switches, sensors).
  • Coils: Represent outputs or internal relays.
  • Timers/Counters: Control timing and counting operations.
  • Instructions: Commands like SET, RST, MOV for logic control.

Programs are built by connecting these elements in rungs, which execute from left to right, top to bottom.

ladder logic
LD X0
OUT Y0

// Explanation:
// LD X0: Load input X0 (e.g., a switch)
// OUT Y0: Turn on output Y0 (e.g., a lamp) if X0 is ON
💻

Example

This example turns on an output lamp Y0 when a start button X0 is pressed and turns it off when a stop button X1 is pressed.

ladder logic
LD X0
OUT M0
LD M0
ANDN X1
OUT Y0

// Explanation:
// LD X0: Load start button
// OUT M0: Set internal relay M0
// LD M0: Load M0
// ANDN X1: Ensure stop button is NOT pressed
// OUT Y0: Turn on lamp output
Output
When X0 is ON and X1 is OFF, Y0 turns ON; when X1 is ON, Y0 turns OFF.
⚠️

Common Pitfalls

  • Forgetting to set the correct PLC model in the software causes communication errors.
  • Not connecting the PC and PLC properly (wrong cable or port) prevents program download.
  • Using incorrect addresses for inputs/outputs leads to unexpected behavior.
  • Not compiling the program before downloading causes errors.
  • Ignoring safety interlocks in logic can cause dangerous machine operation.
ladder logic
Wrong way:
LD X0
OUT Y1  // Using wrong output address

Right way:
LD X0
OUT Y0  // Correct output address
📊

Quick Reference

ElementDescriptionExample
LDLoad input or conditionLD X0
OUTOutput coil or relayOUT Y0
ANDLogical AND with next conditionAND X1
ORLogical OR with next conditionOR X2
SETSet a latch relaySET M0
RSTReset a latch relayRST M0
TIMTimer instructionTIM T0 K100
CNTCounter instructionCNT C0 K10

Key Takeaways

Use GX Works2 or GX Works3 software to write and download Mitsubishi PLC programs.
Write ladder logic using contacts (inputs) and coils (outputs) connected in rungs.
Always verify PLC model and communication settings before downloading programs.
Test logic with simple start/stop examples before complex automation.
Avoid common mistakes like wrong addresses and missing compilation.