2 rs-232-c sample programs – Yokogawa DR240 User Manual
Page 102

8-4
IM DR231-11E
8.2
RS-232-C Sample Programs
This section describes sample program for a system using PC 9801 series (NEC) with the RS-232-
C interface.
Sample programs in this manual are writen in N88-BASIC(Standard language for PC9801 series).
We hope that these samples will aid you in creating your own program.
Setting the RS-232-C Parameter
In this sample program, the RS-232-C parameter settings are as shown below.
Baud rate
9600
Data length
8
Parity
Even
Stop bit 1
Handshaking
OFF-OFF
Setting the personal Computer
Be carefull when receiving BINARY data that the received data does not overrun the capacity of the
receive buffer in the personal computer which may be small as 255 bytes in some case.
Output the Setting Data
Read out the setting data from DR130/DR230/DR240, display them on CRT of personal computer,
and save them to floppy disk.
10
'TS1
20
OPEN "COM1:E81N" AS #1
30
OPEN "TS1.DAT" FOR OUTPUT AS #2
40
PRINT #1,"TS1"
50
LINE INPUT #1,D$:PRINT D$
60
PRINT #1,CHR$(&H1B)+"T"
70
LINE INPUT #1,D$:PRINT D$
80
PRINT #1,"LF001,010"
90
LINE INPUT #1,D$:PRINT D$:PRINT #2,D$
100
IF LEFT$(D$,2)<>"EN" GOTO 90
110
CLOSE
120
END
Write the Setting Data to DR230/DR240
Read out the setting data from floppy disk, display them on CRT of personal computer, and write
them to DR130/DR230/DR240.
10
'SETTEI
20
OPEN "COM1:E81N" AS #1
30
OPEN "TS1.DAT" FOR INPUT AS #2
40
LINE INPUT #2,D$
50
IF LEFT$(D$,2)="EN" GOTO 100
60
PRINT #1,D$:PRINT D$
70
LINE INPUT #1,D$
80
IF LEFT$(D$,2)="E1" THEN PRINT "SYNTAX ERROR"
90
GOTO 40
100
CLOSE
110
END