Output the measurement data (ascii code, two-wire) – Yokogawa DR240 User Manual

Page 108

Advertising
background image

8-10

IM DR231-11E

Output the Measurement Data (ASCII Code, two-wire)

Read out the measurement data by ASCII code from DR series, display on CRT of the personal
computer, and save to floppy disk.

10

20

OPEN “COM1:E81N” AS #1

30

OPEN “TS0ASC.DAT” FOR OUTPUT AS #2

40

OUT &H32,&H5

50

60

D$=CHR$(&H1B)+”O 01"

70

GOSUB *RPRINT :GOSUB *RRECIVE :PRINT D$

80

D$=”TS0"

90

GOSUB *RPRINT :GOSUB *RRECIVE :PRINT D$

100

D$=CHR$(&H1B)+”T”

110

GOSUB *RPRINT :GOSUB *RRECIVE :PRINT D$

120

130

D$=”FM0,001,010" :GOSUB *RPRINT

140

GOSUB *RRECIVE

150

PRINT D$

160

PRINT #2,D$

170

IF MID$(D$,2,1)<>”E” GOTO 140

180

190

D$=CHR$(&H1B)+”C 01" :GOSUB *RPRINT :GOSUB *RRECIVE

200

CLOSE

210

END

220

230

240

*RPRINT

250

OUT &H32,&H25

260

FOR K=1 TO 1000 :NEXT K

270

PRINT #1,D$

280

IF(INP(&H32) AND &H4) THEN OUT &H32,&H5 ELSE 280

290

RETURN

300

310

*RRECIVE

320

D$=””

330

INCHR$=INPUT$(1,#1)

340

D$=D$+INCHR$

350

IF ASC(INCHR$)<>&HA THEN GOTO 300

360

PRINT D$

370

RETURN

• This program is designed for the converter using RS (RTS) for send control.
• BIT 5 is the RS (RTS) control BIT in the XX value of “OUT &H32,&HXX” in the program. Bits

other than BIT 5 may be different in other applications.

• Comments on the program are indicated below.

Line 40

Set RS (RTS) to FALSE and turn the send control OFF.

Line 250

Set RS (RTS) to TRUE and turn the send control ON.

Line 260

Insert a wait before sending data. This value need to be adjusted depending on the
PC. This wait time is usually not necessary unless the PC is extremely fast and the
data sent from the DR side collides with the data sent by the PC side.

Line 280

On the send complete indication from the PC (TxEMP is TRUE), set RS (RTS) to
FALSE and turn the send control OFF.

Line 310

This subroutine accurately reads up to LF.

8.3 RS-422-A/RS-485 Sample Programs

Advertising
This manual is related to the following products: