, and
rized in the table below. Some of the commands are the same as for different PLCs, with increased operands and operand
number ranges.
MICRO
3
C
are summa-
Command NameMicroSmartONCMICRO
Write User Program in ASCII Format
Write User Program in Binary Format
Read User Program in ASCII Format
Read User Program in Binary Format
Write N Bytes
3
CMICRO
XXXX
XXXX
XXXX
XXXX
XXXX
3
Read N Bytes (Note)XXXX
Write 1 Bit
Read 1 Bit
Read High-speed Counter Preset and Current Values
Read Error Code
Clear Operand Data
Enable/Disable User Program Protection
Read PLC Operating Status
Read Scan Time
Read PLC System Program Version
Read User Communication Transmit/Receive Buffer
XXXX
XXXX
XXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XX
Clear and Start User Communication Data Monitor
Read User Communication Status
XX
Read Communication Mode
Select Word Operands for Monitor
Monitor Selected Word Operands
Read Timer Information
Read Counter Information
Read Timer Preset Value Change Status
Read Counter Preset Value Change Status
XX
XX
XX
XX
Read FUN Area Settings
Read Random Words
Read Timeout Status
Read Countout Status
Confirm Changed Timer/Counter Preset Values
X
Note: When timer/counter preset or current values are read out from the MicroSmart using the read N bytes command, the
result is different from that read from the MICRO
3
because the MicroSmart has different timer and counter internal codes to
enable 16-bit timers and counters. The MicroSmart has new commands for timers and counters; Read Timeout Status and
Read Countout Status.
ICROSMART
M
1
M
ICRO
S
MART
C
OMMUNICATION
P
ROTOCOL
Communication Procedure
The computer and the
which consist of request messages and reply messages. The request message is sent from the computer to write data to,
read or clear data from the
from the computer.
Communication is always initiated by the computer by sending a request message to the
reply message to the computer. The
can initiate communication using the user communication function.
Smart
MicroSmart
Computer
CPU module communicate data by sending and receiving communication messages,
MicroSmart
MicroSmart
. The reply message is sent from the
cannot initiate communication in the computer link system. The
Request Message
Reply Message
MicroSmart
in response to the request message
MicroSmart
, which then returns a
MicroSmart
CPU Module
Micro-
Message Format
Communication
Message
(1)(2)(3)(4)(5)
BCC (Block Check Character) Calculation Range
(1)
(2)
(3)
(4)
(5)
Communication
control
character
(1 byte)
Communication
device number
(2 bytes)
Data
(variable length)
BCC
(2 bytes)
Terminator
(1 byte)
Message start
character
Device number to
send request to
Device number to
send reply from
Communication
command,
data type, etc.
Block check
character
Message
end code
ENQ (05h)EnquiryRequest message
ACK (06h)
NAK (15h)
00 (0)
through
1F (31)
FF (255)
00 (0)
through
1F (31)
Depends on each command.
See “Request Messages” on page 3.
See “Reply Messages” on page 5.
Exclusive OR (XOR) of the BCC calculation range.
CR (0Dh)Default
Acknowledge
Negative acknowledge
Designates a PLC device number to which the computer sends a request message in the 1:N communication computer link system.
Used in the 1:1 communication computer link system.
PLC of any device number receives request message.
Indicates the device number of the PLC which returns
the reply message.
Reply message
M
ICRO
S
MART
2
M
ICRO
S
MART
C
OMMUNICATION
P
ROTOCOL
Request Messages
ONC
Like the
MICRO
or
structures.
Request Message 1
Request message 1 is a command message to be sent from the computer to the PLC, containing a command. The data type
code included in the request message determines the function. The data structure of request message 1 is shown below.
Request
Message 1
(1)
(2)
(3)
(4)
Continuation
(1 byte)
Command
(1 byte)
Data type
(1 byte)
Data
(variable length)
3
, request messages are available in request message 1 and request message 2 with different data
ENQ
Device(2)(4)(3)05h(1)BCC
0 (30h)Discontinued (no message follows)
1 (31h)Continued (another message follows)
W (57h)Write data to PLC
R (52h)Read data from PLC
C (43h)Clear data from PLC
X (58h)
Y (59h)Output
M (4Dh)Internal relay
R (52h)Shift registerD (44h)Data register
T (54h)
C (43h)
E (45h)Error code (read/clear)
I (49h)Link formatting sequence (clear)
K (4Bh)Scan time (read)
N (4Eh)PLC system program version (read)
P (50h)User program in ASCII format (read/write)
Q (51h)Changed timer/counter preset values (write)
S (53h)PLC operating status (read)
V (56h)User program protection
W (57h)Calendar/clock (read/write)
Z (5Ah)System reset (clear)
_ (5Fh)Timer information (read)
` (60h)Counter information (read)
a (61h)Timer preset value change status (read)
b (62h)Counter preset value change status (read)
d (64h)Timer timeout status (read)
e (65h)Counter countout status (read)
p (70h)User program in binary format (read/write)
Data (depends on command and data type)
Input
Timer
(preset value)
Counter
(preset value)
N-byte
designation
t (74h)
c (63h)
x (78h)Input
y (79h)Output
m (6Dh)Internal relay
r (72h)Shift register
Timer
(current value)
Counter
(current value)
Termi-
nator
N-byte
designation
1-bit
designation
(1)
“Continued” is used in request message 1 for writing the user program to inform the PLC that another request message
will be sent successively. In all other request messages, “discontinued” is used. When “continued” is specified, the
computer sends a request message, receives a reply message, and sends another request message.
(2)
The command code is available in three types; write data, read data, and clear data.
(3)
The data type code selects an operand or function. Upper- and lower-case characters have different functions.
The data specifies the operand number, the quantity of bytes of the data for reading or writing, etc. depending on the
(4)
command and data type.
ICRO
MART
M
S
3
M
ICRO
S
MART
C
OMMUNICATION
P
ROTOCOL
Request Message 2
Request message 2 is a command message used for writing and reading user programs. The data structure of request message 2 is shown below:
Request
Message 2
(1)
(2)
(1)
“Discontinued” is used for both writing and reading user programs to inform the PLC that no request message will be
sent successively.
(2)
The data length is variable for writing user programs and is 1-byte long (“R”) for reading user programs.
ENQ
Device(2)05h(1)BCC
Continuation
(1 byte)
Data
(variable length)
Data
(1 byte)
0 (30h)Discontinued (no message follows)
User program (write user program)
R (52h)Read user program
Termi-
nator
Receive Timeout
When a request message contains an interval of 500 msec or more between onebyte character data and the next one-byte character data, the PLC understands that
the communication is canceled and does not return a reply message.
When the interval is 500 msec or more, extend the receive timeout value using
WindLDR
. The receive timeout can be selected between 10 and 2540 msec in 10msec increments. To enable the optional communication mode, turn on the mode
selection input designated on the Communication Parameters page in
T o access the Communication P arameters page from the
WindLDR
WindLDR
.
menu bar, select Configure > Function Area Settings.
In the Function Area Setting dialog box, click the Communication tab, and select Maintenance Protocol in the Port 1 or
2 pull-down list.
Click the Configure button. The Communication Parameters dialog box appears. Change settings, if required.
Baud Rate (bps)1200, 2400, 4800, 9600, 19200
Data Bits7 or 8
ParityNone, Odd, Even
Stop Bits1 or 2
10 to 2540 (10-msec increments)
Receive Timeout (ms)
Device Number0 to 31
Mode Selection InputAny input number
(Receive timeout is disabled when 2550
is selected.)
DataData
≤ 500 msec
Note: Only when the mode selection input is turned on, the selected communication parameters are enabled.
Otherwise, default communication parameters take effect; 9600 bps, 7 data bits, even parity, 1 stop bit,
receive timeout 500 msec.
For details, see the MicroSmart User’s Manual EM342, page 25-2.
ICRO
MART
M
S
4
M
ICROSMART COMMUNICATION PROTOCOL
Reply Messages
Reply messages are available in ACK reply message and NAK reply message with different data structures.
ACK Reply Message
The ACK reply message is a reply or response to the request message and is sent from the PLC to the computer when communication is completed normally.
ACK
Reply
Message
(1)
(2)
ACK
Device(2)06h(1)BCC
0 (30h)OK: DiscontinuedAll communication is completed normally (end of processing).
Communication in reply to request is completed normally and
another reply message follows when reading a user program.
Communication device number, command, data type, data, or continuation code is not within the range supported by the PLC or
does not match its status. When this error occurs, communication
is halted without regard to the continuation code.
The data length depends on the request
command (variable length).
Command
(1 byte)
1 (31h)OK: Continued
2 (32h)NG: Error
OK
reply
When request command is W or CNo data exists. (0 byte)
When request command is R
NG code (2 bytes)
Data
(variable
length)
0 (30h)
to
9 (39h)
or
A (41h)
to
F (46h)
NG
reply
NG
Code
Program size errorImproper write/read program size
01
Protect errorProtected against write/read in the PLC
02
RUN errorWriting user program is attempted while the PLC
03
CRC errorUser program CRC code does not match
04
Protect code errorProtect code in the request message does not
05
Data range errorInvalid data range designated
06
Timer/counter preset
07
value change error
Calendar/clock data error Invalid value written to calendar/clock
08
Data clear errorDesignated data cannot be cleared
09
Data errorInvalid data other than 0 (30h) - 9 (39h) or
10
Setting errorIncorrect setting for user communication
11
CPU module type code
12
error
ErrorCause
is running
match that set in the PLC. Attempt was made to
enable protection on a protected user program.
Preset value change is attempted to timer or
counter with preset value designated by data register
A (41h) - F (46h)
CPU module type code in the request message
does not match the connected PLC.
Termi-
nator
(1)
The command code indicates whether the request command is completed normally or not and also whether another
reply message will be sent successively.
When reading a user program from the PLC, reply message 1 is returned in response to request message 1 and reply
message 2 is returned in response to request message 2. Reply message 1 contains command 1 (OK: continued) to
inform the computer that another reply message follows. All other reply messages contain command 0 (OK: discontinued) to indicate that no reply message follows when communication is completed normally.
When an OK reply is returned in response to request command R (read data), the read data is included in this place.
(2)
When an NG reply is returned, the cause of error exists in the PLC. See page 47.
ICROSMART
M
5
M
ICROSMART COMMUNICATION PROTOCOL
NAK Reply Message
When an error is found during communication, a NAK reply message is sent from the PLC to the computer.
NAK
Reply
Message
NAK
Device15h(1)(2)BCC
Termi-
nator
(1)Command0 (no meaning): dummy data for consistent communication format
Depending on the communication error, an error code is set in this place.
(2)
Communication
error code
(2 bytes)
Error
Code
00
01
02
03
04
BCC errorAppended BCC code does not match BCC calculated
Frame errorQuantity of received bits differs from the preset
Data send/receive errorParity error or overrun error occurred.
Command errorUnsupported request message is received.
Procedure/data quantity errorReceived request message does not match the
Error TypeError Contents
value of received data.
value (stop bit is 0 for example).
expected data (including quantity of data).
(1) The command code in the NAK reply message is always 0.
(2) The next two bytes indicate the communication error code.
M
ICROSMART
6
M
ICROSMART COMMUNICATION PROTOCOL
Write User Program in ASCII Format
The user program can be written from a computer to the PLC. When transferring a user program through modem, this
command is recommended to transfer the user program in ASCII format because modems understand ASCII codes.
When writing a user program from a computer, two request messages must be sent to the PLC.
Send request message 1 first. After confirming that the returned reply message is an OK reply, send request message 2.
Request Messages (Write User Program in ASCII Format)
Request Message 1
**05h
**57h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(3)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte1 (31h)Continued
Command1 byteW (57h)Write data
Data type1 byteP (50h)User program in ASCII format
CPU module type code1 byte
Program capacity8 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
50h
(5)
3*h
(6)
** ** **
****
** ** ** **
(7)
00 - 1F
FF
0 (30h)
1 (31h)
2 (32h)
3 (33h)
4 (34h)
6 (36h)
0000 0000
:
FFFF FFFF
(8)
**31h
0Dh
(9)
Device number 0 through 31
Device number 255 (all devices)
User program includes data of rung
comments and tag comments plus
function area settings. The function
area occupies 94 bytes.
Request Message 2
**05h
**** ** ** ****30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
Note: The user program must be stored in a file of the ASCII code format. Ladder program files (.LDR) cannot be sent to the
PLC using this request message.
(3)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
User program
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
** **** **
(4)
Variable length
64,336 bytes max.
(5)
**
0Dh
(6)
00 - 1F
FF
0 (30h) - 9 (39h)
A (41h) - F (46h)
Device number 0 through 31
Device number 255 (all devices)
User program (ASCII code file)
M
ICROSMART
7
Reply Messages (Write User Program in ASCII Format)
OK Reply (Reply to Request Messages 1 and 2)
**06h
****
(1)(2)
(1)
(2)
(3)
(4)
(5)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte0 (30h)OK: Discontinued
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
NG Reply (Reply to Request Message 1)
**06h
**30h
32h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte2 (32h)NG
NG code2 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
Program capacity error
Protect error
RUN error
CRC error
CPU module type code error
Note: NG reply never occurs in response to reply message 2.
M
ICROSMART
8
M
ICROSMART COMMUNICATION PROTOCOL
Write User Program in Binary Format
The user program can be written from a computer to the PLC. This command can send a user program faster than the
Write User Program in ASCII format command.
When writing a user program from a computer, two request messages must be sent to the PLC.
Send request message 1 first. After confirming that the returned reply message is an OK reply, send request message 2.
Request Messages (Write User Program in Binary Format)
Request Message 1
**05h
**57h
31h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(3)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte1 (31h)Continued
Command1 byteW (57h)Write data
Data type1 bytep (70h)User program in binary format
CPU module type code1 byte
Program capacity8 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
70h
(5)
3*h
(6)
** ** **
****
** ** ** **
(7)
00 - 1F
FF
0 (30h)
1 (31h)
2 (32h)
3 (33h)
4 (34h)
6 (36h)
0000 0000
:
FFFF FFFF
** 0Dh
(8)
(9)
Device number 0 through 31
Device number 255 (all devices)
User program includes data of rung
comments and tag comments plus
function area settings. The function
area occupies 94 bytes.
Request Message 2
**05h
**** ** ** ****30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
Note: The user program must be stored in a file of the binary code format. Ladder program files (.LDR) cannot be sent to the
PLC using this request message.
(3)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
User program
BCC2 bytes00 - FFBlock check character
Terminator1 byteCR (0Dh)Message end code
** **** **
(4)
Variable length
32,168 bytes max.
(5)
**
0Dh
(6)
00 - 1F
FF
(00h) - (FFh)User program (binary code file)
Device number 0 through 31
Device number 255 (all devices)
M
ICROSMART
9
Reply Messages (Write User Program in Binary Format)
OK Reply (Reply to Request Messages 1 and 2)
**06h
****
(1)(2)
(1)
(2)
(3)
(4)
(5)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte0 (30h)OK: Discontinued
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
NG Reply (Reply to Request Message 1)
**06h
**30h
32h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte2 (32h)NG
NG code2 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
Program capacity error
Protect error
RUN error
CRC error
CPU module type code error
Note: NG reply never occurs in response to reply message 2.
M
ICROSMART
10
M
ICROSMART COMMUNICATION PROTOCOL
Read User Program in ASCII Format
The user program can be read from the PLC to a computer.
When reading a user program to a computer, two request messages must be sent from the computer to the PLC.
Send request message 1 first. After confirming that the returned reply message is an OK reply, send request message 2.
Specify a value larger than the user program capacity selected in the PLC in place of the program capacity in request mes-
sage 1. Reserve a buffer in the computer to store the data of the specified program capacity temporarily.
Request Messages (Read User Program in ASCII Format)
Request Message 1
**05h
**52h
31h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(3)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte1 (31h)Continued
Command1 byteR (52h)Read data
Data type1 byteP (50h)User program in ASCII format
CPU module type code1 byte
Program capacity8 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
50h
(5)
3*h
(6)
** ** **
****
** ** ** **
(7)
00 - 1F
FF
0 (30h)
1 (31h)
2 (32h)
3 (33h)
4 (34h)
6 (36h)
0000 0000
:
FFFF FFFF
** 0Dh
(8)
(9)
Device number 0 through 31
Device number 255 (all devices)
User program includes data of rung
comments and tag comments plus
function area settings. The function
area occupies 94 bytes.
Request Message 2
**05h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
(4)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteR (52h)Read data
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
**
**52h
0Dh
(5)
(6)
M
ICROSMART
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
11
Reply Messages (Read User Program in ASCII Format)
OK Reply
• Reply Message 1
**06h
** 31h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte1 (31h)OK: Continued
CPU module type code1 byte
Program capacity8 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
User program includes data of rung
comments and tag comments plus
function area settings. The function
area occupies 94 bytes.
• Reply Message 2
**06h
**** ** ** ****30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte0 (30h)OK: Discontinued
User program
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
** **** **
(4)
Variable length
64,336 bytes max.
(5)
**
0Dh
(6)
0 (30h) - 9 (39h)
A (41h) - F (46h)
Note: The received user program is stored on the disk in the ASCII code format.
NG Reply (Reply to Request Message 1)
**06h
**30h
32h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte2 (32h)NG
NG code2 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
**
**3*h0Dh
(5)
(6)
01 (30h 31h)
02 (30h 32h)
04 (30h 34h)
User program (ASCII code file)
Program capacity error
Protect error
CRC error
Note: NG reply never occurs in response to reply message 2.
M
ICROSMART
12
M
ICROSMART COMMUNICATION PROTOCOL
Read User Program in Binary Format
The user program can be read from the PLC to a computer.
When reading a user program to a computer, two request messages must be sent from the computer to the PLC.
Send request message 1 first. After confirming that the returned reply message is an OK reply, send request message 2.
Specify a value larger than the user program capacity selected in the PLC in place of the program capacity in request mes-
sage 1. Reserve a buffer in the computer to store the data of the specified program capacity temporarily.
Request Messages (Read User Program in Binary Format)
Request Message 1
**52h
31h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte1 (31h)Continued
(3)
Command1 byteR (52h)Read data
(4)
Data type1 bytep (70h)User program in binary format
(5)
CPU module type code1 byte
(6)
Program capacity8 bytes
(7)
BCC2 bytes00 - 7FBlock check character
(8)
Terminator1 byteCR (0Dh)Message end code
(9)
(3)
(4)
Request Message 2
70h
(5)
3*h
(6)
** ** **
****
** ** ** ****05h
(7)
00 - 1F
FF
0 (30h)
1 (31h)
2 (32h)
3 (33h)
4 (34h)
6 (36h)
0000 0000
:
FFFF FFFF
** 0Dh
(8)
(9)
Device number 0 through 31
Device number 255 (all devices)
User program includes data of rung
comments and tag comments plus
function area settings. The function
area occupies 94 bytes.
**05h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteR (52h)Read data
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
**
**52h
0Dh
(5)
(6)
M
ICROSMART
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
13
Reply Messages (Read User Program in Binary Format)
OK Reply
• Reply Message 1
**06h
** 31h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte1 (31h)OK: Continued
CPU module type code1 byte
Program capacity8 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
User program includes data of rung
comments and tag comments plus
function area settings. The function
area occupies 94 bytes.
• Reply Message 2
**06h
**** ** ** ****30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte0 (30h)OK: Discontinued
User program
BCC2 bytes00 - FFBlock check character
Terminator1 byteCR (0Dh)Message end code
** **** **
(4)
Variable length
32,168 bytes max.
(5)
**
0Dh
(6)
(00h) - (FFh)User program (binary code file)
Note: The received user program is stored on the disk in the binary code format.
NG Reply (Reply to Request Message 1)
**06h
**30h
32h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte2 (32h)NG
NG code2 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
**
**3*h0Dh
(5)
(6)
01 (30h 31h)
02 (30h 32h)
04 (30h 34h)
Program capacity error
Protect error
CRC error
Note: NG reply never occurs in response to reply message 2.
M
ICROSMART
14
M
Calendar/clock
operand number
Data
0000
0001
0002
0003
0004
0005
0006
Year
Month
Day
Day of week
Hour
Minute
Second
ICROSMART COMMUNICATION PROTOCOL
Write N Bytes
Data can be written into N-bytes of operands starting with the specified operand number in the PLC.
This command can be used to turn on or off bit operands such as inputs, outputs, internal relays, and shift register bits in
units of 8 bits.
This command can also be used to change timer and counter preset values, enter data into data registers, and set calendar/
clock data.
Request Message (Write N Bytes)
**05h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
******30h
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteW (57h)Write data
Data type1 byteSee table below.N-byte designation
Operand number4 bytesSee table below.First operand number to write to
Data length (n)2 bytes00 - C8
Data
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(3)
57h
(4)
(5)
** ** **
(6)
****
**
**
(7)
2n bytes
1 ≤ n ≤ 200
** **** **
(8)
Data for 1-byte operand after ASCII conversion
00 - 1F
FF
0 (30h) - 9 (39h)
A (41h) - F (46h)
**
0Dh
(9)
(10)
Device number 0 through 31
Device number 255 (all devices)
Byte count of data to write
200 (C8h) bytes maximum
Data to write
X (58h)
Y (59h)
M (4Dh)
R (52h)
T (54h)
t (74h)
C (43h)
c (63h)
D (44h)
W (57h)
Note: The valid operand range depends on the CPU module type. For details, see page 48.
Operand numbers for calendar and clock are allocated as listed on the right:
When the range specified by the data type and data length is invalid, the PLC
returns an NG reply.
When a data register is designated as a preset value for a timer or counter, data
cannot be written into the preset value. To change the preset value, write data
into the data register designated as a preset value.
(5) Data type code(6) Operand number (Note)Remarks
The least significant digit of the operand number is an octal number (0-7).
Upper digits are decimal numbers.
All four digits of the operand number
are decimal numbers.
15
Reply Messages (Write N Bytes)
OK Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
BCC2 bytes00 - 7FBlock check character
(4)
Terminator1 byteCR (0Dh)Message end code
(5)
NG Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
****
(3)
**30h
32h
(3)
(4)
(4)
**30h
0Dh
(5)
**
**3*h0Dh
(5)
(6)
M
ICROSMART COMMUNICATION PROTOCOL
06 (30h 36h)
07 (30h 37h)
08 (30h 38h)
Data range error
Timer/counter preset value change error
Calendar/clock data error
Data Format in the Request Message (Write N Bytes)
X (Input), Y (Output), M (Internal Relay), and R (Shift Register)
To write ON/OFF statuses of bit operands such as inputs, outputs, internal relays, or shift registers, divide the operand
numbers into 8-bit (1-byte) groups, and convert the 8-bit value into a hexadecimal value. Then, convert the hexadecimal
value into ASCII codes. Include the ASCII codes in place of “Data” in the request message.
Example: To write data to outputs Q0 through Q17 to set Q5, Q7, Q12, and Q15 and reset other outputs.
Q7Q0
10100000
A0h
In this example, convert the hexadecimal value A024 into ASCII codes, and include the results (41h 30h 32h 34h) in the
request message. Consequently, the data to send has a length of 4 bytes in the request message.
The data length to write in this example is 16 bits, or 2 (02h) bytes, of output points. So, include ASCII codes 30h 32h in
place of “Data length” in the request message.
Q17Q10
00100100
24h
M
ICROSMART
16
M
ICROSMART COMMUNICATION PROTOCOL
T (Timer Preset Value) and C (Counter Preset Value)
To write data into word operands such as timers and counters, convert the hexadecimal values into ASCII codes. Include
the ASCII codes in place of “Data” in the request message.
Example: To write decimal 987 and 36000 to preset values for timers T0 and T1, respectively.
T0
0987
T1
36000
In this example, conv ert the decimal v alues into hexadecimal values and send
data 03DB8CA0 (30h 33h 44h 42h 38h 43h 41h 30h).
03DBh8CA0h
The data length of this example is 2 words, or 4 (04h) bytes. So, include ASCII codes 30h 34h in place of “Data length” in
the request message.
Since the MicroSmart uses separate memory areas for timers and counters, timer and counter preset values are written into
the specified operand number in different memory areas.
D (Data Register)
To write data into word operands of data registers, convert the hexadecimal values into ASCII codes. Include the ASCII
codes in place of “Data” in the request message.
Example: To write 123Bh and 4567h to data registers D0 and D1, respectively.
D0
123Bh
D1
4567h
In this example, send data 123B4567 (31h 32h 33h 42h 34h 35h 36h 37h).
The data length of this example is 2 words, or 4 (04h) bytes. So, include ASCII codes 30h 34h in place of “Data length” in
the request message.
W (Calendar/Clock)
T o send calendar/clock operands such as year, month, day , day of week, hour, minute, and second, write each one-word (2
bytes) data directly.
Day of week data format (0 through 6) is assigned as follows:
Example: To send calendar/clock data Monday, January 1, 2001, 13 hour, 24 minutes, 56 seconds.
Year
01
00010001
Month
January
Day
1
0001
Day of week
Monday
0001
Hour
13
0013
Minute
24
0024
Second
56
0056
In this example, send data 0001000100010001001300240056 (30h 30h 30h 31h 30h 30h 30h 31h 30h 30h 30h 31h 30h
30h 30h 31h 30h 30h 31h 33h 30h 30h 32h 34h 30h 30h 35h 36h).
The data length of this example is 7 words, or 14 (0Eh) bytes. So, include ASCII codes 30h 3Eh in place of “Data length”
in the request message.
M
ICROSMART
17
M
ICROSMART COMMUNICATION PROTOCOL
Read N Bytes
Data can be read from N-bytes of operands starting with the specified operand number in the PLC.
This command can be used to monitor the ON/OFF statuses of bit operands such as inputs, outputs, internal relays, and
shift register bits in units of 8 bits.
This command can also be used to monitor preset and current values of timers and counters, data of data registers, and read
calendar/clock data.
Request Message (Read N Bytes)
**05h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(3)
(4)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteR (52h)Read data
Data type1 byteSee table below.N-byte designation
Operand number4 bytesSee table below.First operand number to read
Data length (n)2 bytes00 - C8
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(5)
** ** **
(6)
****
**
**
**0Dh
(7)
**52h
(8)
(9)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
Byte count of data to read
200 (C8h) bytes maximum
(5) Data type code(6) Operand number (Note)Remarks
X (58h)
Y (59h)
M (4Dh)
R (52h)
T (54h)
t (74h)
C (43h)
c (63h)
D (44h)
W (57h)
Note: The valid operand range depends on the CPU module type. For details, see page 48.
The least significant digit of the operand number is an octal number (0-7).
Upper digits are decimal numbers.
All four digits of the operand number
are decimal numbers.
Operand numbers for calendar and clock are allocated as listed on the right:
operand number
The internal relay memory area is divided into the ordinary internal relays and
special internal relays. N-byte data cannot be read from the internal relay area
continuing from the ordinary internal relays through special internal relays.
When the range specified by the data type and data length is invalid, the PLC
returns an NG reply.
When a preset value is read from a timer or counter for which a data register is
designated as a preset value, the preset value is returned as a reply, rather than
the data register number.
Calendar/clock
0000
0001
0002
0003
0004
0005
0006
Data
Year
Month
Day
Day of week
Hour
Minute
Second
M
ICROSMART
18
Reply Messages (Read N Bytes)
OK Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
Data
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
NG Reply
**06h
(1)(2)
******30h
**30h
** ** ** **
(3)
32h
(4)
(3)
Data for 1-byte operand in ASCII format
**
**3*h0Dh
(5)
(6)
** **** **
(4)
2n bytes
1 ≤ n ≤ 200
M
ICROSMART COMMUNICATION PROTOCOL
**
0Dh
(5)
(6)
0 (30h) - 9 (39h)
A (41h) - F (46h)
Read data
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
06 (30h 36h)
08 (30h 38h)
Data range error
Calendar/clock data error
Data Format in the Reply Message (Read N Bytes)
X (Input), Y (Output), M (Internal Relay), and R (Shift Register)
When reading ON/OFF statuses of bit operands such as inputs, outputs, internal relays, or shift registers, the received data
shows the hexadecimal value of 8-bit groups.
Example: The read data is 02C4 (30h 32h 43h 34h) when reading 2 bytes starting with internal relay M0.
02h
00000010
M7M0
11000100
M17M10
Divide the read data into one-byte (8-bit) groups. The bits where a 1 is stored are ON. In this example, internal relays M1,
M12, M16, and M17 are on.
C4h
M
ICROSMART
19
M
ICROSMART COMMUNICATION PROTOCOL
T (Timer Preset Value), t (Timer Current Value), C (Counter Preset Value), and c (Counter Current Value)
The Read N Bytes command can be used to read preset or current values of consecutive timers or counters. When reading
timer/counter preset or current values, the received data show the hexadecimal values in four characters each.
Example: The read data is EA602710 (45h 41h 36h 30h 32h 37h 31h 30h) when reading 4 bytes of timer current values
starting with timer T10.
Divide the received data into 4-character groups and convert the data into 4-
EA60h2710h
digit hexadecimal values. In this example, the read data is shown below:
T10 = EA60h (60000 decimal)
T10T11
T11 = 2710h (10000 decimal)
To read preset, current values, and timer status of timers, use the Read Timer Information command (see page 36).
To read preset, current values, and counter status of counter, use the Read Counter Information command (see page 38).
D (Data Register)
When reading data registers, the received data show the hexadecimal values in four characters each.
Example: The read data is C7380100 (43h 37h 33h 38h 30h 31h 30h 30h) when reading 4 bytes starting with data register
D27.
Divide the received data into 4-character groups and convert the data into 4-
C738h0100h
digit hexadecimal values. In this example, the read data is shown below:
D27 = C738h (51000 decimal)
D27D28
D28 = 100h (256 decimal)
W (Calendar/Clock)
Calendar/clock data are received in units of 2 bytes starting with the specified operand number 0000 (year) through 0006
(second). For operand numbers for the calendar and clock, see page 18.
Day of week data format (0 through 6) is assigned as follows:
Example: The read data is 000200200059 (30h 30h 30h 32h 30h 30h 32h 30h 30h 30h 35h 39h) when reading 6 bytes (3
words) starting with operand number 0003 (day of week) for reading calendar/clock values.
Divide the received data into 4-character groups and convert
the data into 4-digit hexadecimal values.
0002h
0020h0059h
Data of three operands starting with 0003 (day of week) is
read as shown on the right.
2 = Tuesday
20 hours59 minutes
M
ICROSMART
20
M
ICROSMART COMMUNICATION PROTOCOL
Write 1 Bit
Data can be written into 1 bit of the specified operand in the PLC, enabling to set (ON) or reset (OFF) the operand.
The PLC operation can be started or stopped by setting or resetting start control special internal relay M8000 using this
request message.
Request Message (Write 1 Bit)
**05h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(3)
(4)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteW (57h)Write data
Data type1 byteSee table below.1-bit designation
Operand number4 bytesSee table below.Operand number to write to
ON/OFF status1 byte
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(5)
** ** **
(6)
****
3*h
(7)
**
**57h
0Dh
(8)
(9)
00 - 1F
FF
0 (30h)
1 (31h)
Device number 0 through 31
Device number 255 (all devices)
OFF
ON
(5) Data type code(6) Operand number (Note)Remarks
x (78h)
y (79h)
m (6Dh)
r (72h)Shift register0000 - 0127
Note: The valid operand range depends on the CPU module type. For details, see page 48.
Input
Output
Internal relay
0000 - 0307
0000 - 0307
0000 - 1277, 8000 - 8077
The least significant digit of the operand number is an octal number (0-7).
Upper digits are decimal numbers.
All four digits of the operand number
are decimal numbers.
M
ICROSMART
21
Reply Messages (Write 1 Bit)
OK Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
BCC2 bytes00 - 7FBlock check character
(4)
Terminator1 byteCR (0Dh)Message end code
(5)
NG Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes06 (30h 36h)Data range error
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
****
(3)
**30h
32h
(3)
(4)
(4)
**30h
0Dh
(5)
**
**36h0Dh
(5)
(6)
M
ICROSMART COMMUNICATION PROTOCOL
M
ICROSMART
22
M
ICROSMART COMMUNICATION PROTOCOL
Read 1 Bit
Data can be read from 1 bit of the specified operand in the PLC to see if the operand is on or off.
The read 1 bit command can be used to monitor the ON/OFF status of a bit operand such as input, output, internal relay, or
shift register bit.
Request Message (Read 1 Bit)
**05h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(3)
(4)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteR (52h)Read data
Data type1 byteSee table below.1-bit designation
Operand number4 bytesSee table below.Operand number to read from
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(5)
** ** **
(6)
**
(7)
**52h
0Dh
(8)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
****
(5) Data type code(6) Operand number (Note)Remarks
x (78h)
y (79h)
m (6Dh)
r (72h)Shift register0000 - 0127
Note: The valid operand range depends on the CPU module type. For details, see page 48.
Input
Output
Internal relay
0000 - 0307
0000 - 0307
0000 - 1277, 8000 - 8157
The least significant digit of the operand number is an octal number (0-7).
Upper digits are decimal numbers.
All four digits of the operand number
are decimal numbers.
M
ICROSMART
23
Reply Messages (Read 1 Bit)
OK Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
ON/OFF status1 byte
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
NG Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes06 (30h 36h)Data range error
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
****
**30h
(3)
32h
(3)
3*h
(4)
(4)
(5)
**30h
**
0Dh
(6)
**36h0Dh
(5)
(6)
M
ICROSMART COMMUNICATION PROTOCOL
0 (30h)
1 (31h)
OFF
ON
M
ICROSMART
24
Read Error Code
Error codes can be read from the PLC.
Request Message (Read Error Code)
**05h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(3)
(4)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteR (52h)Read data
Data type1 byteE (45h)Error code
Error address4 bytesSee table below.First error address to read
Data length (n)2 bytes02 - 0C
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
30h 30h 30h
(5)
3*h45h
(6)
30h
(7)
M
ICROSMART COMMUNICATION PROTOCOL
**52h
**
** 0Dh
(8)
(9)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
2 bytes per error address
12 (0Ch) bytes maximum
(6) Error addressError details
0000General error code
0001User program syntax error: Type code
0002User program syntax error: Address code
0003Advanced instruction syntax error
0004User program execution error
0005Link communication error
M
ICROSMART
25
Reply Messages (Read Error Code)
OK Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
Data
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
NG Reply
**06h
(1)(2)
******30h
**30h
** ** ** **
(3)
32h
(4)
(3)
(4)
Error code for the first error address to read
**
**36h0Dh
(5)
(6)
** **** **
4n bytes
(1 ≤ n ≤ 6)
M
ICROSMART COMMUNICATION PROTOCOL
**
0Dh
(5)
(6)
0 (30h) - 9 (39h)
A (41h) - F (46h)
Error code
(4 bytes per error address)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes06 (30h 36h)Data range error (error address)
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
Data Format in the Reply Message (Read Error Code)
When reading error codes, the received data show the hexadecimal values in four characters each.
Example: The read data is 0080 0000 0000 0000 0000 0000 when reading 12 (0Ch) bytes starting with error address
0000.
Divide the received data into 4-character groups and convert the data into 4-digit hexadecimal values.
Error address:0000
0080h
In this example, the read data is shown below:
0000General error code80h
0001User program syntax error: Type code0h
0002User program syntax error: Address code0h
0003Advanced instruction syntax error code0h
0004User program execution error code0h
0005Data link communication error code0h
0001
0000h
0002
0000h
0003
0000h
0004
0000h
0005
0000h
The above data means that user program syntax error (error code 80h) is found.
Since user program syntax errors and advanced instruction syntax errors never occur, the reply message contains 0 at error
addresses 0001 through 0003.
For details of error codes, see the next page.
M
ICROSMART
26
Error Codes
General Error Code
Error CodeBit PositionError Status
1hbit 0Power failure
2hbit 1Watch dog timer error
4hbit 2Data link connection error
8hbit 3User program EEPROM sum check error
10hbit 4Timer/counter preset value sum check error
20hbit 5User program RAM sum check error
40hbit 6Keep data error
80hbit 7User program syntax error
100hbit 8User program writing error
200hbit 9CPU module error
400hbit 10Clock IC error
User Program Execution Error Code — Special internal relay M8004 goes on
This error indicates that invalid data is found during execution of a user program. When this error occurs, special internal
relay M8004 (user program execution error) is also turned on. The detailed information of this error can be viewed at this
error address. When this error occurs, program operation and all output statuses are maintained.
User Program
Execution Error Code
(D8006)
1Source/destination operand is out of range
2MUL result is out of data type range.
3DIV result is out of data type range, or division by 0.
4BCDLS has S1 or S1+1 exceeding 9999.
5HTOB(W) has S1 exceeding 9999.
6BTOH has any digit of S1 exceeding 9.
7HTOA/ATOH/BTOA/ATOB has quantity of digits to convert out of range.
8ATOH/ATOB has non-ASCII data for S1 through S1+4.
9
10
11DGRD data exceeds 65535 with BCD5 digits selected.
12CVXTY/CVYTX is executed without matching XYFS.
13CVXTY/CVYTX has S2 exceeding the value specified in XYFS.
14Label in LJMP/LCAL is not found.
WKTIM has S1, S2, and S3 exceeding the valid range.
S1: 0 through 127
S2/S3: Hour data 0 through 23, minute data 0 through 59
S2/S3 can be 10000.
WKTBL has S1 through Sn out of range.
Month: 01 through 12
Day: 01 through 31
Error Details
M
ICROSMART
27
User Program
Execution Error Code
(D8006)
15TXD/RXD is executed while the RS232C port 1 or 2 is
16PID instruction execution error.
17
18
19Attempt was made to execute an instruction that is not available for the PLC.
20PULS1, PULS2, PWM1, PWM2, RAMP, ZRN1, or ZRN2 has an invalid value in control registers.
21DECO has S1 exceeding 255.
22BCNT has S2 exceeding 256.
23ICMP>= has S1 < S3.
24Interrupt program execution time exceeds 670 µsec when using a timer interrupt
25BCDLS has S2 exceeding 7.
26
27Work area is broken when using DTML, DTIM, DTMH, DTMS, or TTIM.
M
ICROSMART COMMUNICATION PROTOCOL
Error Details
not
set to user communication mode.
Preset value is written to a timer or counter whose preset value is designated with a data register.
Attempt was made to execute an instruction that cannot be used in an interrupt program:
SOTU, SOTD, TML, TIM, TMH, TMS, CNT, CDP, CUD, SFR, SFRN, WKTIM, WKTBL, DISP, DGRD,
TXD1, TXD2, RXD1, RXD2, DI, EI, XYFS, CVXTY, CVYTX, PULS1, PULS2, PWM1, PWM2, RAMP,
ZRN1, ZRN2, PID, DTML, DTIM, DTMH, DTMS, and TTIM.
DI or EI is executed when interrupt input or timer interrupt is not programmed in the Function
Area Settings.
Data Link Communication Error Code — Special internal relay M8005 goes on
This error indicates a communication error in the data link system. When this error occurs, special internal relay M8005
(data link communication error) is also turned on. The detailed information of this error can be viewed at this error
address. When this error occurs, program operation and all output statuses are maintained.
Error CodeBit PositionError Details
1hbit 0Overrun error (data is received when the receive data registers are full)
2hbit 1Framing error (failure to detect start or stop bit)
4hbit 2Parity error (an error was found by the parity check)
8hbit 3Receive timeout (line disconnection)
10hbit 4BCC (block check character) error (disparity with data received up to BCC)
20hbit 5Retry cycle over (error occurred in all 3 trials of communication)
40hbit 6
I/O definition quantity error
(discrepancy of transmit/receive station number or data quantity)
When more than one error is detected in the data link system, the total of error codes is indicated. For example, when
framing error (error code 2h) and BCC error (error code 10h) are found, error code 12h (18) is displayed.
M
ICROSMART
28
M
ICROSMART COMMUNICATION PROTOCOL
Clear Operand Data
All data of selected operand area or all operands can be cleared from the PLC.
Request Message (Clear Operand Data)
**05h
** 30h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte0 (30h)Discontinued
(3)
Command1 byteC (43h)Clear data
(4)
Data type1 byteSee table below.
(5)
BCC2 bytes00 - 7FBlock check character
(6)
Terminator1 byteCR (0Dh)Message end code
(7)
(5) Data typeData to clear(5) Data typeData to clear
X (58h)InputC (43h)Counter (preset value)
Y (59h)Outputc (63h)Counter (current value)
M (4Dh)Internal relayD (44h)Data register
R (52h)Shift registerE (45h)Error code
T (54h)Timer (preset value)Z (5Ah)System reset (all operands)
t (74h)Timer (current value)I (49h)Link formatting sequence
43h
(3)
(4)**(5)**(6)
** 0Dh
(7)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
When the timer preset value (T) or counter preset value (C) is cleared, the changed preset v alues in the CPU module RAM
are cleared and the original preset values are restored.
When the system reset is executed with Z (5Ah) specified for “Data type” in the request message, data is cleared from all
operand areas of inputs (X), outputs (Y), internal relays (M), shift registers (R), timer current values (t), counter current
values (c) and, data registers (D).
When the link formatting sequence (I) is executed, the data link terminal connection data is updated. This function is the
same as turning on special internal relay M8007 (data link communication initialize flag).
M
ICROSMART
29
Reply Messages (Clear Operand Data)
OK Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
BCC2 bytes00 - 7FBlock check character
(4)
Terminator1 byteCR (0Dh)Message end code
(5)
NG Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes09 (30h 39h)Data clear error
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
** 30h
(3)**(4)
**30h
32h
(3)
** 0Dh
(4)
(5)
**
**39h0Dh
(5)
(6)
M
ICROSMART COMMUNICATION PROTOCOL
M
ICROSMART
30
M
ICROSMART COMMUNICATION PROTOCOL
Enable/Disable User Program Protection
The user program in the CPU module can be protected from reading, writing, or both using the Function Area Settings in
WindLDR. To enable user program protection, access the Protect User Program option in the Function Area Settings, select
Write Protected, Read Protected, or Read/Write Protected, enter a password, and download the user program from the PC
to the CPU module. Then, the user program in the CPU module is protected from reading, writing, or both depending on
the selection in the Function Area Settings.
The user program protection can also be temporarily canceled using a communication command. To disable the user protection, send this command including the correct protect code (password entered in the Function Area Settings) and protect
option 0 (disable protection) to the CPU module. The user program protection is disabled until the CPU module is shut
down or the user program protection is enabled again by sending this communication command including protect option 1
(enable protection).
Request Message (Enable/Disable User Program Protection)
**05h
** 30h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte0 (30h)Discontinued
(3)
Command1 byteW (57h)Write data
(4)
Data type1 byteV (56h)User program protection
(5)
Protect code8 bytes
(6)
Protect option1 bytes
(7)
BCC2 bytes00 - 7FBlock check character
(8)
Terminator1 byteCR (0Dh)Message end code
(9)
(3)
57h
(4)
56h
(5)
** ** **
** ** ** ** **
(6)
**
(7)
00 - 1F
FF
0000 0000
to
FFFF FFFF
0 (30h)
1 (31h)
(8)
**3*h
0Dh
(9)
Device number 0 through 31
Device number 255 (all devices)
Password designated in the Function
Area Settings.
Disable protection
Enable protection
(6) Protect code
The protect code consists of 8 ASCII characters (20h through 7Fh). Enter 8 characters without conversion. When the password is less than 8 characters long, fill the empty places with 00h so that the protect code consists of 8 bytes.
(7) Protect option
Protect option 0 (disable protection):When the protect code in the request message matches that set in the CPU module,
the user program protection is disabled temporarily.
Protect option 1 (enable protection):When the protect code in the request message matches that set in the CPU module,
the user program protection is restored. The protect mode of read, write, or read/
write protect depends on the selection in the Function Area Settings of the user
program.
Unlike the MICRO3 and MICRO
3
C, this request command is primarily used for the MicroSmart to disable the user program
protection temporarily when the user program is protected by the Function Area Settings. In addition, this request command can also be used to restore the user program protection which has been disabled temporarily by this request command. Note that this request command cannot be used for the MicroSmart to protect a user program which is not protected
by the Function Area Settings.
M
ICROSMART
31
M
Reply Messages (Enable/Disable User Program Protection)
OK Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
BCC2 bytes00 - 7FBlock check character
(4)
Terminator1 byteCR (0Dh)Message end code
(5)
NG Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes05 (30h 35h)Protect code error
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
** 30h
(3)**(4)
**30h
32h
(3)
** 0Dh
(4)
(5)
**
**35h0Dh
(5)
(6)
ICROSMART COMMUNICATION PROTOCOL
(4) NG code
Protect code error:The protect code in the request message does not match the password set in the CPU module.
Attempt was made to enable protection on a protected user program.
M
ICROSMART
32
M
ICROSMART COMMUNICATION PROTOCOL
Read PLC Operating Status
This command reads the operating status of the CPU module to the computer. When this command is executed, the
received data also indicates whether the timer/counter preset values have been changed, whether the user program in the
CPU module is protected, and the type of the CPU module.
Request Message (Read PLC Operating Status)
**05h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
** 30h
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteR (52h)Read data
Data type1 byteS (53h)PLC operating status
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(3)
52h
(4)
53h
(5)**(6)
** 0Dh
(7)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
Reply Message (Read PLC Operating Status)
OK Reply
**06h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
** 30h
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte0 (30h)OK: Discontinued
PLC operating status1 byte
Timer/counter preset value change1 byte
User program protection1 byte
CPU module type code1 byte
CRC code4 bytes0000 - FFFFCRC code 0000 through FFFF
Sum check code32 bytes2 bytes × 16 blocks
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(3)
3*h
(4)
3*h
(5)
3*h
(6)
3*h
(7)
** ** **
(8)
**0Dh
(9)
0 (30h)
1 (31h)
0 (30h)
1 (31h)
0 (30h)
1 (31h)
2 (32h)
3 (33h)
0 (30h)
1 (31h)
2 (32h)
3 (33h)
4 (34h)
6 (36h)
**
**** ** ** ****** ****
(10)
(11)
Run
Stop
Not changed
Changed
Not protected
Write protect
Read protect
Read and write protect
NG reply never occurs in response to the request message of reading the PLC operating status.
M
ICROSMART
33
M
ICROSMART COMMUNICATION PROTOCOL
Read Scan Time
The scan time of the user program in operation can be read from the CPU module. When this command is executed, the
received data indicates the current and maximum values of the user program scan time.
Request Message (Read Scan Time)
**05h
** 30h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte0 (30h)Discontinued
(3)
Command1 byteR (52h)Read data
(4)
Data type1 byteK (4Bh)Scan time
(5)
BCC2 bytes00 - 7FBlock check character
(6)
Terminator1 byteCR (0Dh)Message end code
(7)
Reply Message (Read Scan Time)
(3)
52h
(4)
4Bh
(5)**(6)
** 0Dh
(7)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
OK Reply
**06h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte0 (30h)OK: Discontinued
Scan time (current value)4 bytes0000 - FFFFCurrent value of the scan time
Scan time (maximum value)4 bytes0000 - FFFFMaximum value of the scan time
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
** ** ** **
(5)
**
(6)
**** ** **
(7)
**0Dh
(4) and (5) Data Format in the Reply Message (Read Scan Time)
The current and maximum values of the scan time are presented in the hexadecimal notation and read in units of msec.
Example: The read data is 002A when reading the scan time.
In this example, the scan time reads 2 × 16 + 10 = 42 msec in the decimal notation.
NG Reply
NG reply never occurs in response to the request message of reading the scan time.
M
ICROSMART
34
M
ICROSMART COMMUNICATION PROTOCOL
Read PLC System Program Version
The system program version of the CPU module can be read to the computer.
Request Message (Read PLC System Program Version)
**05h
** 30h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte0 (30h)Discontinued
(3)
Command1 byteR (52h)Read data
(4)
Data type1 byteN (4Eh)PLC system program version
(5)
BCC2 bytes00 - 7FBlock check character
(6)
Terminator1 byteCR (0Dh)Message end code
(7)
Reply Message (Read PLC System Program Version)
OK Reply
(3)
52h
(4)
4Eh
(5)**(6)
** 0Dh
(7)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
**06h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte0 (30h)OK: Discontinued
PLC system program version4 bytes0000 - FFFFSystem program version of the PLC
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
**
(5)
**** ** **
(6)
**0Dh
NG Reply
NG reply never occurs in response to the request message of reading the PLC system program version.
Data Format in the Reply Message (Read PLC System Program Version)
The PLC system program version is the decimal equivalent of the hexadecimal reply data.
Example: The read data is 000A when reading the PLC system program version.
The PLC program version is 10 in the decimal notation.
M
ICROSMART
35
M
ICROSMART COMMUNICATION PROTOCOL
Read Timer Information
Since the MicroSmart has a timer preset range of 0 through 65535, the MSB of the timer current value data read using the
Read N Byte command for the MICRO3 cannot be used for timeout status flag. Consequently the timeout status information
must be prepared by the system program separately. The MicroSmart has a new data type to implement a command to read
timer current value, preset value, timeout status, and preset value change status.
When a preset value is read from a timer for which a data register is designated as a preset value, the data register number
is returned as a reply, rather than the preset value.
This command can read data from 48 timers at the maximum.
Request Message (Read Timer Information)
**05h
** 30h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte0 (30h)Discontinued
(3)
Command1 byteR (52h)Read data
(4)
Data type1 byte_ (5Fh)Timer information
(5)
First timer number4 bytes0000 - 0099First timer number to start reading
(6)
Quantity of timers (n)2 bytes01 - 30Read information from 1 to 48 (30h) timers
(7)
BCC2 bytes00 - 7FBlock check character
(8)
Terminator1 byteCR (0Dh)Message end code
(9)
(3)
52h
(4)
5Fh
(5)
(6)
**
****
**** ** **
(7)
** 0Dh
(8)
(9)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
M
ICROSMART
36
Reply Messages (Read Timer Information)
OK Reply
**06h
** 30h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
Data
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
(4) Data — Timer Status
** ** **
(3)
Current ValuePreset ValueTimer Status
** ** ** ** ****
(4)
10n bytes
(1 ≤ n ≤ 48)
M
ICROSMART COMMUNICATION PROTOCOL
0Dh
(5)
****
(6)
Current value (4 bytes)
Preset value (4 bytes)
Timer status (2 bytes)
**
0000 - FFFF
0000 - FFFF
00 - FF
bit 7Specified timer number programmed
bit 6Preset value designation
bit 5Preset value change
bits 4 and 3Time base
bit 2Unused—
bit 1Execution cycle
bit 0Timeout status
NG Reply
**06h
**3*h
32h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(3)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte2 (32h)NG
NG code2 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
**
**3*h0Dh
(5)
(6)
0: Not programmed
1: Programmed
0: Constant
1: Data register
0: Changed
1: Not changed
00: 1 msec
10: 10 msec
01: 100 msec
11: 1 sec
0: Subsequent timer cycle
1: First timer cycle
0: Not timeout
1: Timeout
06 (30h 36h)
10 (31h 30h)
Data range error
Data error
M
ICROSMART
37
M
ICROSMART COMMUNICATION PROTOCOL
Read Counter Information
Since the MicroSmart has a counter preset range of 0 through 65535, the MSB of the counter current value data read using
the Read N Byte command for the MICRO3 cannot be used for countout status flag. Consequently the countout status information must be prepared by the system program separately. The MicroSmart has a new data type to implement a command
to read counter current value, preset value, countout status, and preset value change status.
When a preset value is read from a counter for which a data register is designated as a preset value, the data register number is returned as a reply, rather than the preset value.
This command can read data from 48 counters at the maximum.
Request Message (Read Counter Information)
**05h
** 30h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte0 (30h)Discontinued
(3)
Command1 byteR (52h)Read data
(4)
Data type1 byte` (60h)Counter information
(5)
First counter number4 bytes0000 - 0099First counter number to start reading
(6)
Quantity of counters (n)2 bytes01 - 30Read information from 1 to 48 (30h) counters
(7)
BCC2 bytes00 - 7FBlock check character
(8)
Terminator1 byteCR (0Dh)Message end code
(9)
(3)
52h
(4)
60h
(5)
(6)
**
****
**** ** **
(7)
** 0Dh
(8)
(9)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
M
ICROSMART
38
Reply Messages (Read Counter Information)
OK Reply
**06h
** 30h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
Data
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
(4) Data — Counter Status
** ** **
(3)
Current ValuePreset ValueCounter Status
** ** ** ** ****
(4)
10n bytes
(1 ≤ n ≤ 48)
M
ICROSMART COMMUNICATION PROTOCOL
0Dh
(5)
****
(6)
Current value (4 bytes)
Preset value (4 bytes)
Counter status (2 bytes)
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte2 (32h)NG
NG code2 bytes
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
(4)
**
**3*h0Dh
(5)
(6)
06 (30h 36h)
10 (31h 30h)
Data range error
Data error
M
ICROSMART
39
M
ICROSMART COMMUNICATION PROTOCOL
Read Timer Preset Value Change Status
This command is used to check at once if preset values of all timers are changed or not.
The all-in-one 10-I/O type CPU module has 32 timers, and all other CPU modules have 100 timers.
Request Message (Read Timer Preset Value Change Status)
**05h
** 30h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte0 (30h)Discontinued
(3)
Command1 byteR (52h)Read data
(4)
Data type1 bytea (61h)Timer preset value change status
(5)
BCC2 bytes00 - 7FBlock check character
(6)
Terminator1 byteCR (0Dh)Message end code
(7)
(3)
52h
(4)
61h
(5)**(6)
** 0Dh
(7)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
M
ICROSMART
40
M
ICROSMART COMMUNICATION PROTOCOL
Reply Messages (Read Timer Preset Value Change Status)
OK Reply
**06h
** 30h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
Data26 bytes
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
(3)
** ** **
(4)
Preset Value Change Status
**** ** ** **
**
(4) Data — Preset Value Change Status
In the 26 bytes of data, the statuses of 100 timers are allocated as shown below:
1: Preset value changed
0: Preset value not changed
13rd byte
0000T99T98T97T96
** ** ** **** ** ** **
** ** ** **
Preset Value Change Status
Converted to
ASCII Format Data
26 bytes total
NG Reply
NG reply never occurs in response to the request message of reading the timer preset value change status.
M
ICROSMART
41
M
ICROSMART COMMUNICATION PROTOCOL
Read Counter Preset Value Change Status
This command is used to check at once if preset values of all counters are changed or not.
The all-in-one 10-I/O type CPU module has 32 counters, and all other CPU modules have 100 counters.
Request Message (Read Counter Preset Value Change Status)
**05h
** 30h
(1)(2)
Communication control character1 byteENQ (05h)Enquiry
(1)
Communication device number2 bytes
(2)
Continuation1 byte0 (30h)Discontinued
(3)
Command1 byteR (52h)Read data
(4)
Data type1 byteb (62h)Counter preset value change status
(5)
BCC2 bytes00 - 7FBlock check character
(6)
Terminator1 byteCR (0Dh)Message end code
(7)
(3)
52h
(4)
62h
(5)**(6)
** 0Dh
(7)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
M
ICROSMART
42
M
ICROSMART COMMUNICATION PROTOCOL
Reply Messages (Read Counter Preset Value Change Status)
OK Reply
**06h
** 30h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
Data26 bytes
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
(3)
** ** **
(4)
Preset Value Change Status
**** ** ** **
**
(4) Data — Preset Value Change Status
In the 26 bytes of data, the statuses of 100 counters are allocated as shown below:
1: Preset value changed
0: Preset value not changed
13rd byte
0000C99 C98 C97 C96
** ** ** **** ** ** **
** ** ** **
Preset Value Change Status
Converted to
ASCII Format Data
26 bytes total
NG Reply
NG reply never occurs in response to the request message of reading the counter preset value change status.
M
ICROSMART
43
M
ICROSMART COMMUNICATION PROTOCOL
Read Timeout Status
Data can be read from 1 bit of the specified timer operand in the PLC to see if the operand is on or off.
The read timeout status command can be used to monitor whether a specified timer is timed out or not.
Request Message (Read 1 Bit)
**05h
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
Note: The all-in-one 10-I/O type CPU module has 32 timers, and all other CPU modules have 100 timers.
(3)
(4)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteR (52h)Read data
Data type1 byted (64h)Timer timeout status
Operand number4 bytes0000 - 0099 (Note)Timer number to read from
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
30h 30h 3*h
(5)
(6)
**
(7)
**52h
0Dh
(8)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
3*h64h
Reply Messages (Read 1 Bit)
OK Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
ON/OFF status1 byte
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
NG Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes06 (30h 36h)Data range error
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
****
**30h
(3)
32h
(3)
3*h
(4)
(4)
(5)
**30h
**
0Dh
(6)
**36h0Dh
(5)
(6)
0 (30h)
1 (31h)
OFF
ON (timeout)
M
ICROSMART
44
M
ICROSMART COMMUNICATION PROTOCOL
Read Countout Status
Data can be read from 1 bit of the specified counter operand in the PLC to see if the operand is on or off.
The read countout status command can be used to monitor whether a specified counter is counted out or not.
Request Message (Read 1 Bit)
** 30h
(1)(2)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
Note: The all-in-one 10-I/O type CPU module has 32 counters, and all other CPU modules have 100 counters.
(3)
(4)
Communication control character1 byteENQ (05h)Enquiry
Communication device number2 bytes
Continuation1 byte0 (30h)Discontinued
Command1 byteR (52h)Read data
Data type1 bytee (65h)Counter countout status
Operand number4 bytes0000 - 0099 (Note)Counter number to read from
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
30h 30h 3*h
65h
(5)
(6)
3*h**05h
**
**52h
0Dh
(7)
(8)
00 - 1F
FF
Device number 0 through 31
Device number 255 (all devices)
Reply Messages (Read 1 Bit)
OK Reply
**06h
****
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte0 (30h)OK: Discontinued
(3)
ON/OFF status1 byte
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
(3)
3*h
(4)
(5)
**30h
0Dh
(6)
0 (30h)
1 (31h)
OFF
ON (countout)
NG Reply
**06h
(1)(2)
Communication control character1 byteACK (06h)Acknowledge
(1)
Communication device number2 bytes00 - 1FDevice number 0 through 31
(2)
Command1 byte2 (32h)NG
(3)
NG code2 bytes06 (30h 36h)Data range error
(4)
BCC2 bytes00 - 7FBlock check character
(5)
Terminator1 byteCR (0Dh)Message end code
(6)
**30h
32h
(3)
(4)
**
**36h0Dh
(5)
(6)
M
ICROSMART
45
M
ICROSMART COMMUNICATION PROTOCOL
Confirm Changed Timer/Counter Preset Values
This command writes changed preset values for timers and counters from the RAM to the EEPROM in the CPU module.
Communication control character1 byteACK (06h)Acknowledge
Communication device number2 bytes00 - 1FDevice number 0 through 31
Command1 byte0 (30h)OK: Discontinued
BCC2 bytes00 - 7FBlock check character
Terminator1 byteCR (0Dh)Message end code
NG Reply
NG reply never occurs in response to the request message of confirming changed timer/counter preset values.
** 0Dh
(5)
M
ICROSMART
46
M
ICROSMART COMMUNICATION PROTOCOL
NG Code and Action
When an NG reply is returned. The first character of the reply message is ACK (06h) and the command code is 2 (32h)
which means NG (error).
Probable Cause and Action
The reply message signals an error. Check the NG code and take a corrective action shown in the table below:
NG CodeCauseAction
Improper write/read program size.
When writing a user program to a PLC, the
user program capacity is larger than the
01 (Program size error)
02 (Protect error)
03 (RUN error)
04 (CRC error)
05 (Protect code error)
06 (Data range error)Designated data range is invalid.Make sure of the correct data range.
07 (Timer/counter preset
value change error)
program capacity of the connected PLC.
When reading a user program from a PLC,
the program capacity of the connected PLC
is larger than the user program receive
buffer in the computer.
The user program in the PLC is read and/or
write protected.
Writing user program is attempted while
the PLC is running.
User program CRC code does not match.
The user program to be written is broken.
Protect code in the request message does
not match that set in the PLC. Attempt was
made to enable protection on a protected
user program.
Preset value change is attempted to timer
or counter with preset value designated by
data register.
Check the program capacity of the PLC using
WindLDR.
Send a user program smaller than or equal to
the program capacity setting.
Increase the user program receive buffer
capacity and send a request message including the capacity data to the PLC.
Disable the program protection.
Stop the PLC and try writing user program to
the PLC again.
Correct the user program and send the corrected user program to the PLC.
Send a correct protect code to the PLC.
Do not attempt to enable protection on a protected user program.
Timer/counter preset values in the PLC can
not be changed when a data register is designated as a preset value. Check the user program in the PLC to see that the timer/counter
has a constant designated as a preset value.
To change a timer or counter preset value
designated by a data register, change the
value of the data register.
Writing an invalid value to calendar/clock is
08 (Calendar/clock data error)
09 (Data clear error)Designated data cannot be cleared.
10 (Data error)
11 (
Setting error)Incorrect setting for user communication
12 (CPU module type code
error)
attempted.
The calendar/clock in the PLC is broken.
Invalid data other than 0 (30h) - 9 (39h) or
A (41h) - F (46h) is included in the request
message.
When writing a user program to the PLC,
the CPU module type code does not match
between request message 1 and the PLC.
M
ICROSMART
Make sure of correct values for the calendar/
clock.
Check if an error has occurred in the PLC.
Correct the error and try again.
Check the request message and send a correct request message.
Check the request message and send a correct request message.
Correct the CPU module type code in request
message 1, and write the user program to
the PLC again.
47
M
ICROSMART COMMUNICATION PROTOCOL
Operand Allocation Numbers
A vailable I/O numbers depend on the type of the MicroSmart CPU module and the combination of I/O modules. I/O modules can be used with only the 24-I/O type CPU module among all-in-one type CPU modules. All slim type CPU modules
can be used with I/O modules to expand the I/O points.