0% found this document useful (0 votes)
20 views30 pages

Communications

Uploaded by

fastjohn15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views30 pages

Communications

Uploaded by

fastjohn15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

!!!

" #

$ " "
!!! " # %

& ' (
))*** + %
, -

.*))/012023*
/$ 4.*))/0120(01

5 . $$" 6 " #
.7 .//!!! " #
Communications in
Control Component

Version 1.0
12th July 1999
Overall Contents

SECTION 1
Introduction
1-1 Communications in Control and Component........................................................................2
1-2 What is Serial............................................................................................................................2
1-3 What is RS-232? .......................................................................................................................3
1-4 What is RS-422? .......................................................................................................................3
1-5 What is RS-485? .......................................................................................................................3
1-6 What is handshaking?..............................................................................................................4

SECTION 2
Basic Formats and Commands
2-1 The Protocol - ISO Communications Model Layer 2 ...........................................................6
2-2 Basic Frame Formats ...............................................................................................................6
2-3 Omron Connection ...................................................................................................................7
2-4 C-mode Commands..................................................................................................................8
2-4-1 Command/Response Formats.................................................................................................................. 9
2-5 CompoWay/F Command....................................................................................................... 14
2-5-1 Data Format ............................................................................................................................................. 19
2-6 Protocol Tester........................................................................................................................ 23
2-7 Program Description..............................................................................................................25

SECTION 3
ASCII Codes
3-1 ASCII Character Code Chart for Header and Terminator ............................................... 27

i
SECTION 1
Introduction

1-1 Communications in Control and Component........................................................................2


1-2 What is Serial............................................................................................................................2
1-3 What is RS-232? .......................................................................................................................3
1-4 What is RS-422? .......................................................................................................................3
1-5 What is RS-485? .......................................................................................................................3
1-6 What is handshaking?..............................................................................................................3

1
Communication in Control and Component Section 1-1

1-1 Communications in Control and Component


How can we communicate Control Component and PLC? In order to do so we need to
understand the following:

a) Serial - hardware and the setting to use?


b) Protocol - languages to use?

And finally Protocol tests program for you to send message to test or check response for the
Control Component and PLC.

1-2 What is Serial


Serial is a very common protocol (not to be confused with Universal Serial Bus or USB) for
device communication that comes standard on just about every PC. Most computers include
two RS-232 based serial ports. Serial is also a common communication protocol that is used
by many devices for instrumentation. Furthermore, serial communication can be used for data
acquisition in conjunction with a remote-sampling device.

The concept of serial communication is simple. The serial port sends and receives bytes of
information one bit at a time. Although this is slower than parallel communication, which
allows the transmission of an entire byte at once, it is simpler and can be used over longer
distances. For example, the IEEE 488 specifications for parallel communication state that the
cabling between equipment can be no more than 20 meters total, with no more than 2 meters
between any two devices; serial, however, can extend as much as 1200 meters.

Typically, serial is used to transmit ASCII data. Communication is completed using 3


transmission lines: (1) Ground, (2) Transmit, and (3) Receive. Since serial is asynchronous, the
port is able to transmit data on one line while receiving data on another. Other lines are
available for handshaking, but are not required. The important serial characteristics are baud
rate, data bits, stop bits, and parity. For two ports to communicate, these parameters must
match:

• Baud rate: a speed measurement for communication. It indicates the number of bit
transfers per second. For example, 300 baud is 300 bits per second. When we refer to a
clock cycle we mean the baud rate. For example, if the protocol calls for a 4800-baud rate,
then the clock is running at 4800Hz. This means that the serial port is sampling the data
line at 4800Hz. Common baud rates for telephone lines are 14400, 28800, and 33600.
Baud rates greater than these are possible, but these rates reduce the distance by which
devices can be separated. These high baud rates are used for device communication where
the devices are located together.

• data bits: a measurement of the actual data bits in a transmission. When the computer
sends a packet of information, the amount of actual data may not be full 8 bits. Standard
values for the data packets are 5, 7, and 8 bits. Which setting you choose depend on what
information you are transferring. For example, standard ASCII has values from 0 to 127
(7 bits). Extended ASCII uses 0 to 255 (8 bits). If the data being transferred is simple text
(standard ASCII), then sending 7 bits of data per packet is sufficient for communication.
A packet refers to a single byte transfer, including start/stop bits, data bits, and parity.
Since the number of actual bits depend on the protocol selected, the term packet is used to
cover all instances.

• Stop bits: used to signal the end of communication for a single packet. Typical values are
1, 1.5, and 2 bits. Since the data is clocked across the lines and each device has its own
clock, it is possible for the two devices to become slightly out of sync. Therefore, the stop

2
Communication in Control and Component Section 1-3
bits not only indicate the end of transmission but also give the computers some room for
error in the clock speeds. The more bits that are used for stop bits the greater the lenience
in synchronizing the different clocks, but the slower the data transmission rate.

• Parity: a simple form of error checking that is used in serial communication. There are
four types of parity: even, odd, marked, and spaced. Of course, the option of using no
parity is also available. For even and odd parity, the serial port will set the parity bit (the
last bit after the data bits) to a value to ensure that the transmission has an even or odd
number of logic high bits. For example, if the data were 011, then for even parity, the
parity bit would be 0 to keep the number of logic high bits even. If the parity was odd, and
then the parity bit would be 1, resulting in 3 logic high bits. Marked and spaced parity
does not actually check the data bits, but simply sets the parity bit high for marked parity
or low for spaced parity. This allows the receiving device to know the state of a bit so as
to enable the device to determine if noise is corrupting the data or if the transmitting and
receiving devices' clocks are out of sync.

1-3 What is RS-232?


RS-232 (ANSI/EIA-232 Standard) is the serial connection found on IBM-compatible PCs. It is
used for many purposes, such as connecting a mouse, printer, or modem, as well as industrial
instrumentation. Because of improvements in line drivers and cables, applications often
increase the performance of RS-232 beyond the distance and speed listed in the standard. RS-
232 is limited to point-to-point connections between PC serial ports and devices. RS-232
hardware can be used for serial communication up to distances of 50 feet.

1-4 What is RS-422?


RS-422 (EIA RS-422-A Standard) is the serial connection used on Apple Macintosh
computers. RS-422 uses a differential electrical signal, as opposed to unbalanced signals
referenced to ground with the RS-232. Differential transmission uses two lines each for
transmit and receive signals, results in greater noise immunity and longer distances as
compared to the RS-232. The greater noise immunity and distance are big advantages in
industrial environments.

1-5 What is RS-485?


RS-485 (EIA-485 Standard) is an improvement over RS-422 because it increases the number
of devices from 10 to 32 and defines the electrical characteristics necessary to ensure adequate
signal voltages under maximum load. With this enhanced multi-drop capability, you can create
networks of devices connected to a single RS-485 serial port. The noise immunity and multi-
drop capability make RS-485 the serial connection of choice in industrial applications
requiring many distributed devices networked to a PC or other controller for data collection,
HMI, or other operations. RS-485 is a superset of RS-422; thus, all RS-422 devices may be
controlled by RS-485. RS-485 hardware may be used for serial communication for up to 4000
feet of cable.

1-6 What is handshaking?


The method used by RS-232 for communication allows for a simple connection of three lines:
Tx, Rx, and Ground. However, for the data to be transmitted, both sides have to be clocking
the data at the same baud rate. Even though this method is sufficient for most applications, it is
limited in being able to respond to problems such as the receiver getting overloaded. This is

3
Communication in Control and Component Section 1-6
where serial handshaking can help. In this section we will discuss three of the most popular
forms of handshaking with RS-232: Software Handshaking and Hardware Handshaking.

Software Handshaking:
The first form of handshaking we will discuss is software handshaking. This style uses actual
data bytes as control characters. The lines necessary are still the simple three-line set of Tx,
Rx, and ground since the control characters are sent over the transmission line like regular
data. The XON and XOFF characters are sent by the receiver of the data to pause the
transmitter during communication.

As an example, assume that the transmitter begins to transmit data at a high baud rate. During
the transmission, the receiver finds that the input buffer is becoming full due to the CPU being
busy with other duties. To temporarily pause the transmission, the receiver sends XOFF,
typically decimal 19 or hex 13, until the input buffer has been emptied. Once the receiver is
ready for more data it sends XON, typically decimal 17 or hex 11, to resume communication.
Obviously, the transmitter must also be following this protocol for it to succeed.

The biggest drawback to this method is also the most important fact to keep in mind: decimal
17 and 19 are now off limits for data values. In ASCII transmissions this typically does not
matter since these values are non-character values; however, if the data is being transmitted via
binary, it is very likely that these values could be transmitted as data and the transmission
would fail.

Hardware Handshaking:

The second method of handshaking is to use actual hardware lines. Like the Tx and Rx lines,
the RTS/CTS and DTR/DSR lines work together with one being the output and the other the
input. The first set of lines is RTS (Request to Send) and CTS (Clear to Send). When a
receiver is ready for data, it will assert the RTS line indicating it is ready to receive data. The
sender at the CTS input, indicating it is clear to send the data then reads this. The next set of
lines are DTR (Data Terminal Ready) and DSR (Data Set Ready). These lines are used mainly
for modem communication. They allow the serial port and the modem to communicate their
status. For example, when the modem is ready for data to be sent from the PC, it will assert the
DTR line indicating that a connection has been made across the phone line. This is read in
through the DSR line and the PC can begin to send data. The general rule of thumb is that the
DTR/DSR lines are used to indicate that the system is ready for communication where the
RTS/CTS lines are used for individual packets of data.

4
SECTION 2
Basic Formats and Commands

2-1 The Protocol - ISO Communications Model Layer 2 ...........................................................6


2-2 Basic Frame Formats ...............................................................................................................6
2-3 Omron Connection ...................................................................................................................7
2-4 C-mode Commands..................................................................................................................8
2-4-1 Command/Response Formats...................................................................................................................... 9
2-5 CompoWay/F Command....................................................................................................... 14
2-5-1 Data Format ............................................................................................................................................... 19
2-6 Protocol Tester........................................................................................................................ 23
2-7 Program Description..............................................................................................................25

5
The Protocol-ISO Communications Model Layer 2 Section 2-1

2-1 The Protocol - ISO Communications Model Layer 2


The way data communications systems "talk to" each other is defined in a set of standards
called protocols.

In information technology, a protocol is the special set of rules for communicating that the end
points in a telecommunication connection use when they send signals back and forth.
Protocols exist at several levels in a telecommunication connection.

There are hardware telephone protocols. There are protocols between the end points in
communicating programs within the same computer or at different locations. Both end points
must recognize and observe the protocol.

Think of it as a language. If two computers don't use the same network protocol, then they
cannot communicate.

2-2 Basic Frame Formats


Header Destination Address or Data Frame Check Terminator
Node Sequence

Every message frame in a transmission, minimum must consist of the following items

Header
A code for the receiver to recognized that a new message is started to arrive. No Header means
missing data at beginning of message.

Destination Address or Node


If the receiver have different address compare to this Address or Node number, should ignore
this message. Optional to one to one communication (RS-232-C).

Data
The data that required to send.

Frame Check Sequence


A code generated base on the collection of methods to detect errors in transmitted or stored
data and to correct them.

Terminator
A code for the receiver to recognized that the new message has finished arriving. No
Terminator means frame incomplete possible sending computer crash.

6
Omron Connection Section 2-3

2-3 Omron Connection


The following are some of OMRON products that support serial communication:

1 All models of PLC

2 Temperature Controller - E5xN


E5xF
E5xK
E5xE
E5xJ
ES100

3 Intelligent Signal Processor - K3N

4 ID Sensor V700

5 Displacement Sensor Z4LC

6 Bar Code Reader - 2D V530 R150

The following 2 examples are based on CS1 PLC and E5CN Temperature Controller using
Host Link Protocol.

7
C-mode Commands Section 2-4

2-4 C-mode Commands


C-mode (Host Link) commands form a command/response system for serial communications
(Host Link Mode) to perform various control operations between a CPU Unit and a host
computer directly connected to it. These operations include reading from and writing to I/O
memory, changing operating modes, executing forced set and forced reset operations, and so
on.

Response Response

C-mode command

C-mode command

• • •

C-mode (Host Link) commands can be sent from a host computer connected to a PLC Host
Link Unit. Up to 32 PCs (Host Link Units) can be connected to a single host computer. For
identification, each Host Link Unit is assigned a unit number from 0 to 31.

The length of a single unit of a command or response exchange is called a “frame.” A single
frame contains a maximum of 131 characters of data. Characters are sent and received as
ASCII.

8
C-mode Commands Section 2-4
2-4-1 Command/Response Formats

Single-frame Commands
If a command is not more than 131 characters long, communications can be completed by
sending a single command frame. This is called a “single-frame command.”

Command Frame Format

@ 10¹ 10º * CR

Command code Text Terminator


FCS
Unit number(BCD)

• @: Must be attached at the beginning of the command


• Unit number: Set in BCD from 0 to 31 for each Host Link Unit.
• Header code: Specified in two characters.
• Text: Set parameters corresponding to command code.
• FCS: Calculate 2-character FCS (frame check sequence) at host computer. For details on
calculating FCS, refer to FCS Calculations later in this section.
• Terminator: Set “*” and CR (CHR$(13)) as two characters to indicate the end of the
command.

Single-frame Response
If a response is not more than 131 characters long, the communications can be completed by
returning one response frame. This is called a “single-frame response.”

Response Frame Format

@ 10¹ 10º 16¹ 16º * CR

End code(hexadecimal) Text


Command code FCS Terminator
Unit number(BCD)

• @: Must be attached at the beginning of the response.


• Unit number: Set in BCD from 0 to 31 for each Host Link Unit.
• Header code: The command code that was received is returned.
• End code: The results (error status, etc.) of command execution is returned.
• Text: Returned only if there is read data.
• FCS: The 2-character FCS (frame check sequence) is returned.
• Terminator: Two characters indicating the end of the command, “*” and CR (CHR$(13)),
are returned.

9
C-mode Commands Section 2-4

Error Response Format


If a reception error or an error in executing the command occurs, a response is returned with
no text.

@ 10¹ 10º 16¹ 16º * CR

FCS
Command code End code(hexadecimal) Terminator
Unit number(BCD)

Partitioned Commands
If a command is longer than 131 characters, the command’s text is partitioned by sending a
delimiter [CR code, CHR$(13)] instead of a terminator at the end of each command frame
until the last one. A terminator is sent at the end of the last frame. The procedure is given
below for three command frames.

Note When sending command frames for writing (WR, WL, WC, WD, etc.), be careful not to
partition into separate frames data that is to be written into the same word.

1, 2, 3... 1. From the host computer, attach a delimiter (CR) at the end of command frame 1
and send the frame.
2. When the PC receives this delimiter (CR), it will return only a delimiter (CR) to the
host computer.
3. From the host computer, attach a delimiter (CR) at the end of command frame 2 and
send the frame.
4. When the PC receives this delimiter (CR), it will return only a delimiter (CR) to the
host computer.
5. From the host computer, attach a terminator (*CR) at the end of command frame 3
and send the frame.
6. When the PC receives this terminator (*CR), it will return the response format with a
terminator (*CR) attached to the end.

The following diagram shows the command format when there are more than 131
characters.

10
C-mode Commands Section 2-4

Host computer

Header code
@unit number

Delimiter

Delimiter

Delimiter
Text

Text

Text
FCS

FCS

FCS
128 characters max. 128 characters max.
PC

@unit number

Header code
Delimiter

Delimiter

Delimiter
End code

Text
FCS
Note A “delimiter” is a CR code [CHR$(13)] sent as a single character to indicate the middle of a
command or response.

Partitioned Responses

If a response is more than 131 characters long, the response from the PC is partitioned by
returning a delimiter (CR code, CHR$(13)) instead of a terminator at the end of each frame
until the last one. A terminator is returned at the end of the last frame.
In the following example procedure, the response is partitioned into three frames.

1, 2, 3... 1. When the PC receives the command frame from the host computer, it re-turns
response frame 1 with a delimiter (CR) at the end to the host computer.
2. Only a delimiter (CR) is sent from the host computer to the PC.
3. When the PC receives this delimiter (CR), it returns response frame 2 with a delimiter
(CR) at the end to the host computer.
4. Only a delimiter (CR) is sent from the host computer to the PC.
5. When the PC receives this delimiter (CR), it returns response frame 3 with a
terminator (*CR) at the end to the host computer.

The following diagram shows the response format when there are more than 131 characters.

11
C-mode Commands Section 2-4

Host computer

Header code
@unit number

Delimiter

Delimiter

Delimiter
Text

FCS
PC

@unit number

Header code

Delimiter

Delimiter

Delimiter
End code

Text

Text

Text
FCS

FCS

FCS
128 characters max. 128 characters max.

Note 1. Frames in partitioned commands or responses must have not more than 128 characters
including the delimiter/terminator.
2. Delimiters from the host computer are detected by the presence of a CR code. The
delimiter will be detected even if there is data in front of it.

FCS Calculations
The PC calculates the FCS (Frame Check Sequence) value for each command frame it
receives, and it checks for errors by comparing that value with the FCS value sent with the

12
C-mode Commands Section 2-4
command frame. The host computer must calculate the FCS value when sending a command
frame.

Also, when checking for errors in response frames, the host computer must calculate the FCS
value for each response frame it receives and compare that value to the FCS value sent in the
response frame.

~~
@ 1 0 R R 0 0 0 1 4 2 * CR

Header code Text Terminator


FCS
Unit number(BCD)

FCS Calculation range

ASCII
Code
@ 40 0100 0000
EOR
1 31 0011 0001

0 30 0011 0000
EOR
R 52 0101 0010

1 31 0011 0001
Calculation result 0100 0010 The value is converted to
(see note.) Hexadecimal and handled
4Hex 2 Hex as ASCII

Note The FCS is an 8-bit value converted into two ASCII characters. The 8-bit value is the result of
an exclusive OR sequentially performed between each character in a transmission, from the
first character in the frame to the last character of the text in that frame. Non-ASCII data,
however, may sometimes be sent in the text data. If the data length is 7 bits, the leftmost bit of
each character is masked before the FCS is calculated.

13
CompoWay/F-Command Section 2-5

2-5 CompoWay/F Command


• Introduction

PC
Temperature
RS-232/RS-485 Controller
Converter
CompoWay/F

PC Communication with TC using CompoWay/F Protocol (1 to 1)

PC Temperature
RS-232/RS-485 Controller
Converter
CompoWay/F

Up to 32 TC

PC Communication with TC using CompoWay/F Protocol (1 to N)

14
CompoWay/F-Command Section 2-5
The program for the communications functions is created on the host computer, and the
E5CN/GN’s parameters are monitored or set from the host computer. So, the description
provided here is from the viewpoint of the host computer.

CompoWay/F is OMRON’s standard communications format for general serial


communications. This format uses a standard frame format as well as the FINS* commands
that have proven successful in OMRON’s PLCs. So, it can simplify communications between
components and the host computer.

* FINS (Factory Interface Network Service)

The FINS protocol provides message communications between controllers in OMRON FA


networks.

The E5CN/GN has the following communications functions:

• Reading/writing of parameters
• Operation instructions
• Selection of setup levels
Communications with the E5CN/GNare subject to the following condition:
• Parameters can be written only when the “communications writing” parameter
on the E5CN/GN is set to ON (enabled).

• Communications specifications

Transmission line connection Multiple point


Communications method RS-485 (2-wire, half duplex)
Synchronization method Start-stop synchronization
Baud rate 1200, 2400, 4800, 9600, 19200 bps
Communication code ASCII
Data bits 7 or 8 bits
Stop bits 1 or 2 bits
Error detection Vertical parity (non, even, or odd)
FCS (frame check sequence) during Sysway
communications
BCC (block check character) during CompoWay/F
communications
Flow control None
Interface RS-485
Retry function None
Communications buffer 40 bytes

* Communications speed, data bits, stop bits and vertical parity can each be set
independently in the communications setting level. Highlighted characters in the table
above indicate defaults.

Transmission procedure

15
CompoWay/F-Command Section 2-5
When the host computer transmits a command frame, the 5CN/GN transmits a response frame
that corresponds to the command frame. A single response frame is returned for each
command frame. The following diagram shows the operation of the command x and response
frames.

Command frame
Host computer

E5CN/GN
Response frame

Allow a wait time of at least 2ms until the next command is sent after the host computer
receives the response from the E5CN/GN.

• Interface
Communications with the host computer are carried out through a standard RS-485 interface.

• Wiring

RS-485

• RS-485 connections can be one-to-one or one-to-N. A maximum of 32 Units (including


the host computer) can be connected in one-to-Nsystems.
• The total cable length is 500 m max.
• Use a shielded, twisted-pair cable AWG28 or larger for wiring the E5CN, and AWG24 to
AWG14 for wiring the E5GN.

Host computer Communications


RS-485 E5CN/GN transceiver
RS-485
Abbr
Fg Pin No. Abbr
CN GN TX
- 12 6 A
RX
+ 11 5 B
SG 6.8V
Shielded E5CN/GN
cable Terminator End node
120Ω RS-485
A<B:[1]mark (1/2W)
A>B:[0]space
Pin NO. Abbr
CN GN
12 6 A
11 5 B
Use a terminator of
Shielded cable Resistance
120Ω =(1/2W)

Match the communications specifications of theE5CN/GN and the host computer. If a one-to-
N system is being used, be sure that the communications specifications of all devices in the
system (except individual unit numbers) are the same. This section explains how to set the

16
CompoWay/F-Command Section 2-5
E5CN/GN’s communications specifications. For details on the host computer, refer to the
User’s Manual provided with the host computer.

• Communications parameters
The E5CN/GN’s communications specifications are set in the communications setting level.
These parameters are set on the E5CN/GN’s front panel.
The following table shows the communications parameters and their setting ranges.

Parameter Displayed Setting range Set value


characters
Communications unit No. u-no 00 to 99 0, 1 to 99
Baud rate Bps 1.2/2.4/4.8/9.6/19.2 (kbps) 1.2/2.4/4.8/9.6/19.2 (kbps)
Communications data length len 7 /8 (bits) 7 /8 (bits)
Communications stop bit sbib ½ 1/2
Communications parity prty None /even /odd none / even / odd
Highlighted characters indicate defaults.

• Communications parameter setup


Before you carry out communications with the E5CN/GN, set up communications unit No.,
baud rate and other parameters by carrying out the following procedure. For details of
operations other than communications parameter setup, refer to the E5CN/GN User’s Manuals.

(1) Hold down the ~ key for at least three seconds to move from the “operation level” to
the “initial setting level.”
(2) Press the ~ key for less than one second to move from the “initial setting level” to
the “communications setting level.”
(3) Select the parameters as shown below by pressing the M key.
(4) Press the D or U keys to change the parameter set values.

L
L
u-no Communication
L Unit No
L L
L L 1
M
L
L
Bps Baud rate
L
L L
L L 9.6
M

L
L
len Communication
L Data length
L L
L L 7
M
L
L
sbit Communication
L Stop bit
L L
L L 2
M
L
L
prty Communication
L party
L L
L L euen

17
CompoWay/F-Command Section 2-5
LLL

L u-no 1
M
LLL

L bps 9 6
M
LLL

L len 7
M
LLL

L sbit 2
M
LLL

L prty eVen

Note : On the E5GN, the ~ key becomes the key.

• Communications parameter setup


Note that communications parameters are enabled after they have been changed by resetting
the controller.

• Communications unit No. ( u-no )


This parameter is for setting the unit No. to each of the temperature controllers. This unit
No. is set so that the host computer can identify the temperature controller when
communications are carried out with the host computer.
Set a unit No. within the range 0 to 99 for each temperature controller connected to the
host computer on the network. Default is “1”. When two or more temperature controllers
are used, do not set the same unit No. doing so will prevent normal operation.
• Baud rate (bps )
This parameter is for setting the baud rate when communicating with the host computer.
Set one of “1.2 (1200 bps)”, “2.4 (2400 bps)”, “4.8 (4800 bps)”, “9.6 (9600 bps)” and
“19.2 (19200 bps)”.
• Communications data length ( len )
This parameter is for setting the communications data length. Set either of “7 bits” or “8
bits”.
• Communications stop bit ( sbit)
This parameter is for setting the communications stop bit. Set either of “1” or “2”.
• Communications parity (prty )
This parameter is for setting the communications parity. Set one of “none”, “even” or
“odd”.

18
Data Format Section 2-5

2-5-1 Data Format

Unless otherwise indicated, numbers in this manual are expressed in hexadecimal. Values in
double quotation marks, such as “00”, are ASCII.
The number underneath each delimiter in a frame indicates the number of bytes.

• Command frame
Text

Node No. Sub-address SID Command text BCC


STX 0 0 0 ETX

1 2 2 1 1 1

Bcc calculation rage

STX This code (02) indicates the beginning of the communications frame (text).
Always set this character in the first byte.
When STX is received again during reception, reception is carried out again
from the point where STX was received.

Node number This number specifies the transmission’s destination.


Specify the E5CN/GN’s “Communications unit No.”.
BCD range “00” to “99” and “XX” can be set.
Specify “XX” for a broadcast transmission. No response will be returned for
broadcast transmissions.
No responses will be returned from node Nos. set otherwise from the above.

Sub-address This is not used on the E5CN/GN. Be sure to set the sub-address to “00”.

SID (service ID) This is not used on the E5CN/GN. Be sure to set the sub-address to “00”.

Command text Command text area. For details, see “2.2 Structure of Command text.”

ETX This code (03) indicates the end of the text.

BCC Block Check Character


The BCC result is found by calculating the exclusive OR of the bytes from
the node No. up to ETX.

• BCC calculation

19
Data Format Section 2-5
Example
The BCC is formed by converting the 8-bit value obtained by converting the exclusive OR of
the node No. up to ETX into two ASCII characters, and setting this to the BCC area.

STX Node No. Sub-address SID Command text ETX BCC


02H 0(30H) 0(30H) 0(30H) 0(30H) 0(30H) 0(30H) 5(35H) 0(30H) 3(33H) 03H 35H

BCC=30H + 30H + 30H + 30H + 30H + 30H + 35H + 30H + 33H + 03H =35H

Calculation result 35H is set to the BCC area.


The + symbol indicates exclusive OR operation and the H indicates hexadecimal code

• Response frame

Node No Sub Address End Code Command text BCC


STX ETX

1 2 2 2 1 1

End code Name Description Error


detection
priority
00 Normal completion The command ended normally without error. None
0f FINS command The specified FINS command could not be executed. The 8
error FINS response code should indicate why the command
could not be executed.
10 Parity error The sum total of bits whose received data is “1” does not 2
match the set value of “communications parity.”
11 Framing error Stop bit is “0”. 1
12 Overrun error An attempt was made to transfer new data when the 3
reception data was already full.
13 BCC error The calculated BCC value is different from the received 5
BCC value.
14 Format error • The command text contains characters other than 0 7
to 9, and A to F. This error is not applicable to the
echo back test. (For details, see chapters 2.3 “Echo
back test.”)
• No SID and command text. Or, no command text
• “MRC/SRC” not included in command text
16 Sub-address error • Illegal (unsupported) sub-address 6
• No sub-address, SID and command text
• Sub-address less than two characters, and no SID and
command text
18 Frame-length error The received frame exceeds the fixed (supported) number 4
of bytes.

• The end code is returned to receive command frames addresses to the self-node.
• No response will be returned if all the items in the response frame are incomplete up to
the ETX and BCC.
• “Error Detection Priority” indicates the priority when two or more errors occur
simultaneously.

• Communications data

Communications Set (Monitor) Minus value Decimal point


Specifications Value

20
Data Format Section 2-5
CompoWay/F 8 digits (Hex) 2’s complement Decimal point is removed and
the result is converted
to hexadecimal.
Example) 105.0 1050
000041A

• Example of end code

The following examples show an end code when a command did not end normally.

Example 1) Illegal sub-address, and no SID and command text

Command Format

Node No Sub-address BCC


STX 0 A ETX

Response Format

Node No Sub-address End Code BCC


STX 0 A 1 6 ETX

End code is “16” (sub-address error).


This is because a sub-address was received and the sub-address error has a higher error
detection priority than the format error.

Example 2) No command text

Command Format

Node No Sub-address SID BCC


STX 0 0 0 ETX

Response Format

Node No Sub-address End Code BCC


STX 0 0 1 4 ETX

End code is “14” (format error).

Example 3) All nodes Nos. not provided


Command Format

BCC
STX ETX

The node No. is lacking one character.

Response Format

Node No Sub-address End Code BCC


STX 0 0 1 3 ETX

No response

21
Data Format Section 2-5

Example 4) No sub-address, and illegal BCC

Command Format

Node No BCC
STX ETX Err

Response Format

Sub-address is “00" and end code is “13" (BCC) error

22
Protocol Tester Section 2-6

2-6 Protocol Tester


a) The Protocol tester programs created with Microsoft Visual C++ is use
to send serial message to PLC, Temperature Controller and etc.

b) The Protocol tester programs created with Microsoft Visual Basic

23
Protocol Tester Section 2-6

24
Program Description Section 2-7

2-7 Program Description


Port Setting To configure which port to use and the respective baud rate, No. of Data bit, Parity
and No. of Stop bit. ("Default" is the Omron Standard Port Setting when using Com
1).
Message Setting Node No 0-31 (default is 0)
Header Header of the message in Decimal format
(default is @ decimal 64)
Terminator Header of the message in Decimal format
(default is *+CR decimal 42 and 13)
Input Mode ASCII (Default, Binary is not implemented yet)
Error Check FCS (Default, None is not implemented yet)
Transmitted Data to be send exclude header, FCS and terminator
You can type in new message or selected the message from the Combo box. (The
new message is record in the combo box after the send key is clicked).
Received Data Received include header, FCS and terminator
"Send" Button To activated the sending of the message
"FCS" text box The computed FCS code (for checking only)

Note: a) Refer to ASCII Character Code Chart for Header and Terminator.
b) use capital letter for the data field

These programs are in the following directory,

1) \vc\Protocol for Protocol Tester program in Microsoft Visual C

2) \vb\Protocol for Protocol Tester program in Microsoft Visual Basic

The sources are also included. For those wanted to modify them to be included into other
applications are welcome.

Warning: Omron assume no responsibility for errors or omissions for the


above programs.

25
SECTION 3
ASCII Codes

3-1 ASCII Character Code Chart for Header and Terminator ............................................... 27

26
ASCII Codes Section 3-1

3-1 ASCII Character Code Chart for Header and Terminator

27

You might also like