serial communication modules - yokogawa electric · serial communication modules im 34m6h21-01e 2nd...

65
User’s Manual IM 34M6H21-01E Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation

Upload: others

Post on 26-Feb-2020

4 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

User’s Manual

IM 34M6H21-01E

Serial Communication Modules

IM 34M6H21-01E2nd Edition

Yokogawa Electric Corporation

Page 2: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

i

Media No. IM 34M6H21-01E (CD) 2nd Edition : Aug, 2001 (YK) IM 34M6H21-01E 2nd Edition : Aug, 2001-00All Rights Reserved Copyright � 1999, Yokogawa Electric Corporation

Applicable Product:

� Range-free Multi-controller FA-M3

Model: F3RS22-0N

Name: RS-232-C Communication Module

Model: F3RS41-0N

Name: RS-422 Communication Module

The document number and document model code for this manual are given below.

Refer to the document number in all communications; also refer to the document number or the document model code when purchasing additional copies of this manual.

Document No.: IM 34M6H21-01E

Document Model Code: DOCIM

Page 3: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

ii

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Important

� About This Manual - This Manual should be passed on to the end user.

- Before using the controller, read this manual thoroughly to have a clear understanding of the controller.

- This manual explains the functions of this product, but there is no guarantee that they will suit the particular purpose of the user.

- Under absolutely no circumstances may the contents of this manual be transcribed or copied, in part or in whole, without permission.

- The contents of this manual are subject to change without prior notice.

- Every effort has been made to ensure accuracy in the preparation of this manual. However, should any errors or omissions come to the attention of the user, please contact the nearest Yokogawa Electric representative or sales office.

� Safety Precautions when Using/Maintaining the Product - The following safety symbols are used on the product as well as in this manual.

Danger. This symbol on the product indicates that the operator must follow the instructions laid out in this instruction manual to avoid the risk of personnel injuries, fatalities, or damage to the instrument. The manual describes what special care the operator must exercise to prevent electrical shock or other dangers that may result in injury or the loss of life.

Protective Ground Terminal. Before using the instrument, be sure to ground this terminal.

Function Ground Terminal. Before using the instrument, be sure to ground this terminal.

Alternating current. Indicates alternating current.

Direct current. Indicates direct current.

Page 4: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

iii

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

The following symbols are used only in the instruction manual.

WARNING Indicates a “Warning”. Draws attention to information essential to prevent hardware damage, software damage or system failure.

CAUTION Indicates a “Caution” Draws attention to information essential to the understanding of operation and functions.

TIP

Indicates a “TIP” Gives information that complements the present topic.

SEE ALSO

Indicates a “SEE ALSO” reference. Identifies a source to which to refer.

�- For the protection and safe use of the product and the system controlled by it, be sure

to follow the instructions and precautions on safety stated in this manual whenever handling the product. Take special note that if you handle the product in a manner other than prescribed in these instructions, the protection feature of the product may be damaged or impaired. In such cases, Yokogawa cannot guarantee the quality, performance, function and safety of the product.

- When installing protection and/or safety circuits such as lightning protection devices and equipment for the product and control system as well as designing or installing separate protection and/or safety circuits for fool-proof design and fail-safe design of processes and lines using the product and the system controlled by it, the user should implement it using devices and equipment, additional to this product.

- If component parts or consumable are to be replaced, be sure to use parts specified by the company.

- This product is not designed or manufactured to be used in critical applications which directly affect or threaten human lives and safety — such as nuclear power equipment, devices using radioactivity, railway facilities, aviation equipment, air navigation facilities, aviation facilities or medical equipment. If so used, it is the user’s responsibility to include in the system additional equipment and devices that ensure personnel safety.

- Do not attempt to modify the product.

� Exemption from Responsibility - Yokogawa Electric Corporation (hereinafter simply referred to as Yokogawa Electric)

makes no warranties regarding the product except those stated in the WARRANTY that is provided separately.

- Yokogawa Electric assumes no liability to any party for any loss or damage, direct or indirect, caused by the user or any unpredictable defect of the product.

Page 5: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

iv

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Software Supplied by the Company - Yokogawa Electric makes no other warranties expressed or implied except as

provided in its warranty clause for software supplied by the company.

- Use the software with one computer only. You must purchase another copy of the software for use with each additional computer.

- Copying the software for any purposes other than backup is strictly prohibited.

- Store the original media, such as floppy disks, that contain the software in a safe place.

- Reverse engineering, such as decompiling of the software, is strictly prohibited.

- No portion of the software supplied by Yokogawa Electric may be transferred, exchanged, or sublet or leased for use by any third party without prior permission by Yokogawa Electric.

Page 6: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

v

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� General Requirements for Using the FA-M3

� Avoid installing the FA-M3 in the following locations:

- Where the instrument will be exposed to direct sunlight, or where the operating temperature exceeds the range 0�C to 55�C (0�F to 131�F).

- Where the relative humidity is outside the range 10 to 90%, or where sudden temperature changes may occur and cause condensation.

- Where corrosive or flammable gases are present.

- Where the instrument will be exposed to direct mechanical vibration or shock.

- Where the instrument may be exposed to extreme levels of radioactivity.

� Use the correct types of wire for external wiring:

- Use copper wire with temperature ratings greater than 75�C.

� Securely tighten screws:

- Securely tighten module mounting screws and terminal screws to avoid problems such as faulty operation.

- Tighten terminal block screws with the correct tightening torque as given in this manual.

� Securely lock connecting cables:

- Securely lock the connectors of cables, and check them thoroughly before turning on the power.

� Interlock with emergency-stop circuitry using external relays:

- Equipment incorporating the FA-M3 must be furnished with emergency-stop circuitry that uses external relays. This circuitry should be set up to interlock correctly with controller status (stop/run).

� Ground for low impedance:

- For safety reasons, connect the [FG] grounding terminal to a Japanese Industrial Standards (JIS) Class 3 Ground. For compliance to CE Marking, use cables such as twisted cables which can ensure low impedance even at high frequencies for grounding.

� Configure and route cables with noise control considerations:

- Perform installation and wiring that segregates system parts that may likely become noise sources and system parts that are susceptible to noise. Segregation can be achieved by measures such as segregating by distance, installing a filter or segregating the grounding system.

� Configure for CE Marking Conformance:

- For compliance with CE Marking, perform installation and cable routing according to the description on compliance to CE Marking in the “Hardware Manual” (IM34M6C11-01E).

� Keep spare parts on hand:

- Stock up on maintenance parts including spare modules, in advance.

Page 7: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

vi

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Discharge static electricity before operating the system:

- Because static charge can accumulate in dry conditions, first touch grounded metal to discharge any static electricity before touching the system.

� Never use solvents such as paint thinner for cleaning:

- Gently clean the surfaces of the FA-M3 with a cloth that has been soaked in water or a neutral detergent and wringed.

- Do not use volatile solvents such as benzine or paint thinner or chemicals for cleaning, as they may cause deformity, discoloration, or malfunctioning.

� Avoid storing the FA-M3 in places with high temperature or humidity:

- Since the CPU module has a built-in battery, avoid storage in places with high temperature or humidity.

- Since the service life of the battery is drastically reduced by exposure to high temperatures, take special care (storage temperature should be from –20�C to 75�C).

- There is a built-in lithium battery in a CPU module and temperature control module which serves as backup power supply for programs, device information and configuration information. The service life of this battery is more than 10 years in standby mode at room temperature. Take note that the service life of the battery may be shortened when installed or stored at locations of extreme low or high temperatures. Therefore, we recommend that modules with built-in batteries be stored at room temperature.

� Always turn off the power before installing or removing modules:

- Failing to turn off the power supply when installing or removing modules, may result in damage.

� Do not touch components in the module:

- In some modules you can remove the right-side cover and install ROM packs or change switch settings. While doing this, do not touch any components on the printed-circuit board, otherwise components may be damaged and modules may fail to work.

Page 8: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

vii

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Waste Electrical and Electronic Equipment Waste Electrical and Electronic Equipment (WEEE), Directive 2002/96/EC (This directive is only valid in the EU.) This product complies with the WEEE Directive (2002/96/EC) marking requirement. The following marking indicates that you must not discard this electrical/electronic product in domestic household waste. Product Category With reference to the equipment types in the WEEE directive Annex 1, this product is classified as a “Monitoring and Control instrumentation” product. Do not dispose in domestic household waste. When disposing products in the EU, contact your local Yokogawa Europe B. V. office.

Page 9: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

viii

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Introduction

Overview of the Manual This manual, “Serial Communication Modules” (IM 34M6H21-01E), explains the specifications and handling of the Serial Communication of the FA-M3.

Other Manuals The manuals to reference depends on the CPU type. Refer to the following manuals accordingly.

For BASIC CPU modules F3BP20 and F3BP30 - BASIC CPU Module and YM-BASIC/FA Programming Language (IM 34M6Q22-01E)

Common for all sequence CPU modules For the FA-M3 specifications and configurations*1, installation and wiring, test run, maintenance, and module installation limits for the whole system: *1: Refer to the relevant product manuals for specifications except for power supply modules, base modules, input/output

modules, cables and terminal units.

- Hardware Manual (IM 34M6C11-01E), 6th Edition or later

Page 10: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

ix

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Copyrights and Trademarks

Copyrights Copyrights of the programs and online manual included in this CD-ROM belong to Yokogawa Electric Corporation. This online manual may be printed but PDF security settings have been made to prevent alteration of its contents. This online manual may only be printed and used for the sole purpose of operating this product. When using a printed copy of the online manual, pay attention to possible inconsistencies with the latest version of the online manual. Ensure that the edition agrees with the latest CD-ROM version. Copying, passing, selling or distribution (including transferring over computer networks) of the contents of the online manual, in part or in whole, to any third party, is strictly prohibited. Registering or recording onto videotapes and other media is also prohibited without expressed permission of Yokogawa Electric Corporation.

Trademarks The trade names and company names referred to in this manual are either trademarks or registered trademarks of their respective companies.

Page 11: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Blank Page

Page 12: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

TOC-1

IM 34M6H21-01E

2nd Edition : Aug, 2001-00

CONTENTS Applicable Product ....................................................................................i

Important ...................................................................................................ii

Introduction............................................................................................viii

Copyrights and Trademarks....................................................................ix

1. Overview ....................................................................................... 1-1

2. F3RS22-0N .................................................................................... 2-1 2.1 Standard Specifications......................................................................... 2-1

Model and Suffix Codes ...................................................................... 2-1 Operating Environment........................................................................ 2-1 Physical Specifications ........................................................................ 2-1 Function Specifications........................................................................ 2-1 Components and Their Functions ....................................................... 2-3 External Dimensions............................................................................ 2-3

2.2 External Wiring ....................................................................................... 2-4 Connector Pin Assignments ................................................................ 2-4 Directly Connecting to an RS-232-C Device (DTE: Data Terminal

Equipment) .......................................................................................... 2-5 Connecting to a Modem (DCE: Data Communication Equipment) ..... 2-6 Notes on Wiring ................................................................................... 2-8

2.3 Attaching and Detaching Modules........................................................ 2-9

3. F3RS41-0N Communication Module ........................................... 3-1 3.1 Standard Specifications......................................................................... 3-1

Model and Suffix Codes ...................................................................... 3-1 Operating Environment........................................................................ 3-1 Physical Specifications ........................................................................ 3-1 Function Specifications........................................................................ 3-1 Components and their Functions......................................................... 3-2 External Dimensions............................................................................ 3-3

3.2 External Wiring ....................................................................................... 3-4 RS-422/RS-485 Terminal Block........................................................... 3-4 Four-Wire System................................................................................ 3-4 Two-Wire System ................................................................................ 3-5 Notes on Wiring ................................................................................... 3-5

3.3 Attaching and Detaching Modules........................................................ 3-5

FA-M3 Serial Communication Modules

IM 34M6H21-01E 2nd Edition

Page 13: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

TOC-2

IM 34M6H21-01E

2nd Edition : Aug, 2001-00

4. Using the Communication Module ..............................................4-1 4.1 Basic Communications ..........................................................................4-1

� Declaring Use of the Module................................................................4-1 � Resetting the Module ...........................................................................4-1 � Setting Communication Conditions......................................................4-1 � Output...................................................................................................4-2 � Input ....................................................................................................4-3

4.2 Transmission Text and Format Specifications.....................................4-4 � Data Output ..........................................................................................4-4 � Data Input.............................................................................................4-5

4.3 Efficient Communication........................................................................4-7 � Interrupt Input .......................................................................................4-7 � TRANSFER..........................................................................................4-8

4.4 Using Registers .....................................................................................4-11 � List of Registers .................................................................................4-11 � Format of Received Text ....................................................................4-12 � XON/XOFF Control ............................................................................4-14 � Break Signal .......................................................................................4-14

4.5 Special Communications .....................................................................4-15 � Long Text............................................................................................4-15 � Binary Transmission...........................................................................4-15 � Handling Null Codes ..........................................................................4-16 � Inserting Binary Data into Text ...........................................................4-17

4.6 Multi-point Connection .........................................................................4-18 � External Connection...........................................................................4-18 � Setting Registers................................................................................4-19 � Setting Terminating Resistors ............................................................4-19 � Protocol Processing ...........................................................................4-20

5. BASIC Statements and Error Codes............................................5-1 5.1 BASIC Statements...................................................................................5-1 5.2 Error Codes..............................................................................................5-2 5.3 Sample Programs....................................................................................5-3

Appendix 1. Signal Description and Direction of Signal Lines (RS-232-C)......................................Appx. 1-1

Appendix 2. Data Transmission ..............................................Appx. 2-1

Appendix 3. ASCII Codes.........................................................Appx. 3-1

Revision Information.................................................................................i

Page 14: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

1-1

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

1. Overview The F3RS22-0N is a communication module that can be used with F3BP20 or F3BP30 BASIC CPU modules for RS-232 communication. It has two ports that use D-sub 9-pin connectors for connection and allows transmission to a maximum distance of 15 metres.

BASIC statements are available as a means to exchange data through a communication line. Each port in the F3RS22-0N operates independently and communication error in a port does not affect operations of the other ports.

The F3RS41-0N is a communication module that can be used with F3BP20 or F3BP30 BASIC CPU modules for RS-422-A or RS-485 communication. It has one port that uses a terminal block for connection and allows transmission to a maximum distance of 1200 metres.

BASIC statements are available as a means to exchange data through a communication line. For details on the differences between RS-422-A and RS-485 communication, see Section 3.1, “Standard Specifications � Physical Specifications” and Section 4.6, “Multi-point”.

Table 1.1 Types of Communication Modules Model Description

F3RS22-0N RS-232-C communication module F3RS41-0N RS-422 communication module

CAUTION

F3RS22-0N and F3RS41-0N communication modules are not accessible from ladder sequence CPU modules. They are to be used with F3BP20 and F3BP30 BASIC CPU modules.

Page 15: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Blank Page

Page 16: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-1

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

2. F3RS22-0N 2.1 Standard Specifications

� Model and Suffix Codes

Model Code Suffix Code Style Code Additional Code Remarks

F3RS22 -0N …… …… Max. 19200 bps, two RS-232-C ports

� Operating Environment F3RS22-0N can be used with the following CPU modules.

CPU Modules Style F3BP20

BASIC CPU module F3BP30

� Physical Specifications Item Specifications

Interface EIA RS-232C compliant Number of communication ports 2 (non-isolated)

Transmission distance 15 m maximum

Connector D-Sub 9-pin (female) M2.6 mm

Current consumption 135 mA

External Dimensions 28.9 (W) u 100 (H) u 83.2 (D) (mm)*

Weight 120 g

* : Dimensions excluding protrusions. See figure on External Dimensions.

� Function Specifications Item Specifications Default

Connection Point-to-point ��

Communication mode Full-duplex/half-duplex �

Synchronization Start-stop �

Protocol Non-procedural �

Character length 7/8 bits 8 bits

Stop bit length 1/1.5/2 bits 1 bit Character frame

Parity bit None/odd/even Even

Transmission rate 75/150/300/600/1200/2400/4800/9600/19200 bps 4800

RS control (1) Always on (2) On only when a control line message is being sent (1)

DR check (1) Transmits regardless of the state of DR. (2) Transmits only when DR is on. (1)

CD check (1) Transmits regardless of the state of CD. (2) Transmits only when CD is off. (1)

Control/checking of control line

ER control (1) On (ready) (2) Off (not ready) On

(to be continued on the next page)

Page 17: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-2

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Item Specifications Default

Transmitting buffer Can buffer one text item (maximum length of 1,024 bytes). �

Communication buffer

Receiving buffer Rotary (FIFO) buffer of 2,048 bytes �

Starting character - Yes/no - One-character length; any character is acceptable �

Ending character (Terminator)

- Yes/no - Two-character length maximum; any character (string) is acceptable - Also serves as an ending character during transmission.

$0D x $0A (CR-LF)

Designation of number of characters

- Yes - Effective range: 1 to 1024 (over the communication line)

1024

Monitored character-to-character time interval

- Configurable in 1-ms units; precision: 10 ms - Effective range: 0 to 32760 (if set to 0, there is no monitoring of the character-to-character time interval)

1.5 s

Receive text format

Character-to-character receiving interval time-out process

Processed as a communication failure/processed as the normal end of receiving

Normal end of receiving

Control method

(1) Uncontrolled (2) Receiving line only (3) Transmitting line only (4) Both transmitting and receiving lines

Uncontrolled

XON character $11 (DC1)

XON/XOFF control

XOFF character One-character length; any character is acceptable

$13 (DC3)

Transmission code Internal code/ASCII code*1/JIS 8-bit code*2 Internal code (ASCII- equivalent)

Monitored time before I/O completion

Configurable in 1-ms units from 1 to 32760 ms; accuracy: 10 ms 30 s

I/O monitoring Monitored time before

transmission start Time not monitored/time monitored (configurable in 1-ms units from 1 to 32760 ms; accuracy: 10 ms)

Time not monitored

Break transmission interval Configurable in 1-ms units from 1 to 32760 ms; accuracy: 10 ms 400 ms

End of receiving Interrupt permitted/prohibited Prohibited Receive failure Interrupt permitted/prohibited Prohibited

Interrupt mask

Break receiving Interrupt permitted/prohibited Prohibited

*1 During input, kana and kanji characters are replaced with spaces. *2 During output, kanji characters are replaced with JIS double-byte codes, while other characters not defined as JIS

characters are replaced with spaces. Note: JIS code systems: JIS X0201, JIS X0208

Page 18: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-3

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Components and Their Functions

� External Dimensions

(Unit: mm)

Note: When an RS-232-C cable is connected to the module, add 90 mm to the 83-mm depth across the bottom of the

module to allow for approximately 173 mm as the mounting depth to accommodate the base module, the RS-232-C connector and the bending radius of the RS-232-C cable,.

2

READY indicator (lit whenthe internal circuitry is innormal operation)

Port 2

1

Port 1

RDY

RS232CRS22-0N

83.2 28.92

6.7

100

Page 19: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-4

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

2.2 External Wiring

� Connector Pin Assignments The following figure shows how the module’s connector looks when viewed externally.

Signal Direction Pin

Number

Signal Name Name

FA-M3 Remote equipment

Signal Monitoring

(yes/no) Purpose *

1 CD Data Carrier Detect

yes

Receives only when this signal is on. Sending proceeds as follows: (1) Transmits regardless of the state of CD (default). (2) Transmits only when CD is off.

2 RD Receive Data

no

3 SD Send Data no 4 ER Data

Terminal Ready

no

(1) ER turns on when power is switched on and stays on (default). (2) Turns on and off by software

5 SG Signal Ground

no

6 DR Data Set Ready

yes

Used to check if remote equipment is ready for receiving (1) Receives regardless of the state of DR (default). (2) Receives only when DR is on.

7 RS Request to Send

no

Used when transmitting data to the remote equipment (1) Always on (default). (2) Turns on only during transmission

8 CS Clear to Send

yes Permission to transmit from the remote equipment. Transmits only when this signal is on.

9 — Unused no no

* : Option (1) or (2) can be set using a BASIC program.

5

1

9

6

D-Sub 9-pinConnector (Female)

Page 20: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-5

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Directly Connecting to an RS-232-C Device (DTE: Data Terminal Equipment)

� Example internal cable connection diagram for D-sub 25-pin remote equipment

Note: This example illustrates the case where the remote DTE uses D-sub 25-pin. Examples of cables with the above internal connection are the YCB cables supplied by Yokogawa.

� Example internal cable connection diagram for D-sub 9-pin remote equipment

� Connect the shielded wire as instructed below:

(1) Use a cable with connectors housed in metal or metal-plated covers. Connect the shielded wire directly to the connector covers.

(2) Note that the connector shell of an F3RS22-0N module is connected internally to the FG (frame ground) terminal of an FA-M3 power supply module.

� Introduction to Yokogawa-supplied cables

The following null modem cables are available from Yokogawa. Model Code Suffix Code Specifications

YCB215 RS-232-C null modem cable (with control line) with 9- and 25-pin connectors ML gateway card (CP7�) for connecting RS-232-C devices.

-KM01 1 m long

-KM05 5 m long

-KM15 15 m long

YCB216

RS-232-C null modem cable (without control line) with 9- and 25-pin connectors ML gateway card (CP7�) for connecting RS-232-C devices

-KM01 1 m long

-KM05 5 m long

-KM15 15 m long

Note: These cables should be terminated for indoor use.

Pin no.Connector cover

(SD) 3

(RD) 2

(RS) 7

(CS) 8

(DR) 6

(SG) 5

(CD) 1

(ER) 4

Pin no.Connector cover

3 (SD)

2 (RD)

7 (RS)

8 (CS)

6 (DR)

5 (SG)

1 (CD)

4 (ER)

Remote DTED-sub 9-pin

Null-modem cableShield

F3RS22-0ND-sub 9-pin

Pin no.Connector cover

(SD) 3

(RD) 2

(RS) 7

(CS) 8

(DR) 6

(SG) 5

(CD) 1

(ER) 4

Pin no.Connector cover1 (FG)

2 (SD)

3 (RD)

4 (RS)

5 (CS)

6 (DR)

7 (SG)

8 (CD)

20 (ER)

Remote DTE

(D-sub 25-pin)

Null-modem cableShield

F3RS22-0ND-sub 9-pin

Page 21: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-6

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Diagrams of internal cable connections

� �

� Connecting to a Modem (DCE: Data Communication Equipment)

� Internal cable connection diagram for D-sub 25-pin remote equipment

Note: This example illustrates the case where the remote DCE uses D-sub 25-pin.

An example of a cable with the above internal connection is the YCB211 cable supplied by Yokogawa.

YCB216

PIN No.Connector cover

PIN No. Connector cover

Shield

3

2

7

8

6

5

1

4

1

2

3

7

FG

SD

RD

SG

CN1 side (FA-M3) CN2 side

SD

RD

RS

CS

DR

SG

CD

ER

YCB215

PIN No.Connector cover

PIN No. Connector cover

Shield

3

2

7

8

6

5

1

4

1

2

3

4

5

6

7

8

20�

FG

SD

RD

RS

CS

DR

SG

CD

ER

CN1 side (FA-M3) CN2 side

SD

RD

RS

CS

DR

SG

CD

ER�

Modem cablePin No.

Connector cover

(SD) 3

(RD) 2

(RS) 7

(CS) 8

(DR) 6

(SG) 5

(CD) 1

(ER) 4

Pin No.Connector cover1 (FG)

2 (SD)

3 (RD)

4 (RS)

5 (CS)

6 (DR)

7 (SG)

8 (CD)

20 (ER)

Remote DCE(D-sub 25-pin)

F3RS22-0N(D-sub 9-pin)

Page 22: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-7

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Internal cable connection diagram for D-sub 9-pin remote equipment

� Connecting using sheilded cables

(1) Use a cable with connectors housed in metal or metal-plated covers. Connect the shielded wire directly to the connector covers.

(2) Note that the connector shell of an F3RS22-0N module is connected internally to the FG (frame ground) terminal of an FA-M3 power supply module.

� Introduction to Yokogawa-supplied cables

The following modem cables are available from Yokogawa. The model codes, specifications and wiring diagrams of these cables are summarized below:

Model Name Suffix Code Specification YCB211 RS-232-C modem cable (without control line) with 9- and 25-pin connectors

ML gateway card (CP7�) for connecting modems. -KM01 1 m long

-KM05 5 m long

-KM15 15 m long

Note: These cables should be terminated for indoor use.

� Diagrams of internal cable connections

1

2

3

4

5

6

7

8

20

22

PIN No. Connector cover�

PIN No.Connector cover

3

2

7

8

6

5

1

4

9

Shield

CN1 side (FA-M3) CN2 side

FG

SD

RD

RS

CS

DR

SG

CD

ER

CI

SD

RD

RS

CS

DR

SG

CD

ER

CI

YCB211

(SD) 3

(RD) 2

(RS) 7

(CS) 8

(DR) 6

(SG) 5

(CD) 1

(ER) 4

3 (SD)

2 (RD)

7 (RS)

8 (CS)

6 (DR)

5 (SG)

1 (CD)

4 (ER)

Modem cablePin No.

Connector coverPin No.Connector cover

Remote DCE(D-sub 9-pin)

F3RS22-0N(D-sub 9-pin)

Page 23: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-8

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Notes on Wiring The connector shell of an F3RS22-0N module is connected internally to the FG terminal of an FA-M3 power supply module.

(1) When connecting the F3RS22-0N module via a modem: The module should be no more than 5 m away from the modem.

(2) When connecting the F3RS22-0N module not via a modem: Ground the module in common with the remote equipment.

(3) For conforming equipment incorporating the F3RS22-0N to CE Marking, use a shielded cable. Remove the cable cover to expose the wire, ground and secure the wire with a FG clamp.

F3RS22-0NRemove the coverand secure with anFG clamp.Shielded cable

Screw theclamp to themetal plate ofthe panelenclosure toground it.

FA-M3 Remote

equipment

JIS Class 3 grounding

(grounding resistance of 100 : or less)�

FG

Page 24: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-9

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

2.3 Attaching and Detaching Modules

� Attaching/Detaching Modules Figure 2.1 shows how to attach this module to the base module. First hook the anchor slot at the bottom of the module to be attached onto the anchor pin on the bottom of the base module. Push the top of this module towards the base module until the anchor/release button clicks into place.

CAUTION

Always switch off the power before attaching or detaching a module.

Figure 2.1 Attaching Modules

CAUTION

DO NOT bend the connector on the rear of the module by force during the above operation. If the module is pushed with improper force, the connector may bend causing an error.

� Detaching Modules To remove this module from the base module, reverse the above operation. Press the anchor/release button on the top of this module to unlock it and tilt the module away from the base module. Then lift the module off the anchor pin at the base.

Base module

Counter module

Anchor pin

F01.VSD

Page 25: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

2-10

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Attaching Modules in Intense Vibration Environments If the module is used in intense vibration environments, fasten the module with a screw. Use screws of type listed in the table below. Insert these screws into the screw holes on top of the module and tighten them with a Phillips screwdriver.

Screw Required � M4-size Binder screw 12 to 15 mm long

(or 14 to 15 mm if fitted with a washer)

Figure 2.2 Tightening the Module

F02R1.VSD

Page 26: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

3-1

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

3. F3RS41-0N Communication Module 3.1 Standard Specifications

� Model and Suffix Codes

Model Code Suffix Code Style Code Additional Code Remarks

F3RS41 -0N …… …… Max. 19200 bps, one RS-422-A/RS485 port

� Operating Environment F3RS41-0N can be used with the following CPU modules.

CPU Modules Style F3BP20 �

BASIC CPU module F3BP30 �

� Physical Specifications Item Specifications

Interface EIA RS-422A, EIA RS-485 compliant Number of communication ports 1 (isolated)

RS-422A RS-485 Maximum number of connectable drivers or receivers 1 driver

10 receivers 32 drivers 32 receivers

Transmission distance 1,200 m maximum

Connector Six-pole terminal block with 3.5-mm screws

Current consumption 210 mA (5 V DC)

Dimensions 28.9 (W) u 100 (H) u 83.2 (D) (mm) Weight 110 g

� Function Specifications Item Specifications Default

Connection Point-to-point (multipoint also allowed) �

Communication mode Full-duplex/half-duplex 4-wire sytem/2-wire system �

Synchronization Start-stop � Protocol Non-procedural �

Character length 7/8 bits 8 bits

Stop bit length 1/1.5/2 bits 1 bit Character frame

Parity bit None/odd/even Even

Transmission rate 75/150/300/600/1200/2400/4800/9600/19200 bps 4800

Transmitting buffer Can buffer one text item (maximum length of 1,024 bytes) � Communication

buffer Receiving buffer Rotary (FIFO) buffer of 2,048 bytes �

(to be continued on the next page)

Page 27: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

3-2

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Item Specifications Default

Starting character - Yes/no - One-character length; any character is acceptable No

Ending character (Terminator)

- Yes/no - Two-character length maximum; any character

(string) is acceptable - Also serves as an ending character during

transmission.

$0D x $0A (CR-LF)

Designation of number of characters

- Yes - Effective range: 1 to 1024 (over the communication

line) 1024

Monitored character-to-character time interval

- Configurable in 1-ms units; precision: 10 ms - Effective range: 0 to 32767 (if set to 0, there is no

monitoring of the character-to-character time interval)

1.5s

Receive text format

Character-to-character receiving interval time-out process

Processed as a communication failure/processed as the normal end of receiving

Normal end of receiving

Control method

(1) Uncontrolled (2) Receiving line only (3) Transmitting line only (4) Both transmitting and receiving lines

Uncontrolled

XON character $11(DC1)

XON/XOFF control

XOFF character One-character length; any character acceptable

$13(DC3)

Transmission code Internal code/ASCII code*1/JIS 8-bit code*2 Internal code (ASCII-equivalent)

Monitored time before I/O completion Configurable in 1-ms units from 1 to 32760 ms; precision: 10 ms 30 ms

Break transmission interval Configurable in 1-ms units from 1 to 32760 ms; precision: 10 ms 400 ms

End of receiving Interruption permitted/prohibited Prohibited

Receive failure Interruption permitted/prohibited Prohibited Interruption mask

Break receiving Interruption permitted/prohibited Prohibited

*1 During input, kana and kanji characters are replaced with spaces. *2 During output, kanji characters are replaced with JIS double-byte codes, while other characters not defined as JIS

characters are replaced with spaces. Note: JIS code systems: JIS X0201, JIS X0208

� Components and their Functions�

READY indicator:(lit when the internal circuit is innormal operation)

TERMINATOR

OFF2- 4-WIRE Teminating resistor selector switch:

When the module is terminal in theline, use this switch to select either"4-WIRE" or "2-WIRE."

SD B

SD A

RD A

SG

SHIELD

RD B RS-422/RS-485 terminal block(Six terminals with 3.5-mm screws)

RDY

RS422RS41-0N

Page 28: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

3-3

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� External Dimensions

(Unit: mm)

83.2 28.92

12.1

100

Page 29: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

3-4

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

3.2 External Wiring This subsection explains the point-to-point wiring methods.

For multi-point connection, see Section 4.6, “Multi-point Connections.”

For two-wire systems, register setting is required. See Section 4.6 "� Setting Registers".

� RS-422/RS-485 Terminal Block

Connection Terminal block

Applicable wire Size: 0.3 to 1.25 mm2 thick (AWG 22 to 18) Example: CO-SPEV-SB (A) 3P u 0.5 SQ from Hitachi Cable, Limited.

Wiring method Crimp-on Crimp-on terminal For 3.5-mm size Tightening torque 0.8 N. m

Crimp-on terminal

Applicable crimp-on terminal

Examples: V1.25-M3 from J.S.T. Mfg. Co. Ltd. RAV1.25-3.5 from Nippon Tanshi Co., Ltd.

� Four-Wire System

RD

SD

SD

RD

SDA

SDB

RDA

RDB

SG

SHIELD

SG

A

B

A

B

F3RS41-0N module’s port terminals Remote equipment

(RD A)

(RD B)

(SD A)

(SG)

(SD B)

Terminating resistor

SHIELD

Set the terminating resistor selector swtich to a 4-wire system.

SD A

SD B

RD A

RD B

SG

SHIELD SHIELD terminal

8.6mm

7.3mm

M3.5Send data A o

Send data B o

Send data Ao

Send data Bo

Signal ground

SD B

SD A

RD A

SG

SHIELD

RD B

Terminating resistor(built-in)

Page 30: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

3-5

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Two-Wire System

� Notes on Wiring (1) Ground the cable for the twisted pair at two ends (by connecting it to the SHIELD or

the FG terminal). The SHIELD terminal on the F2RS41-0N is connected to the FG terminal internally.

(2) The F3RS41-0N has a built-in terminating resistor (220�), which can be set to a 4-wire system or a 2-wire system using the terminating resistor selector switch.

(3) For conforming equipment incorporating the F3RS41-0N to CE Marking, use a shielded cable. Remove the cable cover to expose the wire, ground and secure the wire with a FG clamp.

CAUTION

Even if the F3RS41-0N module is properly connected, error such as a flashing LED may still occur because the signal polarities (represented as A/B) are reversed with respect to that of the remote equipment. In such case, change the connection accordingly.

3.3 Attaching and Detaching Modules See Section 2.3, "Attaching and Detaching Modules".

SG

RDB

SDA

SDB

RDA

SG

Remote equipment

A�

SG��

B��Terminating resistor�

F3RS41-0N module’s port terminals

A

B

SHIELD SHIELD

Set the terminating resistor selector swtich to a 2-wire system.

F3RS41-0N

Screw theclamp to themetal plate ofthe panelenclosure toground it.

Shielded cable

Remove the coverand secure with anFG clamp.

Terminating resistor(built-in)

Page 31: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Blank Page

Page 32: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-1

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

4. Using the Communication Module 4.1 Basic Communications

� Declaring Use of the Module Use the ASSIGN statement to declare use of the module.

ASSIGN module ID = S(, module ID=S, …)

Module ID: RS22…F3RS22–0N

RS41…F3RS41–0N

S: Slot number

(Example) ASSIGN RS22=5, RS42=6

An example is illustrated for F3RS22–0N in the sample program hereafter. F3RS41–0N can also be declared similarly since the difference lies only in the module ID of the ASSIGN statement.

� Resetting the Module The communication module can be reset using the RESET statement. Always reset the buffer after setting the communication conditions.

Table 4.1 RESET Statement Example (note) Communication

buffer Communication

conditions

Remarks Module Reset RESET 5 � � The communication conditions for the

module reverts to default.

Port Reset RESET 5, 1 � � The communication conditions for Port 1 reverts to default.

Buffer Reset RESET 5, 1, 1 � �� The communication condition remains unchanged.

Note: This example uses slot number 5 and port number 1. For the F3RS41–0N module, which has only one port, Module Reset and the Port Reset produce the same result.

� Setting Communication Conditions The communication conditions such as data transfer rate and parity must be set using software. Values for the communication conditions are written to and read from registers in the module using CONTROL/STATUS statements.

CONTROL S,P,R;Para

*: F3RS41-0N module does not support port 2.

STATUS S,P,R;Para

Setting value

Register number

Port number (1 or 2*)

Slot number

Storage variable (integer)

Page 33: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-2

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

(Example) When using slot number 5, port 2 at 9600bps, odd parity with 2 stop bits,

10 ASSIGN RS22=5

20 RESET 5,2 : !Port Reset

30 CONTROL 5,2,14;7 : !9600 bps

40 CONTROL 5,2,13;1 : !parity Odd

50 CONTROL 5,2,12;2 : !2 Stop bits

60 RESET 5,2,1 : !Buffer Reset

The main registers for setting the communication conditions are shown in Table 4.2.

See Table 4.7 in Section 4.4 for a list of all the registers.

Table 4.2 List of Main Registers for Setting Communication Conditions Data Position

Number Type of Register Contents Default Value

11 S/C Character length 0: 7 bits 1: 8 bits Others: 8 bits

1

12 S/C Stop bit length

0: 1 bit 1: 1.5 bits 2: 2 bits Others: 2 bits

0

13 S/C Parity

0: none 1: odd 2: even Others: even

2

14 S/C Data transfer rate (bps)

0: 75 1: 150 2: 300 3: 600 4: 1200 5: 2400 6: 4800 7: 9600 8: 19200 others: 19200

6

S/C: status/control register

� Output Use the OUTPUT statement to send text.

OUTPUT S,P;output data

(Example)

To send the character string “ABCDE” from slot 5, port 2,

OUTPUT 5, 2; “ABCDE”

The ending characters CR-LF (default value) are added and output on the line as shown below.

Numeric values or variables, or character strings or character string variables. Enclose numeric values or character strings within double quotes (“).

A B C D E CR LF

Page 34: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-3

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Input Use the ENTER statement to retrieve received text.

The ENTER statement extracts from the rotary buffer text. The text is delineated using the ending character, character-to-character time out or the number of characters received.

ENTER S,P;input variables

(Example)

To receive text from slot 5, port 2,

ENTER 5, 2; RCVDT$

The receive text from the rotary buffer is stored in the input variable RCVDT$ (string variable).

In the above example, the receive variable RCVDT$ is set as follows.

RCVDT$=”S1234”+CHR$($0D)+CHR$($0A)

Although the ENTER statement can be used alone for receiving, the system will remain in wait state until receive completes if the receive text is not in the rotary buffer. Hence, it is recommended that you use the ENTER statement together with the ON INT statement so that control transfers to the ENTER statement only when receive text has entered the rotary buffer.

Variables or array variables of numeric type or character string type.

S 1 2 3 4 CR LF

Page 35: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-4

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

4.2 Transmission Text and Format Specifications

� Data Output Data output is performed with the OUTPUT statement.

The OUTPUT statement can be used to specify the output format, as well as whether a terminator is to be appended and code conversion to be performed before output.

Table 4.3 Format Specification using the OUTPUT statement Type Statement Terminator Code Conversion

I OUTPUT S, P, ~ OUTPUT S P USING “~”, ~

appended automatically

Yes

II OUTPUT S, P, ~ OUTPUT S P USING “#,~”, ~

Not appended (appended by user)

Yes

III OUTPUT S, P NOFORMAT; ~ Not appended No (YM – BASIC/FA internal code)

S: Slot number P: Port number

� Type I

The output data undergoes code conversion, the terminator is appended automatically and the data is output to the line. If there is an image specification, it follows the image specification. For details on the format of the image specification, refer to the IMAGE statement in the user’s manual “BASIC CPU Modules and YM-BASIC/FA Programming Language” (IM34M6Q22-01E). The terminator can be specified as any character string of two or less characters. The default is CR-LF.

BASIC program Data on the line

10 ASSIGN RS22=5

20 A$=”ABCD”: B=100

30 OUTPUT 5,2;A$;B

40 OUTPUT 5,2 USING”3A,MDDZ.Z”;A$;B

Note: The above real variable B is converted to a character string before output.

� Type II

The output data undergoes code conversion before output. No terminator is appended. If a terminator is required, the user has to ensure that it is appended during output.

BASIC program

10 ASSIGN RS22=5

20 A$=”ABCD”: B=100 Data on the line 30 TERM$=CHR$($0D)

40 OUTPUT 5,2;A$;B;TERM$;

50 OUTPUT 5,2 USING”#,3A,MDDZ.Z,2A”;A$;B;TERM$

A B C D 1 0 0 CR LF

CR LF A B C 1 0 0 . 0

A B C D 1 0 0 CR

A B C 1 0 0 . 0 CR

Page 36: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-5

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Type III

The output data is output as internal code. No terminator is appended.

Code conversion is ignored, even if specified.

BASIC program Data on the line

10 ASSIGN RS22=5

20 A$=”ABCD”: B=100

30 OUTPUT 5,2 NOFORMAT;A$;B

� Data Input Data input is executed with the ENTER statement.

The ENTER statement can be used to specify the input format, as well as whether a terminator is to be removed and code conversion to be performed after input.

Table 4.4 Format Specification using the ENTER Statement

Type Statement Terminator Code Conversion

I ENTER S, P, ~ ENTER S P USING “~”, ~

No change Yes

II ENTER S, P, ~ ENTER S P USING “#,~”, ~

Removed automatically

Yes

III ENTER S, P NOFORMAT; ~ No change No S: Slot number P: Port number

� Type I

The data on the line undergoes code conversion and is stored into the input variable with the terminator attached as is. If there is an image specification, it follows the image specification. For details on the format of the image specification, refer to the IMAGE statement in the user’s manual “BASIC CPU Modules and YM-BASIC/FA Programming Language” (IM34M6Q22-01E).

(Example)

This example shows receiving of the following data on the line from port 2 of slot 5 where the terminator is CR-LF.

Data on the line BASIC program �

1000 ENTER 5,2;A$

1010 ENTER 5,2 USING 1020;B$;c;D$

1020 IMAGE 4A,6N,2A

The value of each variables is as shown below.

A$ = ”ABCD” + CHR$($0D) + CHR$($0A)

B$ = ABCD”

C = 100

D$= CHR$($0D) + CHR$($0A)

� Type II

The data on the line undergoes code conversion, the terminator (if present) is removed and the data is stored in the input variable. If there is an image specification, it follows the image specification For details on the format of the image specification, refer to the IMAGE statement in the user’s manual “BASIC CPU Modules and YM-BASIC/FA Programming Language” (IM34M6Q22-01E).

A B C D

Numeric data (internal code)

A B C D CR LF

CR LF A B C D 1 0 0 0 .

Page 37: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-6

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

(Example)

This example shows receiving of the following line data from port 2 of slot 5 when the terminator is CR-LF.

BASIC program Data on the line

1010 ENTER 5,2 FORMAT;A$

1020 ENTER 5,2 FUSING 1030;B$;C

1030 IMAGE 4A,6N

The value of each variable is as shown below.

A$=“ABCD”

B$=“ABCD”

C=100

� Type III

The data on the line does not undergo code conversion and is stored in the input variable unchanged. The terminator, even if present, is not removed.

(Example)

The example shows receiving of the following line data from port 2 of slot 5.

BASIC program Data on the line

10 DEFINT K

1010 ENTER 5,2 NOFORMAT;A$

1020 ENTER 5,2 NOFORMAT;K

The value of each variable is as shown below.

A$=“ABCD”+CHR$($0D)+CHR$($0A)

K=1

A B C D CR LF

A B C . 1 0 0 . 0 D CR LF

A B C D

CR LF

(no terminator)

Binary data ($0001)

Page 38: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-7

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

4.3 Efficient Communication

� Interrupt Input Interrupt Input performs input from the communication line and after receiving of the transmission text is completed, an interrupt is sent to the BASIC program. When Interrupt Input is used, the BASIC program can continue with other processing even whilst the actual communication process is executed by the module processor. The data is accepted after receiving has been completed, hence improving performance.

The following two statements are used for Interrupt Input.

(1) ON INT

This statement declares an interrupt and specifies the branch points for a port.

ON INT S,P CALL Subprogram name

Use the OFF INT statement to cancel an ON INT statement declaration.

OFF INT S,P

(2) ENABLE INTR

To pass the text saved in the buffer within the module to a BASIC program, the I/O interrupt request mask within the module must be switched to an unmasked state.

By executing this statement, when an interrupt to BASIC occurs, the received text saved in the buffer can be passed to BASIC using ENTER.

Since the corresponding I/O interrupt request mask switches to the masked state for every port reset and interrupt branching, set the unmasked state again using ENABLE INTR.

ENABLE INTR S,P;”x1 x2 x3”

S: slot number P: port number X2 and X3 may be omitted. They are zero when omitted.

1: Branching of interrupt using ON INT statement when receiving completes.

0: Interrupt is disabled. The received text is saved in the buffer.

1: Branching of interrupt using ON INT statement when error occurs during receiving. The received

text containing the error is discarded.

0: Interrupt is disabled. The received text containing the error is discarded.

1: Branching of interrupt using ON INT statement when a break is received. The received text

containing the break is discarded.

0: Interrupt is disabled. The received text containing the break is discarded.

GOSUB GOTO

Label

Line no.

Label

Line no.

Break received

Error during receiving

Receiving completed

x1

x2

x3

Page 39: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-8

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

10 DEFINT I

20 ASSIGN RS22=5

50 ON INT 5,2 GOSUB INT@ … Specify interrupt destination

70 ENABLE INTR 5,2;”111” … Remove interrupt mask

Main program

100 INT@

110 STATUS 5,2,2;I

120 IF I = 0 THEN Interrupt handling

130 ENTER 5,2,;REC$

140 ELSE

150 PRINT “RECEIVE ERROR”

160 ENDIF

170 ENABLE INTR 5,2;”111”

180 RETURN

Line 70 enables interrupts for all reasons. Once an interrupt is raised, any further interrupt from the corresponding port will be automatically disabled. Therefore, you need to re-enable the interrupt before you exit this subroutine.

If multiple interrupt reasons are enabled (unmasked), use the STATUS statement to read the interrupt request status (register number 2), to determine whether the ENTER statement can be executed. Executing the ENTER statement for any interrupt other than the End of the Receiving interrupt will cause an error since the receive text would already have been discarded.

� TRANSFER

� Proceeding Type

Module accessing using ENTER/OUTPUT is a complete return type of access where the BASIC program is in a wait state from the beginning of the operation to its completion.

Although this waiting can be avoided using ON INT/ENABLE INTR for the ENTER statement (during input), for the OUTPUT statement (during output), the BASIC program has to wait until the operation completes (see Figure 4.1). In such a situation, it is convenient to use the Proceeding type of access with TRANSFER/ON EOT.

In the Proceeding type of module access, the BASIC program merely starts the module communication whereas the processor within the card handles all subsequent input-output processing (see Figure 4.2). This type of access is particularly effective when the transmission text is long and the data transfer rate is low. Parallel input-output operation with other I/O cards is also possible.

Note the following when accessing using TRANSFER.

- Access to the corresponding port For a port started by TRANSFER, other accesses with the exception of HALT

(TRANSFER, OUTPUT, CONTROL, etc) are disallowed (causes an error) until the operation has completed. In the user program, manage the port with flags and check whether the port can be used during TRANSFER initiation. Completion of TRANSFER is reported by an ON EOT interrupt.

- Error during execution of TRANSFER

Errors during the execution of TRANSFER can be discovered by reading the status registers (register number 04) of the corresponding port during ON EOT branching. The set values are similar to the BASIC detailed error codes (82-XX). As there is

(Example)

Page 40: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-9

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

no ON ERROR branching, check the status register in the program.

Figure 4.1 Time Chart for Complete Return Type of Access

Figure 4.2 Time Chart for Proceeding Type of Access

� TRANSFER Procedure

The program procedure for input and output using TRANSFER is explained below. In both cases, input/output buffers and input/output variables are required in the user area.

- Output Procedure Data is output to the input/output buffer within the user area. Then, TRANSFER is started. Common variables cannot be used in the input/output buffer.

10 DEFINT I

20 DIM BUFF$256,A$256

30 A$=“ABCDE”

40 ASSIGN RS22=5

50 OUTPUT BUFF$;A$ … Output data to buffer

60 ON EOT 5,2 GOSUB RSEOT@ … Specify interrupt destination

70 TRANSFER 5,2FORMAT FROM BUFF$ … Initiate TRANSFER

Other processing

1000 RSEOT@ STATUS 5,2,4;IST

1010 IF IST<>0 THEN

1020 PRINT“TRANSFER ERROR”

1030 ELSE Interrupt processing for end of TRANSFER

1040 PRINT“TRANSFER END”

1050 ENDIF

1060 RETURN

CPU Free

CPU Busy

CPU Free

CPU Busy

Time Time Data Data

OUTPUT ENTER

BASIC program

in WAIT state

BASIC

program in

WAIT state

�� ��

CPU Free

CPU Free

CPU Busy

Transmission destination

CPU Busy

Transmission destination

Time Time &CVC�

ON EOT

TRANSFER FROM TRANSFER INTO

* Time until data arrives from remote equipment

��

ON EOT

��

&CVC�

Transmission destination

Transmission destination

* Time until data arrives from remote equipment

Page 41: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-10

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

- Input Procedure

Although interrupt branching using ON INT can be used in almost all situations, TRANSFER is useful when you need to perform input time monitoring (SET TIMEOUT/ON TIMEOUT) processing. Normally, interrupt input using ON INT is used.

Data is output into the input/output buffer first and then read using ENTER. Common variables cannot be used in the input/output buffer.

10 DEFINT I

20 DIM BUFF$ 256,A$256

30 ASSIGN RS22=5

40 ON EOT 5,2 GOSUB RSEOT@ … Specify interrupt destination

50 TRANSFER 5,2 INTO BUFF$ … Initiate TRANSFER

Other processing

1000 RSEOT@ STATUS 5,2,4;IST

1010 IF IST<>0 THEN

1020 PRINT “TRANSFER ERROR!”

1030 ELSE Interrupt processing for end of

TRANSFER

1040 ENTER BUFF$;A$

1050 PRINT A$

1060 ENDIF

1070 RETURN

� Format Specification When specifying the format such as the addition of terminator in a TRANSFER statement, match it with the format specification of the ENTER/OUTPUT statement used for buffer input/output.

For details on the operation of each individual format type, see Section 4.2.

Table 4.6 Format Specification on Output

Type Format Specification of OUTPUT Format Specification of TRANSFER Terminator Code

Conversion I OUTPUT BUFF$

OUTPUT BUFF$ USING “~“; ~ TRANSFER S, P FORMAT FROM BUFF$

Appended automatically

Yes

II OUTPUT BUFF$ OUTPUT BUFF$ USING “#, ~“; ~

TRANSFER S, P FROM BUFF$ Not appended (appended by user)

Yes

III OUTPUT BUFF$ NOFORMAT; ~

TRANSFER S, P NOFORMAT FROM BUFF$

Not appended No (YM. BASIC/FA internal code)

S: slot number P: port number BUFF$: name of I/O buffer

Table 4.6 Format Specification on Input

Type Format Specification of ENTER Format Specification of TRANSFER Terminator Code

conversion I ENTER BUFF$; A$

ENTER BUFF$ USING “~“; A$ TRANSFER S, P INTO BUFF$ Appended

automatically Yes

II ENTER BUFF$ FORMAT; A$ ENTER BUFF$ USING “~“; A$

TRANSFER S, P FORMAT INTO BUFF$

Not appended (appended by user)

Yes

III ENTER BUFF$ NOFORMAT; A$ TRANSFER S, P NOFORMAT INTO BUFF$

Not appended No (YM. BASIC/FA internal code)

S: slot number P: port number BUFF$: name of I/O buffer

Page 42: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-11

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

4.4 Using Registers F3RS22-0N and F3RS41-0N have many registers for handling various aspects of transmission. This section describes the use of these registers.

� List of Registers Register Number

Register Type Contents Default Value

01 S Input wait status 0 : no others : waiting for input

0

02 S Interrupt request status 0 : receive terminated normally 1 : error during receiving 2 : break received

0

03 S Input data status

Bit 5 : framing error Bit 4 : overrun error Bit 3 : parity error Bit 2 : internal buffer overflow Bit 1 : character-to-character receiving interval timeout Bit 0 : break received A bit is “1” when the corresponding error occurs.

0

04 S Output processing data status

Output status for OUTPUT/TRANSFER statement =0 : sending terminated normally z0 : sending terminated abnormally

0

05 S Input processing data status

INPUT status for ENTER/TRANSFER statement =0 : receiving terminated normally z0 : receiving terminated abnormally

0

06 S/C Transmission code 0 : internal code 1 : ASCII 2 : JIS 8 unit

0

07 S/C Character-to-character receiving interval timeout . processing

0 : receive terminated normally 1 : error during receiving 0

11 S/C Character length 0 : 7 bits 1 : 8 bits Others : 8 bits

1

12 S/C Length of stop bits

0 : 1 bit 1 : 1.5 bits 2 : 2 bits Others : 2 bits

0

13 S/C Parity

0 : none 1 : odd 2 : even Others : even

2

14 S/C Data transfer rate (bps)

0 : 75 1 : 150 2 : 300 3 : 600 4 : 1200 5 : 2400 6 : 4800 7 : 9600 8 : 19200 others : 19200

6

F3RS22-0N RS control 0 : always ON 1 : ON only when sending 0

15 S/C F3RS41-0N Send/receive

control See Section 4.6 � Setting Registers

F3RS22-0N RS control 0 : ER=OFF 1 : ER=ON 1

16 S/C F3RS41-0N Send/receive

control See Section 4.6 � Setting Registers

17* S/C DR check 0 : transmits regardless of the state of DR 1 : transmits only when DR is ON 0

18* S/C CD check 0 : transmits regardless of the state of CD 1 : transmits only when CD is OFF 0

19* S/C Transmission enabled monitoring time (DR control monitoring)

0 : no time-monitoring 1 to 32760 (ms) 0

Page 43: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-12

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Register Number

Register Type Contents Default Value

20 S/C Time for sending break signal

1 to 32760 (ms) 400

21 S/C Starting character for receive text

All zeroes when no starting character is specified

0

22 S/C Ending character (terminator)

- First ending character = 0 when there is only one character - All zeroes when no ending character is specified

$0D x $0A ( CR x LF )

23 S/C Number of receive characters

1 to 1024 (number of characters on the line) 1024

24 S/C Monitored character-to-character time interval

0 to 32760 (ms) (no character-to-character monitoring when value is 0) 1500

25 S/C XON/XOFF control

0 : No control 1 : Receiving end only 2 : Transmitting end only 3 : Both transmitting end and receiving end

0

26 S/C XON/XOFF characters

$11 x $13 (DC1 x DC3)

101 C Send break 1 : start break sending � S: status register, C: control register, S/C: status/control register *: Not available for F3RS41-0N

� Format of Received Text The communications module detects the end of the received text and recognizes the text in any of the following ways.

� Terminator received

The module identifies the end of text when the terminator (end-of-text character) is received. The default value is CR-LF.

(Example) When the terminator is set to EXT ($03)

10 ASSIGN RS22=5

20 CONTROL 5,2,22;$0003 :!Set terminator.

30 RESET 5,2,1 :!Reset buffer.

Received data

A B C E F G ETX D ETX

Text 1 Text 2

15 8 7 0

0 Starting

character

15 8 7 0

first ending character

second ending character

15 8 7 0

XON XOFF

Page 44: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-13

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Specification of number of receive bytes

The end of text is assumed when the specified number of bytes (1 to 1024) is received.

When the starting character for receive text is specified, the counting of the received bytes starts from that character.

(Example 1) When the number of received bytes is set to 4 bytes:�

10 ASSIGN RS22=5

20 CONTROL 5,2,23;4 :!Specify number of received bytes.

30 RESET 5,2,1 :!Reset buffer.

(Example 2) When the starting character is set to STX ($02), the number of received bytes is set to 6 and the terminator is set to ETX ($03):

10 ASSIGN RS22=5

20 CONTROL 5,2,21;$0002 :!Specify starting character for received text.

30 CONTROL 5,2,23;6 :!Specify number of received bytes.

40 CONTROL 5,2,22; $0003 :!Set the terminator.

50 RESET 5,2,1 :!Reset buffer.

� Character-to-character receiving interval timer

The character-to-character receiving interval timer monitors the character-to-character receiving time interval. When the next character is not received within the specified time, end of text is assumed. This mode is useful for binary communications and text with no terminator.

(Example) Received data (no terminator), character-to-character timer is 1 second 10 ASSIGN RS22=5

20 CONTROL 5,2,22;$0000 :!Set the terminator (no terminator).

30 CONTROL 5,2,7;0 :!Specify receive character-to-character

timeout processing

40 CONTROL 5,2,24;1000 :!Specify monitored character-to-character

receiving time interval.

50 RESET 5,2,1 :!Reset buffer.

A C F G H E

Text 1

D

Received data

Text 2

STX P Q U STX E S

Text 1

A B R N D ETX

(6 bytes of received characters)

(Terminator received) �

Discarded

Terminator (End of Text)

If data is sent during this period, They are not received as text.�

Time specified

Received data (with no terminator)

1000 ms Not considered a receive error even if timeout occurs

Text 2

B

Starting character for receive text

Starting character for receive text

Page 45: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-14

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� XON/XOFF Control This feature prevents overflow in the communication buffer through the exchange of special characters. This feature only applies in full duplex communications.

Table 4.8 XON/XOFF Operation Classification Operation

Receiving end When the space in the input buffer falls below one quarter, transmit XOFF . When the space in the input buffer rises above half, transmit XON. When data is received in the XOFF state after XOFF transmission, the XOFF character is retransmitted. The character-to-character timer is inactive in the XOFF state and becomes active once XON is received.

Transmitting end

After the specified XOFF character is received, sending is stopped within 2 characters. The received XOFF character is not passed as receive text to BASIC.

The system will switch to the XON state when power is switched on or when the module, port or buffer is reset. Any single character can be set as the XON/XOFF character. (default is DC1/DC3).

(Example) When using XON/XOFF control for both sending and receiving characters

10 ASSIGN RS22=5

20 CONTROL 5,2,25;3 :!Specify XON/XOFF control.

30 RESET 5,2,1 :!Reset buffer

However, XON/XOFF control is only available in character communications. The XON/XOFF characters are not sent during text transmission.

� Break Signal The break signal is a special signal that sends data containing a type of framing error (all bits are “1”). This communication module handles break signal on both sending and receiving.

� Sending a break

(example) Send the break signal after a 300 ms interval

1000 CONTROL 5,2,20;300 :!Specify send time for break signal

1010 CONTROL 5,2,101;1 :!Specify to send a break

� Receiving a break

Receiving a break signal causes an error (82-D4: receive error).

However, it can also be identified using an interrupt input. For details, see Section 4.3

Page 46: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-15

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

4.5 Special Communications

� Long Text Be careful when handling long text (exceeding 512 bytes). All the following conditions must be satisfied during sending.

- Data size transferred from a BASIC program to the communications driver is less than 1 KB (including terminators)

- Line data after code conversion is less than 1 KB (including terminators)

(Example 1) Simple string variable

10 DIM A$512,B$500,

100 OUTPUT 5,2;A$;B$

(Example 2) An entire array

10 OPTION BASE1

20 DIM BUFF$ 500(2)

100 OUTPUT 5,2;BUFF$(*)

Similarly, during receiving, all the following conditions have to be satisfied.

- Line text is less than 1 KB (including terminators)

- Data size transferred to the input variable of the BASIC program is less than 1 KB (including terminators)

In the YM-BASIC/FA language specifications, a string variable has a maximum size of 512 bytes. Therefore, the input is performed by specifying 2 or more variables. Note that if a 2-byte code (Katakana, Kanji, etc.) spans a variable boundary, the character cannot be read.

(Example 1) Simple string variable

10 DIM A$512,B$512

20 ASSIGN RS22=5

30 ENTER 5,2;A$,B$

(Example 2) An entire array

10 OPTION BASE 1

20 DIM BUFF$512(2)

30 ASSIGN RS22=5

40 ENTER 5,2;BUFF$(*)

� Binary Transmission Binary transmission sends binary bit patterns instead of character codes on the line. It is used primarily for sending numeric data. It can be sent in the NOFORMAT specification (Type III).

It can be received in the NOFORMAT specification (Type III) without any terminator and using the character-to-character interval timer.

Under normal circumstances, use fixed text length transmission. In the case of variable-length text, the text length can be determined with the IOSIZE function. XON/XOFF control is not available during binary transmission.

Page 47: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-16

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Handling Null Codes In the YM-BASIC language specifications, the BASIC interpreter treats a null code ($00) as a character string delimiter. If there is a null code embedded in a character string, the null code and all subsequent characters are ignored. This is also the case during binary transmission.

For sending and receiving with null codes, integer arrays can be used as input/output variables. However, note that access will be on a word boundary (2-bytes unit) in this case.

A$="X"+CHR($00)+"Y"

is the same as

A$="X"+"Y"

To send null codes, use the following methods.

(1) Using an integer array as the output variable

Using the NOFORMAT specification, send word-bounded data as given below.

10 OPTION BASE 1

20 DEFINT K

30 DIM K(2)

100 K(1)=ASC("X")

110 K(2)=0

120 OUTPUT slot,port NOFORMAT;K(1)*256+K(2)

Note that, in the above example, when a character string with an odd number of characters is sent, a null character is appended to the end so that there is an even number of characters in the string.

(2) Specifying data in bytes

Send data in bytes using image setting as shown below.

OUTPUT slot,port USING "#,B";K(*)

This method sends all data in array K(*) defined in the Dimension (DIM) statement.�

To send variable size data, use a program as shown below.

200 II=5

210 FOR I=1 To II

220 OUTPUT slot,port USING "#,B";K(I)

230 NEXT I

This method sends only the required characters, taking into consideration the character-to-character timeout.

Page 48: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-17

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Inserting Binary Data into Text One example is the entry of BCC (Block Check Character) at the end of the text. This can be done conveniently using the IMAGE B, W specifications (Type II).

IMAGE B, W specification is only effective in the following situation and cannot be used in other situations. It has to be processed as binary transmission.

- Fixed length transmission text

- Character code is YM-BASIC/FA internal code

- XON/XOFF control is not used

Page 49: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-18

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

4.6 Multi-point Connection Besides point-to-point (1:1) connections, multi-point (n : n) connections are also supported in F3RS41-0N.

� External Connection F3RS41-0N conforms to the RS-422-A and RS-485 standards. The number of possible connections for the respective specifications are as shown in Table 4.9.

Table 4.9 Number of Connections Allowed

1: n n: n

RS-422-A 1 : 10

RS-485 1 : 32 32 : 32

Two types of external connection mode are supported, namely, 4-wire and 2-wire.

The 4-wire connection is 1: n where there are n substations for 1 master station.

The 2-wire connection is n : n which includes 1 : n.

Figure 4.3 shows the respective connection examples.

For the 4-wire connection, the send/receive signal wires from the master station to the substations have to be crossed.

For the 2-wire connection, send/receive signals of similar polarities are connected in the terminal block in this module. Only 2 wires are laid externally.

*1: Connect the shielded cables to both ends of the ground terminals of FG or SHIELD terminals. *2: For more information on terminating resistors, see Section 4.6, “� Setting Terminating Resistors” *3: For conforming equipment incorporating the F3RS41-0N to CE Marking, use shielded cables.

For more information, see Section 3.2, “External Wiring”. Figure 4.3 Multipoint Interconnections

(SHIELD)

SD A

SD B

RD A

RD B

(Substation 1)Remote equipment

Four-wire multipoints(Master station)

RS42-0N/F3RS41-ON port terminal

A

SD

SD

B

RD A

RD B

A

SD

SD

B

RD A

RD B

S G

F G

S G

F G

S G

F G

SD A

SD B

RD A

RD B

S G

*1 FG

*2

*2

(SD A)

(SD B)

(RD A)

(RD B)

(SG)

*2

*2

(SHIELD)

A

B

A

B

(A)

(B)

(SG)

A

B

S G

F G

S G

F G

S G

F G

SD A

SD B

RD A

RD B

S G

*1 FG

*2

(A)

(B)

(SG)

*2(A)

(B)

(SG)

(SD A)

(SD B)

(RD A)

(RD B)

(SG)

(SD A)

(SD B)

(RD A)

(RD B)

(SG)

(Substation 2)Remote equipment

(Substation n)Remote equipment

(Station 2)Remote equipment

(Station 3)Remote equipment

(Station n)Remote equipment

Two-wire multipoints(Station 1)RS42-0N/

F3RS41-0N port terminal

Page 50: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-19

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Setting Registers Depending on the configuration of the external connection, 3 types of modes can be used in this module, namely 4-wire master station, 4-wire substation and 2-wire. If the register settings corresponding to the three modes are not performed, normal communication is not possible.

The register settings corresponding to the different modes are performed according to the details in Table 4.10 using registers 15, 16.

Table 4.10 Setting Registers

0 1

0 Setting not allowed 2-wire 1 4-wire master

station (default) 4-wire substation

� Setting of terminating Resistors Terminating resistors in multi-point connections (including point-to-point connections) have to be set at stations located on the respective communication routes.

In the 4-wire system, set the terminating resistor at the master station and substation n in Figure 4.3.

For intermediate substation 1 to substation (n-1), remove the terminating resistor. Otherwise, normal communications may not be possible.

In the case of F3RS41-0N, the terminating resistor is built-in and is controlled by a switch. Set the switch to “4-WIRE” for terminal stations and “OFF” for the rest (see Figure 4.5).

In the 2-wire system, set the terminating resistor at station 1 and station n as in Figure 4.3. Ensure that the terminating resistor is removed from station 2 to station (n-1).

In the case of F3RS41-0N, the terminating resistor is built-in. Set the switch to “2-WIRE” for terminal stations and “OFF” for the rest (see Figure 4.5).

Figure 4.5 Setting Terminator Switch (For F3RS41-0N Module)

Register 16

Register 15

TERMINATOR

OFF2- 4-WIRE

SD B

SD A

RD A

SG

SHIELD

RD B

RDY

RS422RS41-0N

OFF

2- 4-WIRE

TERMINATOR

Page 51: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-20

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� Protocol Processing When using multi-point connections on the F3RS41-0N, protocol (communication control procedure) is essential to prevent line conflicts along the transmission route.

Although FA-M3 provides the physical interfaces, it does not support protocol processing in the system. Therefore, protocol control must be described using a BASIC program. Normally, the polling selection method is used.

- When transmitting from F3RS41-0N to the remote equipment, the equipment number must be set to identify the destination. The equipment number refers to the identification number assigned to the remote equipment. The remote equipment must be identified in advance according to its unique identification number by some means.

- The text formats containing the equipment number vary according to the individual protocols.

�The following example illustrates communication between F3RS41-0N (master station) and 2 remote equipment (substations).

F3RS41-0N polls the 2 remote equipment for any data to be sent. If there is data to be sent from the remote equipment, the data is read.

Here, the command for reading the status from the remote equipment is “DS” while the command for reading the data from the remote equipment is “RD”. An example of the text format is shown below.

� Text Format

This text format example uses control characters. Control characters are optional.

SOH:start of header

STX:start of text

ETX:End of text

� When F3RS41-0N reads the status of the remote equipment (command: DS)

- “Status” refers to contents sent from the remote equipment to F3RS41-0N.

“Status” can assume the values of “receive completed”, “receive error” and “send data exists”. “Send data exists” refers to the flag which indicates whether there is any data to be sent from the remote equipment to F3RS41-0N.

Dev

ice

No.

S O H

S T X

DS E T X

S O H D

evic

e no

. S T X

DS Status E T X

Command

Command

F3RS41-0N

Remote equipment

Application

Protocol

Physical interface

FA-M3

Range over which

application

program is used

Rem

ote

equi

pmen

t

R

emot

e eq

uipm

ent

Page 52: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-21

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

� When F3RS41-0N reads data from the remote equipment (command: RD)

- “DATA” refers to contents sent from the remote equipment to F3RS41-0N.

� Timing Chart

The program is as shown below

10 DEFINE A-Z

20 SLOT=5:PORT=1

30 ASSIGN RS42=SLOT

40 CONTROL SLOT,PORT,14;7 :! 9600bps

50 CONTROL SLOT,PORT,22;$003 :! Terminator = ”ETX”

60 RESET SLOT,PORT,1 :! Reset buffer

70 ON INT SLOT,PORT GOSUB ENTSTS@ :! Declare interrupt and set branch

points

80 ENABLE INTR SLOT,PORT;“111” :! Enable interrupt

90 MNUMBER$=“01” :! Device number

100 COMMAND$=“DS” :! “DS”; Read Status command

110 GOSUB SND@

120 WAIT

(to be continued on the next page)

Command

S O H

1

Dev

ice

No.

S O H

DS

Dev

ice

No.

RS DATA

Command

Command

Remote equipment

S T X

E T X

S O H

S T X

E T X

F3RS41-0N

S T X

DS E T X

S O H

S T X

DS

Status E T X

F3RS41- 0N

Remote equipment 1

1

S O H

S T X

DS E T X

2

S O H

S T X

DS

Status E T X

2

S O H

S T X

RD E T X

2

S O H

S T X

RD DATA E T X

Command

2

Device

Device

Remote equipment

Page 53: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

4-22

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

1000 ENTSTS@ :! Interrupt handling subroutine

1010 STATUS SLOT,PORT,2;IREC :! Interrupt request status

1020 IF IREC=0THEN :! Normal receive?

1030 GOTO ENTDAT@ :! Goto Receive Data

1040 ELSE

1050 DP“Error or break received.”

1060 GOTO RTN@

1070 ENDIF

1080 ENTDAT@

1090 ENTER SLOT,PORT;RCVDAT$

1100 RCVMNUM$=MID$(RCVDAT$,3,2) :! Extract device no.

1110 IF RCVMNUM$ <> MNUMBER$ THEN GOTO RTN@ :! Do not process error device no.

1120 RCVCMD$= MID$(RCVDAT$,7,2) :! Extract command

1130 IF RCVCMD$=“DS”THEN

1140 RCVSTS$=MID$(RCVDAT$,9,1) :! Extract status

1150 RST=VAL(RCVST$) :! Check “send data exists” flag

1160 RST=BINAND(RST,$04) :!

1170 IF RST=4 THEN :!

1180 COMMAND$=“RD” :! “RD”; Read Device Data command

1190 GOSUB SND@

1200 ENDIF

1210 ENDIF

1220 RTN@

1230 ENABLE INTR SLOT,PORT;“111”SND@

1240 RETURN

2000 SND@ : ! Send routine

2010 SNDDAT$=CHR$(01)+MNUMBER$+CHR$(02)+COMMAND$:! Create text ”SOH”

+ ”Device no.” + ”STX” + ”Command”

2020 OUTPUT SLOT,PORT;SNDDAT$

2030 RETURN

3000 END

Page 54: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

5-1

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

5. BASIC Statements and Error Codes 5.1 BASIC Statements

Table 5.1 BASIC Statements BASIC Statement Functions

ENTER S,P Data input OUTPUT S,P Data output TRANSFER S,P Start data input / output ON EOT S,P Enable program branching on completion of data transfer OFF EOT S,P Disable program branching on completion of data transfer ENABLE INTR S,P Mask / unmask receive interrupt for all ports

Mask / unmask receive interrupt for specified ports ON INT S,P Enable program branching for receive interrupt OFF INT S,P Disable program branching for receive interrupt SET TIMEOUT S,P Set the maximum wait time for response from interface ON TIMEOUT S,P Enable program branching on timeout OFF TIMEOUT S,P Disable program branching on timeout

S Module reset … initialization of the communication buffer and communication conditions for all ports

S,P[,0] Port reset … initialization of the communication buffer and communication conditions for specified ports

RESET

S,P,1 Buffer reset … initialization of only the communication buffer HALT S,P Cancels output operation initiated with the TRANSFER statement STATUS S,P,R Refer to status registers CONTROL S,P,R Change control registers

S: slot number P: port number R: register number

Page 55: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

5-2

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

5.2 Error Codes The following table lists the error codes for F3RS22-0N and F3RS41-0N together with a short description and the possible causes.

Table 5.2 Error Codes Error Code

Detailed Error Code Description Possible Causes

82 Error in function specification

- An attempt was made to execute a command that is not supported. - Specification of slot number and port number clashes with other I/O modules.

91 Parameter error - Port number is invalid. - A non-existent register number is specified in a CONTROL or STATUS statement.

9D ASSIGN statement not executed

- ASSIGN statement has not been executed or an invalid slot number was assigned.

D1 Module not installed

- Module is not connected. - Slot number is invalid.

C1 User buffer overflow

A data larger than the buffer in BASIC is received.

C7 Reset detected - Only the module side detected a power failure and performs a reset start, this leads to inconsistency between the parameters at the module side and driver side.

Parity error - The setting of the parity bit is different at the sending side and receiving side.

Framing error - The length of data bit, length of stop bit and the data transfer rate are different at the sending and receiving sides.

Overrun error - Received data overflows the receiving buffer. Internal buffer overflow

- Despite continual sending of data, data overflows buffer at BASIC.

Character-to-character receiving interval timeout

- With the character-to-character receiving interval timeout processing set to Receive Error, data such as the ending character or the number of specified characters is not received, resulting in timeout.

D4 *

Break received - Remote side has sent a break signal E1 Self-diagnosed

error - Error occurs because of self-diagnosis (memory check) in the regular state.

E2 Module busy - A command other than HALT is executed for the port during TRANSFER. Line busy - When CD check is 1 and the monitored time z 0, and CD is not turned off

within the.preset time period. - When DR check is 1 and the monitored time z 0, and DR is not turned on within the preset time period.

82

E6

Timeout - Cable is not connected. (1) Receiving side When waiting to receive in the ENTER statement, the remote side did not send within the I/O monitored time period. (2) Sending side - CS is OFF. - When CD check is 1 and the monitored time = 0, and CD is ON. - When DR check is 1 and the monitored time = 0, and DR is OFF. (caused by faulty cables or remote equipment)

The contents can be classified by referring to the STATUS register (register number 3) (see “� Using Registers” in Section 4.4).

Page 56: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

5-3

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

5.3 Sample Programs The following shows an example for F3RS22-0N. The program can be used similarly for F3RS41-0N (point-to-point) by declaring the use of RS41 in the ASSIGN statement.

� Explanations for the sample programs

Send (1) : Send with complete return access using the OUTPUT statement.

Send (2) : Send with proceeding access using the TRANSFER / ON EOT statements.

Receive (1) : Receive text input with complete return access using only the ENTER statement.

Receive (2) : Receive text input with interrupt input using ENTER, ON INT / ENABLE INTER statements.

� �

100 ! F3RS22-0N Example SEND (1)

110 !

120 DIM SENDBUF$256

130 SLOT = 3 : PORT = 2

140 !

150 ! Set communication conditions

160 ASSIGN RS22 = SLOT :! Assign card

170 CONTROL SLOT, PORT, 14; 7 :! 9600bps

180 CONTROL SLOT, PORT, 13; 2 :! Even parity

190 SET TIMEOUT SLOT. PORT; 3000 :! Timeout 3 seconds

200 RESET SLOT, PORT, 1 :! Reset buffer

210 !

220 ! Send Data

230 SENDBUF$ = “ABCDEFGhijkl – 0123456789”

240 OUTPUT SLOT, PORT; SENDBUF$ :! complete return access (Type I)

250 END BSC : LIST

100 ! F3RS22-0N Example SEND (2)

110 !

120 DEFINT I

130 DIM SENDBUF$256, OUT$256

140 SLOT = 3 : PORT = 2

150 !

160 ! Set communication conditions

170 ASSIGN RS22 = SLOT :! Assign card

180 CONTROL SLOT, PORT, 14; 7 :! 9600bps

190 CONTROL SLOT, PORT, 12; 2 :! 2 stop bits

200 SET TIMEOUT SLOT. PORT; 3000 :! Timeout 3 seconds

210 RESET SLOT, PORT, 1 :! Reset buffer

220 !

230 ! Send Data

240 SENDBUF$ = “ABCDEFGhijkl – 0123456789”

250 OUTPUT OUT$; SENDBUF$ :! Output to buffer

260 ON EOT SLOT, PORT GOSUB EOT@ :! Interrupt for end of transfer

270 TRANSFER SLOT, PORT FORMAT FROM OUT$ :! Start (type I)

280 !

290 ! Other processing

300 WHILE IEND = 0

310 WAIT

320 END WHILE

330 STOP

Page 57: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

5-4

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

340 EOT@ STATUS SLOT, PORT, 4; IOUT :! Interrupt raised because end of output

350 IF IOUT <> 0 THEN

360 DISP “Transfer error !!”, HEX$(IOUT)

370 ELSE

380 DISP “Transfer end”

390 ENDIF

400 IEND = 1

410 RETURN

420 END

100 ! F3RS22=0N Example RECEIVE (1)

110 !

120 DIM REC$256

130 SLOT = 3 : PORT = 2

140 !

150 ! Set communication conditions

160 ASSIGN RS22 = SLOT :! Assign Card

170 CONTROL SLOT, PORT, 14; 7 :! 9600bps

180 CONTROL SLOT, PORT, 13; 0 :! No parity

190 CONTROL SLOT, PORT, 12; 2 :! 2 stop bits

200 SET TIMEOUT SLOT. PORT; 3000 :! Timeout 3 seconds

210 RESET SLOT, PORT, 1 :! Reset buffer

220 !

230 ! Receiving (Complete Return Type)

240 SET STATUS ERR

250 ENTER SLOT, PORT FORMAT; REC$ :! Receive (Type II)

260 IF ERR = 82 THEN

270 IF ERRCE <> $E6 THEN

280 DISP “error”, HEX$(ERRCE)

290 ELSE

300 GOTO 250

310 ENDIF

320 ELSE

330 DP “time”; TIME$, “receive data”; REC$

340 ENDIF

350 RESET STATUS

360 END

100 ! F3RS22-0N Example RECEIVE (2)

110 !

120 DEFINT I

130 DIM REC$256

140 SLOT = 3 : PORT = 2

150 !

160 ! Set communication conditions

170 ASSIGN RS22 = SLOT :! Assign card

180 CONTROL SLOT, PORT, 14; 7 :! 9600bps

190 CONTROL SLOT, PORT, 12; 2 :! 2 stop bits

200 SET TIMEOUT SLOT. PORT; 3000 :! Timeout 3 seconds

210 RESET SLOT, PORT, 1 :! Reset buffer

220 !

230 ! Interrupt Declaration

240 ON INT SLOT, PORT GOSUB REC@

250 ENABLE INTR SLOT, PORT; “111”

260 !

270 WHILE IEND = 0

Page 58: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

5-5

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

280 WAIT

290 END WHILE

300 STOP

310 !

320 REC@ ! INTERRUPT INPUT SUBROUTINE

330 STATUS SLOT, PORT, 2; IREC :! Interrupt branch condition

340 IF IREC = 0 THEN :! Normal receive?

350 ENTER SLOT, PORT FORMAT; REC$ :! Receive (type II)

360 DP “time”; TIME$, “receive data”; REC$

370 ELSE

380 DISP “error or break received”

390 ENDIF

400 ENABLE INTR SLOT, PORT; “111”

410 IEND = 1

420 RETURN

430 END

Page 59: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Blank Page

Page 60: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Appx.1-1

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Appendix 1. Signal Description and Direction of Signal Lines (RS-232-C)

The following figure and table describe the RS-232-C signals and the signal directions for the F3RS22-0N module.

The selection of the direction of signal lines (only for those that are selectable) is performed with software setting.

In the following figure, signal lines between ER to CD (inclusive) are control lines whilst SD and RD are data lines.

Figure appx. 1 RS-232-C Signals

Table appx. 1 Direction of RS-232-C Signal Lines Pin Number F3RS22-0N Mnemonic Signal Name Input

/Output Signal

Monitoring Function

3 SD Send Data Output � 2 RD Receive Data Input � 7 RS Request to

Send Output � Used when sending data to the remote side.

(1) Always ON (default). (2) ON only during sending.

8 CS Clear to Send Input � Signal from the remote side granting permission to send. Cannot send if this signal is not ON.

6 DR Dataset Ready Input � Used to check whether the remote side can transmit. (1) Send regardless of the state of DR (default). (2) Send only when DR is ON.

5 SG Signal Ground � � 1 CD Data Carrier

Detect Input � If this signal is not on, a carrier wave is not

received. Sending may proceed as follows: (1) Send regardless of the state of CD (default) (2) Send only when CD is OFF.

4 ER Data Terminal Ready

Output � (1) Turns on at power-on and stays on (default). (2) Can be turned on or off using software.

F3RS22-0N

ER (FA-M3 ready)

DR (destination ready)

RS (request to send…ready to receive?)

CS (clear to send…ready to receive)

CD (data carrier detection)

Remote equipment

computer,

modem, etc.

SD (send data)

RD (receive data)

Page 61: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Appx.2-1

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Appendix 2. Data Transmission

Start-Stop Synchronous Transmission

The F3RS22-0N and F3RS41-0N modules transmits using a start-stop synchronous mode.

When a character is transmitted in start-stop synchronization, a start bit is first transmitted, followed by the character bits (7 to 8 bits) in descending sequence, the parity bit and the stop bit(s). The start bit, parity bit and stop bit(s) are automatically inserted by the module and are transparent to the user.

The transfer data rate, data bit length and other communication parameters are set using software.

Figure appx. 2 Start-Stop Synchronous Transmission

� Text

Transmission data usually consists of multiple characters terminated by a terminator (ending character), known as text, and recognized by the user as a piece of data. The maximum length of text data is 1024 bytes.

Figure appx.3 Example of One Character

1

0

Line idle

Start bit

LSB, Least significant bit

Character data (7 to 8 bits)

1 character

Odd, even or unused

Stop bit

Parity bit

1

1.5

2

Line returns to idle state (dotted line) or carries the start bit of the next character (solid line)

A B C D CR LF

1 text data

1 character Terminator

Page 62: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Appx.3-1

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Appendix 3. ASCII Codes

b6 0 0 0 0 1 1 1 1 b5 0 0 1 1 0 0 1 1 Bit b4 0 1 0 1 0 1 0 1

b3

b2

b1

b0

High- order Low- order

0 1 2 3 4 5 6 7

0 0 0 0 0 NUL DLE SP 0 @ P ‘ p 0 0 0 1 1 SOH DC1 ! 1 A Q a q 0 0 1 0 2 STX DC2 " 2 B R b r 0 0 1 1 3 ETX DC3 # 3 C S c s 0 1 0 0 4 EOT DC4 $ 4 D T d t 0 1 0 1 5 ENQ NAK % 5 E U e u 0 1 1 0 6 ACK SYN & 6 F V f v 0 1 1 1 7 BEL ETB ’ 7 G W g w 1 0 0 0 8 BS CAN ( 8 H X h x 1 0 0 1 9 HT EM ) 9 I Y i y 1 0 1 0 A LF SUB * : J Z j z 1 0 1 1 B VT ESC + ; K [ k { 1 1 0 0 C FF FS , < L ¥ l | 1 1 0 1 D CR GS - = M ] m } 1 1 1 0 E SO RS . > N ^ n ~ 1 1 1 1 F SI US / ? O _ o DEL

Control codes Character codes

Page 63: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Appx.3-2

IM 34M6H21-01E 2nd Edition : Aug, 2001-00

Blank Page

Page 64: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

i

IM 34M6H21-01E

2nd Edition : Aug, 2001-00

Revision Information Document Name : Serial Communication Modules

Document No. : IM 34M6H21-01E

Edition Date Revised Item

1st Dec, 1998 New Publication

2nd Aug, 2001 Addition of explanations on support of CE Mark; Correction of typographical errors

Written by Product Marketing Department, IT Controller Center. Yokogawa Electric Corporation Published by Yokogawa Electric Corporation 2-9-32 Nakacho, Musashino-shi, Tokyo, 180-8750, JAPAN Printed by Yokogawa Graphic Arts Co., Ltd.

Page 65: Serial Communication Modules - Yokogawa Electric · Serial Communication Modules IM 34M6H21-01E 2nd Edition Yokogawa Electric Corporation. i ... If so used, it is the user’s responsibility

Blank Page