beautypg.com

Optional, Optional read channel number column number cc – IAI America XSEL-KX User Manual

Page 213

background image




197

Part 4 Commands

 READ (Read)

Extension condition

(LD, A, O, AB, OB)

Input condition

(I/O, flag)

Command, declaration

Output

(Output, flag)

Command,
declaration

Operand 1

Operand 2

Optional

Optional

READ

Channel

number

Column

number

CC

[Function]

Read a character string from the channel specified in operand 1 to the column specified in operand 2.
Read will end when the character specified by a SCHA command is received.
Either a local or global column may be specified.
A return code is stored in a local variable (factory setting: variable 99) immediately after this command has been
executed. Whether or not the command has been executed successfully can be checked from the return code. If
necessary, specify an appropriate processing to be performed when the command was terminated due to an error.
Specifying “0” in operand 2 will trigger a dummy read (clear the receive buffer and disable reception) (the return
code will be "successful completion").
(Note)

A dummy read (operand 2 = 0) cannot be specified for channel Nos. 31 to 34 (Ethernet options).

[Example]

SCHA

10

Set LF (= 10) as the end character.

OPEN

1

Open channel 1.

READ

1

2

Read a character string from channel 1 to column 2 until LF is
received.

TRAN

1

99

Assign a return code (variable 99) to variable 1.

CLOS

1

Close the channel.

SLCT

Branch to the processing corresponding to each return code.
(Note)

Using a GOTO command to branch out of the SLCT-
EDSL syntax or to other branching processing within
the syntax is prohibited.

WHEQ

:

[1]

:

1

0

If the content of variable 1 is “0” (successful completion), [1] will
be performed. Accordingly, specify the processing to be
performed upon successful completion in [1].

WHEQ

:

[2]

:

1

1

If the content of variable 1 is “1” (timeout), [2] will be performed.
Accordingly, specify an appropriate processing to be performed
in [2], if necessary.

WHEQ

:

[3]

:

1

2

If the content of variable 1 is “2” (timer cancellation), [3] will be
performed. Accordingly, specify an appropriate processing to
be performed in [3], if necessary.

OTHE

:

[4]

:

If the content of variable 1 is other than “0,” “1” or “2,” [4] will be
performed. Accordingly, specify an error handling in [4], if
necessary.

EDSL

If any of the conditions was satisfied and the applicable
command has been executed as a result, the program will
proceed to this processing step.

:

(Subsequent steps are omitted.)

:

• Return code of the READ command

The return code is stored in a local variable. Variable number can be set by “Other parameter No. 24.” The default variable
number is 99.
The variable number is fixed to 99 in main application version 0.20 and earlier.

0:

READ completed successfully (Receive complete)

1:

READ timeout (the timeout value is set by a TMRD
command) (Continue to receive)

2:

READ cancelled due to timer (the waiting status was
cancelled by a TIMC command) (Continue to receive)

3:

READ SCIF overrun error (Receive disabled)

4:

READ SCIF receive error (framing error or parity error)
(Receive disabled)

5:

READ factor error (program abort error) (Receive
disabled)

(Cannot be recognized by SEL commands)

6:

READ task ended (program end request, etc.) (Receive
disabled)

(Cannot be recognized by SEL commands)

7:

READ SCIF receive error due to other factor (Receive
disabled)

8:

READ expanded-SIO overrun error (Receive disabled)

9:

READ expanded-SIO parity error (Receive disabled)

10: READ expanded-SIO framing error (Receive disabled)
11: READ expanded-SIO buffer overflow error (Receive

disabled)

12: READ expanded-SIO receive error due to other factor

(Receive disabled)

This manual is related to the following products: