7.3Program to Read Unit and Decimal point Information from VR200, Display It on Screen, and Write It to Disk
7.3Program to Read Unit and Decimal Point Information from VR200, Display It on Screen, and Write It to Disk
100 | ‘********************************************************** | ||
110 | ‘** | RS422A Example Program for IBM PC | ** |
120 | ‘** |
| ** |
130 | ‘** | To input and save point and unit information | ** |
140 | ‘** |
| ** |
150‘**********************************************************
160‘**
170 | ‘** | Baud rate: 1200 | Stop bit: 1 bit |
180 | ‘** | Parity: none | Control: OFF/OFF |
190 | ‘** | Data length: 8 bits | Others: LF is sent automatically. |
200‘**
210‘
220OPEN “COM1:1200,N,8,1,LF” AS #1
230OPEN “TEST.DAT” FOR OUTPUT AS #2
240‘
250 LF$=CHR$(&HA) | :’ Line feed = 0AH |
260PRINT #1,CHR$(27)+”O 01"
270PRINT #1,”TS2"
280PRINT #1,CHR$(27)+”T”;
290PRINT #1,”LF01,04"
300LINE INPUT #1,D$
310IF LEFT$(D$,1)=LF$ THEN D$=MID$(D$,2) :’ Remove “LF” of head string
320PRINT D$
330PRINT #2,D$
340IF MID$(D$,2,1)<>”E” THEN GOTO 300
350‘
360PRINT #1,CHR$(27)+”C 01"
370CLOSE
380END
7 PROGRAM EXAMPLES
7 - 3