Professional Documents
Culture Documents
MEWTOCOL format
Master/Slave communication(Half duplex communication)*4
ASCII strings (One frame is up to 118 characters.)*5
MEWTOCOL Capabilities
Here is a list of what this protocol can do.
Read one bit ON/OFF info. (Input, Output, Timer, Counter, Internal relay)
Read 8 mixed bits ON/OFF info. (Input, Output, Timer, Counter, Internal relay)
Read 16 block bits ON/OFF info. (Input, Output, Internal relay)
Read multiple word unit data value (Data, Timer/Counter preset/elapsed value)
Read PLC status (mode, error, version number etc.)
Set one bit ON/OFF (Output, Internal relay)
Set 8 mixed bits ON/OFF (Output, Internal relay)
Set multiple word unit data value (Data, Timer/Counter preset/elapsed value)
MEWTOCOL Procedure
Computer sends a COMMAND to PLC as an ASCII string. Then the PLC automatically
returns the RESPONSE based on the COMMAND. PLC mode (RUN/PROG )does not
effect the response. Input information shall be returned as all 0 in PROG mode.
COMMAND format
RESPONSE format
Check code (BCC) MEWTOCOL uses BCC (Block check code) made by
performing XOR operation on each strings from % to the
last character of text data.
You can use two asterisks** as a substitute for BCC. It
is recommend to use two asterisks instead of BCC if you
want to ignore it.
PLC response always has BCC but you can ignore it.
READ one bit ON/OFF (input, output, timer, counter, internal relay)
COMMAND %01#RCS X 0000 ** Cr
RESPONSE %01$RC 1 BCC Cr
READ up to 8 mixed bits ON/OFF (input, output, timer, counter, internal relay)
COMMAND %01#RCP 4 X0010 T0099 R001A Y0005 ** Cr
RESPONSE %01$RC 1011 BCC Cr
READ Word unit (input, output, internal relay, data, timer/counter set/elapsed value)
COMMAND %01#RCC X0000 0004 ** Cr (to read 5 words from WX0 to WX4)
%01#RCC Y0000 0004 ** Cr (to read 5 words from WY0 to WY4)
%01#RCC R0000 0004 ** Cr (to read 5 words from WR0 to WR4)
%01#RCC L0000 0004 ** Cr (to read 5 words from WL0 to WL4*1)
%01#RS 0005 0008 ** Cr (to read set values of Timer0 to Timer8. *2)
%01#RK 0005 0008 ** Cr (to read elapsed values of Timer0 to Timer8.*2)
*1
These elements are available for the FP3/FP10.
*2
This command is for both timers and counters. Based on the
element number, it is automatically distinguished as either timer
value or counter value.
Command sent to station # 01 and the PLC sets Y0 (output0) to ON (1). The
RESPONSE shall be returned to the computer as an acknowledgment.
Command sent to station # 01 and the PLC sets 3 bits, Y2 OFF(0), R1F
ON(1), Y0 OFF(0). The RESPONSE shall always be returned to the
computer as an acknowledgment.
SET Word unit (output, internal relay, data, timer/counter set/elapsed value)
COMMAND %01#WCC R0000 0002 E803 C800 9CFF ** Cr
start address 1st value 3rd value
end address 2nd value
(to set 3 words from WR0 to WR2)
If several PLCs are connected over a network and you want to set the
same value into the same elements in all the stations then use station
number FF. You will not get the response but you can save time.
In all commands, values should be all expressed in Hex format. The higher
byte and the lower byte of values are all reversed. If you want to send
1234(hex), you have to send 3412.
*3
PLC uses 2s compliment. The MSB is the sign bit.
Example
Read data from DT0 to DT9 (10 words).
Command %01#RDD00000 00009 ** Cr = 20 characters
Response %01$RD ???? ???? ???? ???? ???? ???? ???? ???? ???? ???? ** Cr
= 49 characters.
Baud -rate: 19200 bps
Format: 1 start bit, 8 bit data length, 1 stop bit, Odd parity check bit = 11 bits
Scan time: 5.0 ms
Idle time: 0.3 ms between characters.
Response time =
(20+49)charactersx11 bitsx1000/19200bps + 0.3ms x (20 + 49) characters + 5.0 x (1 to 2)scans =
69 x 11 x 1000 /19200 + 0.3 x 69 + 5.0 x (1 to 2) =
759000/19200 + 20.7 + (5 to 10) =
39.5 + 20.7 + (5 to 10) = 65.2 to 70.2ms
Idle time: Idle time is how long it takes to send the next character one after
another.
BCC calculation
Horizontal parity code to secure the reliability of transmitted data. It is calculated by
performing an XOR operation on each character with the previous result.
Example
%01#RCSX0000 BCC Cr
This is a command to read X0 (input) contact condition.
%01#RCS X0000 1D Cr
ERROR code
An Error code is returned with an exclamation point ! in RESPONSE. The Error code is
expressed in 2 digits in Hexadecimal format.
For more error message refer FP3/FP10SH Computer Communication Unit manual XACG-
M0024.
Program tips
Redundancy
If a PLC on a network is not powered it may corrupt the command from
the computer and you will not receive any response. Make sure your
program sends another command 100 to 150 ms (recommended) after
you sent the previous command. Otherwise even though the other
PLCs are all working, the communication will stop and you will not get
any information from the other working PLCs.
Have your program tell you which station did not respond, this way you can minimize the down
time of your production line.
Wiring
QBASIC can not use 11 bits. Therefore in order to use o,8,1 format, use the following:
When you want to read volume pot one (DT9040), send the following:
40 A$ = %01#RDD0904009040** + CHR$(13)
50 PRINT #1, A$;
This will take the response from the PLC and puts it into R$.
The response will be, for example, %01$RD6400**+ChR$(13) if the volume pot value is
K100. The value in response is in Hex format and the upper 2 digits and lower 2 digits
are reversed.
K255=Hex 00 64
64 00
Repeat instructions
110 GOTO 50