A SERVICE OF

logo

6 - 25
No. 99MBC071A
6. INTERFACE UNIT
6.1.2.10 An example Program of RS-232C Communication
The following is an example BASIC program for the PC-9801 (NEC) computer.
90 CLS 3
100 PRINT "-------------------------------------------------------"
110 PRINT " Set the next "
120 PRINT " 1:SPEED, 2:LENGTH, 3:PARITY, 4:FLOW CONTROL "
130 PRINT " (9.6KBPS) (8BIT) (NONE) (NONE) "
140 PRINT "-------------------------------------------------------"
150 INPUT "<CR>---OK START",A$
160 ’
170 OPEN "COM:N81N" A$ #1
180 ’
190 A$="CL"
200 PRINT "RS OUT=";A$
210 PRINT #1,A$
220 ’
230 LINE INPUT #1,B$
240 PRINT "RS INP=",B$
250 IF B$="OK" THEN ELSE 190
260 ’
270 A$="SET,SG2,M3,LL0,LH0,REF0,SMP1"
280 PRINT "RS OUT=";A$
290 PRINT #1,A$
300 ’
310 FOR T=1 TO 500 : ’0.5sec timer
320 NEXT T
330 ’
340 LINE INPUT #1,B$
350 PRINT "RS INP=",B$
360 IF B$="OK" THEN ELSE 190
370 ’
380 A$="RN"
390 PRINT "RS OUT=";A$
400 PRINT #1,A$
410 ’
420 FOR T=1 TO 1000 : ’1sec timer
430 NEXT T
440 ’
450 LINE INPUT #1,C$
460 C=VAL(C$)
470 PRINT "RS INP=";C$;" DATA=";C
480
490 END
Digitize the measurement
result response and display it
on the CRT.
Wait until measurement is
completed.
Transmission of RN command
(Single-run measurement)
Acknowledge the OK response.
Set the measuring conditions.
Repeat the CL command
transmission until OK is received.
Setup for the RS-232C
communication
TIP 1.Each command should be of the programming language to be used.
2. Depending on the timing gap between the host machine and the LSM, meaning-
less data may be transmitted/received. Therefore, always send the CL command
and acknowledge the OK command before starting the communication.
3. Timer settings should be compatible to the processing time required for each
command and the host machine.