/fxplc

Python connector for low-level Mitsubishi PLC MELSEC FX series (FX-232AW) serial protocol

Primary LanguagePython

FXPLC

Python connector for low-level Mitsubishi MELSEC FX series (FX-232AW) serial protocol.

Protocol specification - Link

Note it is not the same as Non-Protocol Communication (or D8120) as described in FX Series Programmable Controllers manuals.

Overview

Python library and CLI utility allow to read and write PLC registers like X0, Y0, S0, T0, M0 and D0.

Example usage

Library

from contextlib import closing
from fxplc import FXPLC

with closing(FXPLC("/dev/ttyUSB0")) as fx:
    s0_state = fx.read_bit("S0")
    t0_state = fx.read_bit("T0")
    t0_value = fx.read_counter("T0")
    
    fx.write_bit("S1", True)

CLI

python cli.py -p dev/ttyUSB0 read_bit S0
python cli.py -p dev/ttyUSB0 read_bit T0
python cli.py -p dev/ttyUSB0 read_counter T0

python cli.py -p dev/ttyUSB0 write_bit S1 on

python cli.py -p dev/ttyUSB0 read S0 T0
# S0 = off
# T0 = on, counter: 30

Compatibility

Tested on:

  • FX1N-06MR (chinese clone)
  • FX1N-20MR (chinese clone)