PLC Simulator
Mitsubishi cheat sheet

Mitsubishi MELSEC device and instruction cheat sheet

Mitsubishi programs name their data by device type and number: X for inputs, Y for outputs, M for internal relays and so on. The same letters appear in the ladder editor, the instruction list and the manuals. Device numbering and ranges differ between the FX, Q and iQ families, so this sheet gives the device types and the conventions that hold across them.

Device types

Device types
ItemSyntaxMeaning
Input relayX0A physical input point.
Output relayY0A physical output point.
Internal relayM0A general-purpose bit with no terminal.
TimerT0A timer device: a coil starts it and its contact reports it done.
CounterC0A counter device: a coil counts and its contact reports it reached the set value.
Data registerD0A word of data, usually 16 bits.

Constants

Constants
ItemSyntaxMeaning
Decimal constantK1200The number 1200.
Hexadecimal constantH00FFThe hexadecimal number 00FF.

Core instruction list

Core instruction list
ItemSyntaxMeaning
Start a rungLD X0 LDI X0Normally open or normally closed first contact.
Series contactsAND X1 ANI X1Normally open or normally closed contact in series.
Parallel contactsOR X2 ORI X2Normally open or normally closed contact in parallel.
Block joinANB ORBJoin two contact blocks in series or in parallel.
Output, set, resetOUT Y0 SET Y0 RST Y0Follow the rung, latch on, latch off.
Timer and counter coilsOUT T0 K30 OUT C0 K5 RST C0Start a timer with a set value, count with a set value, reset a counter.
Pulse outputsPLS M0 PLF M0One scan on a rising or a falling edge of the rung.
Edge contactsLDP X0 LDF X0A contact that passes for one scan on a rising or falling edge.
Move and compareMOV K1200 D0 CMP K50 D0 M0Copy a value, and compare two values into three result bits.
End of programENDMarks the end of the main program.

FX family special relays

FX family special relays
ItemSyntaxMeaning
RUN monitorM8000On while the CPU is running.
Initial pulseM8002On for the first scan after the CPU goes to run.
One-second clockM8013A clock pulse with a period of one second.

In this browser editor

In this browser editor
ItemSyntaxMeaning
X and Y numberingX0 to X7, X8 to X15Decimal here (byte and bit are n divided by 8 and n modulo 8). Real FX controllers number X and Y in octal and Q and iQ-R controllers in hexadecimal.
Timer unitOUT T0 K30Always 100 ms per K, so K30 is three seconds.
Memory and dataM0 D0M0 maps to the bit %M0.0 and D0 to the word %MW0.

What this sheet leaves out

  • Device ranges and the numbering base of X and Y on each series.
  • Timer ranges other than the common 100 ms and 10 ms ranges.
  • Index registers, file registers and link devices.

Always confirm addresses and ranges against the manual for your exact controller and software version. Want to see these addresses used in logic? Read the Mitsubishi instruction reference.

Frequently asked questions

Are X and Y numbers decimal?

Not on real controllers. The numbering base differs between families, octal on the FX series and hexadecimal on the Q and iQ platforms, so X8 does not exist on an FX and the point after X7 is X10. The browser editor uses plain decimal numbers for simplicity.

What is the difference between K and H constants?

K marks a decimal constant, so K1200 is the number 1200. H marks a hexadecimal constant, so H00FF is 255.

What do M8000 and M8002 do?

On the FX family M8000 is on while the CPU is running and M8002 is on for the first scan after it goes to run, which is how programs run start-up logic once.

Training material. Follow your site procedures, local electrical code and the manufacturer's instructions. Lockout/tagout and a qualified person are required for real equipment.