Skip to main content

Panasonic MEWTOCOL Driver

Overview

MEWTOCOL-COM, the ASCII communication protocol of the Panasonic FP series (FP0R / FP-X / FPΣ / FP7). Implemented directly from the frames / commands / device codes / BCC algorithm documented in Panasonic's public user manuals (ARCT1F320, ARCT1F313, etc.). No external GitHub code was borrowed.

ItemValue
opc_typeMEWTOCOL
Implementation classplantpulse.driver.protocol.mewtocol.MEWTOCOLDriver
Library(none — in-house implementation. ARCT1F320)
readGood (RD / RC)
writeGood (WD / WC)
Default port9094 (FP-X / FP7 TCP)
SecurityNone

Classes / Structure

MEWTOCOLDriver (BaseProtocolDriver)
├── Socket / InputStream / OutputStream
├── station — "01" 디폴트, 옵션 station 으로 변경
├── ioLock — synchronized exchange()
├── ParsedAddress.parse() — 디바이스/wordIndex/bitIndex 분해
├── computeBcc(byte[]) — '%' ~ ETX 위치 직전 XOR → 2자리 hex
└── decodeRdResponseHex / encodeWords — 16/32/64-bit

Wire Format Summary

요청 : '%' <station 2> '#' <cmd 2> <data> <BCC 2hex> CR
응답 : '%' <station 2> '$' <cmd 2> <data> <BCC 2hex> CR (정상)
'%' <station 2> '!' <error-2hex> <BCC 2hex> CR (에러)
BCC : '%' 부터 BCC 직전 (= ETX 위치) 까지 XOR
CR : 0x0D (LF 는 무시)

Supported Commands

cmdOperationFormat (data part)
RDWord read (DT/LD/FL/WX/WY/WR)<dev-1char><start-5digits><end-5digits>
RCBit read (single, X/Y/R/L/T/C)RCS<dev-1char><wordAddr4><bit-1hex>
WDWord write<dev><start5><end5><word1 hex 4>...
WCBit write (single)WCS<dev><wordAddr4><bit1><val1>

Word hex follows the manual's rule: the LSB byte comes first (e.g. word 0x1234 → response hex 3412).


OPC Registration Options (options)

KeyMeaningDefault
stationStation number (2 digits)01
connect-timeoutms3000
read-timeoutms3000

normalizeStation() automatically corrects a 1-digit entry ("1") to "01".


Tag Address Formats

NotationMeaning
DT0Data Register 0 (16-bit)
LD100Link Data 100
FL10File Register 10
WX0 / WY0 / WR0I/O / Internal word
R0.5Bit 5 of Internal Relay word 0
R00054 characters = word 3 + bit 1 (= R0.5)
X0.0 / Y0.5Input/Output bit
T0 / C0Timer / Counter (treated as a single bit)

Data Encoding / Decoding

wordCountFor(dt, fmt) determines 16/32/64-bit (1/2/4 words). decodeWords(words, dt, fmt) converts multi-word data into a value:

format / data_typeWord countConversion
DW / Int322(words[1]<<16) | words[0] (low word first), signed
UDW / UInt322unsigned 32
REAL / Float2Float.intBitsToFloat(...)
LREAL / Double4Double.longBitsToDouble(...)
LW / Int644signed 64
(default)1signed 16

Error Code Mapping

decodeError(code) translates the manual's principal errors into readable text (partial list):

codeDescription
20Relay/register number error
21Memory area exceeded
22Latch error
40BCC error (receiving side)
41Format error
42Unsupported command
60Parameter error
66Address error

Supported / Not Supported

  • ✅ RD / WD (N consecutive words)
  • ✅ RC / WC (single bit)
  • ✅ 32 / 64-bit multi-word, Float, Double
  • ❌ RC multiple (RCP — Preset multi)
  • ❌ RT / WT (separate Timer / Counter EV/SV read)
  • ❌ MEWTOCOL-7 / MEWTOCOL-DAT extensions

Test Coverage

test/java/plantpulse/driver/protocol/mewtocol/

ClassTest count
MEWTOCOLDriverTest39

39 tests in total — BCC, frame builder, address parser, RD response decode, WC bit, error mapping.


References

  • Panasonic ARCT1F320 FP-X User Manual MEWTOCOL-COM
  • Panasonic ARCT1F313 FP Series Programming Manual
  • Code: src/plantpulse/driver/protocol/mewtocol/MEWTOCOLDriver.java