IDEC FC4A Series Instruction Manual

M
ICROSMART
This document describes communication commands for the MicroSmart micro programmable controller.
C
OMMUNICATION
ROTOCOL

Table of Contents

Communication Command List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Communication Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Message Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Request Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Receive Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Reply Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Write User Program in ASCII Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Write User Program in Binary Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Read User Program in ASCII Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Read User Program in Binary Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Write N Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Read N Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Write 1 Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Read 1 Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Read Error Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Clear Operand Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Enable/Disable User Program Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Read PLC Operating Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Read Scan Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Read PLC System Program Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Read Timer Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Read Counter Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Read Timer Preset Value Change Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Read Counter Preset Value Change Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Read Timeout Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Read Countout Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Confirm Changed Timer/Counter Preset Values . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
NG Code and Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Operand Allocation Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
www.idec.com
X
X
X
X
X
X
X
X
M
ICROSMART COMMUNICATION PROTOCOL

Communication Command List

All communication commands available for the
MicroSmart, OpenNet Controller (ONC)
,
MICRO
3
, 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 Name MicroSmart ONC MICRO 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
C MICRO
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

Communi­cation 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) Enquiry Request 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 com­puter sends a request message in the 1:N communi­cation 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 register D (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 mes­sage 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 one­byte 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 10­msec 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 Bits 7 or 8 Parity None, Odd, Even Stop Bits 1 or 2
10 to 2540 (10-msec increments)
Receive Timeout (ms)
Device Number 0 to 31 Mode Selection Input Any input number
(Receive timeout is disabled when 2550 is selected.)
Data Data
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 com­munication is completed normally.
ACK Reply Message
(1)
(2)
ACK
Device (2)06h (1) BCC
0 (30h) OK: Discontinued All 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 con­tinuation 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 C No 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 error Improper write/read program size
01
Protect error Protected against write/read in the PLC
02
RUN error Writing user program is attempted while the PLC
03
CRC error User program CRC code does not match
04
Protect code error Protect code in the request message does not
05
Data range error Invalid data range designated
06
Timer/counter preset
07
value change error
Calendar/clock data error Invalid value written to calendar/clock
08
Data clear error Designated data cannot be cleared
09
Data error Invalid data other than 0 (30h) - 9 (39h) or
10
Setting error Incorrect setting for user communication
11
CPU module type code
12
error
Error Cause
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 reg­ister
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: discontin­ued) 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) Command 0 (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 error Appended BCC code does not match BCC calculated
Frame error Quantity of received bits differs from the preset
Data send/receive error Parity error or overrun error occurred. Command error Unsupported request message is received. Procedure/data quantity error Received request message does not match the
Error Type Error 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 character 1 byte ENQ (05h) Enquiry Communication device number 2 bytes Continuation 1 byte 1 (31h) Continued
Command 1 byte W (57h) Write data Data type 1 byte P (50h) User program in ASCII format
CPU module type code 1 byte
Program capacity 8 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (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)
10-I/O 16-I/O 20-I/O transistor output 24-I/O 40-I/O 20-I/O relay output
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 character 1 byte ENQ (05h) Enquiry Communication device number 2 bytes Continuation 1 byte 0 (30h) Discontinued User program BCC 2 bytes 00 - 7F Block check character
Terminator 1 byte CR (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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 0 (30h) OK: Discontinued BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 2 (32h) NG
NG code 2 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (0Dh) Message end code
(4)
(4)
**30h
0Dh
(5)
**
**3*h 0Dh
(5)
(6)
M
ICROSMART COMMUNICATION PROTOCOL
01 (30h 31h) 02 (30h 32h) 03 (30h 33h) 04 (30h 34h) 12 (31h 32h)
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 character 1 byte ENQ (05h) Enquiry Communication device number 2 bytes Continuation 1 byte 1 (31h) Continued
Command 1 byte W (57h) Write data Data type 1 byte p (70h) User program in binary format
CPU module type code 1 byte
Program capacity 8 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (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)
10-I/O 16-I/O 20-I/O transistor output 24-I/O 40-I/O 20-I/O relay output
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 character 1 byte ENQ (05h) Enquiry Communication device number 2 bytes Continuation 1 byte 0 (30h) Discontinued User program BCC 2 bytes 00 - FF Block check character
Terminator 1 byte CR (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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 0 (30h) OK: Discontinued BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 2 (32h) NG
NG code 2 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (0Dh) Message end code
(4)
(4)
**30h
0Dh
(5)
**
**3*h 0Dh
(5)
(6)
M
ICROSMART COMMUNICATION PROTOCOL
01 (30h 31h) 02 (30h 32h) 03 (30h 33h) 04 (30h 34h) 12 (31h 32h)
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 character 1 byte ENQ (05h) Enquiry Communication device number 2 bytes Continuation 1 byte 1 (31h) Continued
Command 1 byte R (52h) Read data Data type 1 byte P (50h) User program in ASCII format
CPU module type code 1 byte
Program capacity 8 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (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)
10-I/O 16-I/O 20-I/O transistor output 24-I/O 40-I/O 20-I/O relay output
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 character 1 byte ENQ (05h) Enquiry Communication device number 2 bytes Continuation 1 byte 0 (30h) Discontinued
Command 1 byte R (52h) Read data BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 1 (31h) OK: Continued
CPU module type code 1 byte
Program capacity 8 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (0Dh) Message end code
3*h
(4)
** ** **
** **
** ** ** **
(5)
** 0Dh
(6)
M
ICROSMART COMMUNICATION PROTOCOL
(7)
0 (30h) 1 (31h) 2 (32h) 3 (33h) 4 (34h) 6 (36h)
0000 0000 : FFFF FFFF
10-I/O 16-I/O 20-I/O transistor output 24-I/O 40-I/O 20-I/O relay output
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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 0 (30h) OK: Discontinued
User program BCC 2 bytes 00 - 7F Block check character
Terminator 1 byte CR (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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 2 (32h) NG
NG code 2 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (0Dh) Message end code
(4)
**
**3*h 0Dh
(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 character 1 byte ENQ (05h) Enquiry
(1)
Communication device number 2 bytes
(2)
Continuation 1 byte 1 (31h) Continued
(3)
Command 1 byte R (52h) Read data
(4)
Data type 1 byte p (70h) User program in binary format
(5)
CPU module type code 1 byte
(6)
Program capacity 8 bytes
(7)
BCC 2 bytes 00 - 7F Block check character
(8)
Terminator 1 byte CR (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)
10-I/O 16-I/O 20-I/O transistor output 24-I/O 40-I/O 20-I/O relay output
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 character 1 byte ENQ (05h) Enquiry Communication device number 2 bytes Continuation 1 byte 0 (30h) Discontinued
Command 1 byte R (52h) Read data BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 1 (31h) OK: Continued
CPU module type code 1 byte
Program capacity 8 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (0Dh) Message end code
3*h
(4)
** ** **
** **
** ** ** **
(5)
** 0Dh
(6)
M
ICROSMART COMMUNICATION PROTOCOL
(7)
0 (30h) 1 (31h) 2 (32h) 3 (33h) 4 (34h) 6 (36h)
0000 0000 : FFFF FFFF
10-I/O 16-I/O 20-I/O transistor output 24-I/O 40-I/O 20-I/O relay output
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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 0 (30h) OK: Discontinued
User program BCC 2 bytes 00 - FF Block check character
Terminator 1 byte CR (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 character 1 byte ACK (06h) Acknowledge Communication device number 2 bytes 00 - 1F Device number 0 through 31 Command 1 byte 2 (32h) NG
NG code 2 bytes
BCC 2 bytes 00 - 7F Block check character Terminator 1 byte CR (0Dh) Message end code
(4)
**
**3*h 0Dh
(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 character 1 byte ENQ (05h) Enquiry Communication device number 2 bytes Continuation 1 byte 0 (30h) Discontinued
Command 1 byte W (57h) Write data Data type 1 byte See table below. N-byte designation Operand number 4 bytes See table below. First operand number to write to
Data length (n) 2 bytes 00 - C8
Data BCC 2 bytes 00 - 7F Block check character
Terminator 1 byte CR (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
Input Output Internal relay
Shift register Timer (preset value) Timer (current value) Counter (preset value) Counter (current value) Data register Calendar/clock
0000 - 0307 0000 - 0307
0000 - 1277, 8000 - 8077
0000 - 0127 0000 - 0099 0000 - 0099 0000 - 0099 0000 - 0099
0000 - 1299, 2000 - 7999, 8000 - 8199
0000 - 0006
M
ICROSMART
The least significant digit of the oper­and number is an octal number (0-7). Upper digits are decimal numbers.
All four digits of the operand number are decimal numbers.
15
Loading...
+ 35 hidden pages