7 - 5
7 PROGRAM EXAMPLES
7.5 Program to Output Measured Data (in Binary Code) from VR200
and Write to Disk
100
‘************************************************************
110
‘** RS422A Example Program for IBM PC **
120
‘** **
130
‘** To input and save measured data **
140
‘** (ASCII code) **
150
‘** **
160
‘************************************************************
170
‘**
180
‘** Baud rate: 1200
Stop bit: 1 bit
190
‘** Parity: none
Control: OFF/OFF
200
‘** Data length: 8 bits
Others: LF is sent automatically.
210
‘**
220
‘
230
OPEN “COM1:1200,N,8,1,LF” AS #1
240
OPEN “TEST.DAT” FOR OUTPUT AS #2
250
‘
260
PRINT #1,CHR$(27)+”O 01"
270
PRINT #1,”TS0"
280
PRINT #1,”BO1"
290
‘
300
PRINT #1,CHR$(27)+”T”;
310
PRINT #1,”FM1,01,04"
320
D$=INPUT$(2,#1)
330
PRINT #2,D$
340
A=CVI(MID$(D$,1,2))
350
PRINT A
360
D$=INPUT$(A,#1)
370
PRINT #2,D$
380
PRINT ASC(MID$(D$,1,1));:PRINT “/”;
390
PRINT ASC(MID$(D$,2,1));:PRINT “/”;
400
PRINT ASC(MID$(D$,3,1));:PRINT
410
PRINT ASC(MID$(D$,4,1));:PRINT “:”;
420
PRINT ASC(MID$(D$,5,1));:PRINT “:”;
430
PRINT ASC(MID$(D$,6,1))
440
‘
450
L=0
460
FOR I=7 TO A
470
PRINT RIGHT$(“0”+HEX$(ASC(MID$(D$,I,1))),2)+” “;
480
L=L+1
490
IF L=5 THEN L=0 : PRINT
500
NEXT I
510
‘
520
PRINT #1,CHR$(27)+”C 01"
530
CLOSE
540
END
7.5 Program to Output Measured Data (in Bainary Code) from VR200 and Write to Disk