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.
| Item | Value |
|---|---|
opc_type | MEWTOCOL |
| Implementation class | plantpulse.driver.protocol.mewtocol.MEWTOCOLDriver |
| Library | (none — in-house implementation. ARCT1F320) |
| read | Good (RD / RC) |
| write | Good (WD / WC) |
| Default port | 9094 (FP-X / FP7 TCP) |
| Security | None |
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
| cmd | Operation | Format (data part) |
|---|---|---|
RD | Word read (DT/LD/FL/WX/WY/WR) | <dev-1char><start-5digits><end-5digits> |
RC | Bit read (single, X/Y/R/L/T/C) | RCS<dev-1char><wordAddr4><bit-1hex> |
WD | Word write | <dev><start5><end5><word1 hex 4>... |
WC | Bit 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)
| Key | Meaning | Default |
|---|---|---|
station | Station number (2 digits) | 01 |
connect-timeout | ms | 3000 |
read-timeout | ms | 3000 |
normalizeStation() automatically corrects a 1-digit entry ("1") to "01".
Tag Address Formats
| Notation | Meaning |
|---|---|
DT0 | Data Register 0 (16-bit) |
LD100 | Link Data 100 |
FL10 | File Register 10 |
WX0 / WY0 / WR0 | I/O / Internal word |
R0.5 | Bit 5 of Internal Relay word 0 |
R0005 | 4 characters = word 3 + bit 1 (= R0.5) |
X0.0 / Y0.5 | Input/Output bit |
T0 / C0 | Timer / 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_type | Word count | Conversion |
|---|---|---|
DW / Int32 | 2 | (words[1]<<16) | words[0] (low word first), signed |
UDW / UInt32 | 2 | unsigned 32 |
REAL / Float | 2 | Float.intBitsToFloat(...) |
LREAL / Double | 4 | Double.longBitsToDouble(...) |
LW / Int64 | 4 | signed 64 |
| (default) | 1 | signed 16 |
Error Code Mapping
decodeError(code) translates the manual's principal errors into readable text (partial list):
| code | Description |
|---|---|
20 | Relay/register number error |
21 | Memory area exceeded |
22 | Latch error |
40 | BCC error (receiving side) |
41 | Format error |
42 | Unsupported command |
60 | Parameter error |
66 | Address 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/
| Class | Test count |
|---|---|
MEWTOCOLDriverTest | 39 |
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