7.5Program to Output Measured Data (in Bainary Code) from VR200 and Write to Disk
7.5Program 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‘
230OPEN “COM1:1200,N,8,1,LF” AS #1
240OPEN “TEST.DAT” FOR OUTPUT AS #2
250‘
260PRINT #1,CHR$(27)+”O 01"
270PRINT #1,”TS0"
280PRINT #1,”BO1"
290‘
300PRINT #1,CHR$(27)+”T”;
310PRINT #1,”FM1,01,04"
320D$=INPUT$(2,#1)
330PRINT #2,D$
340A=CVI(MID$(D$,1,2))
350PRINT A
360D$=INPUT$(A,#1)
370PRINT #2,D$
380PRINT ASC(MID$(D$,1,1));:PRINT “/”;
390PRINT ASC(MID$(D$,2,1));:PRINT “/”;
400PRINT ASC(MID$(D$,3,1));:PRINT
410PRINT ASC(MID$(D$,4,1));:PRINT “:”;
420PRINT ASC(MID$(D$,5,1));:PRINT “:”;
430PRINT ASC(MID$(D$,6,1))
440‘
450L=0
460FOR I=7 TO A
470PRINT RIGHT$(“0”+HEX$(ASC(MID$(D$,I,1))),2)+” “;
480L=L+1
490IF L=5 THEN L=0 : PRINT
500NEXT I
510‘
520PRINT #1,CHR$(27)+”C 01"
530CLOSE
540END
7 PROGRAM EXAMPLES
7 - 5