E6581315
26
Ex. 3 BASIC program for communication tests (RS232C, ASCII mode)
(Toshiba version of Advanced BASIC-86 Ver. 3.01.05J)
◊
Accessing a parameter (with error code.)
1) Examples of programs
100 INPUT "Baud rate=9600/4800/2400/1200";SPEED$
---- Selects a baud rate.
110 INPUT "Parity=even(E)/odd(O)";PARITY$
---- Selects parity.
120 OPEN "COM1:"+SPEED$+","+",8,1"AS #1
130 INPUT "Send data";B$
---- Enters a command.
140 PRINT #1,B$
150 C$=""
160 T=TIMER
170 COUNT=(TIMER-T)
180 IF COUNT >3 THEN 270
190 IF COUNT <0 THEN T=TIMER
---- Prevents an increase in the number of digits.
200 IF LOC(1)= 0 THEN A$="":GOTO 220
210 A$=INPUT$(1,#1)
220 IF A$ <>CHR$(13) THEN 240
---- Carriage return
230 GOTO 290
(CR) to finish reading in.
240 IF A$="" THEN 160
250 C$=C$+A$
260 GOTO 160
270 COLOR @0,7:PRINT "!!! There is no data to return. !!! ";:COLOR @7,0:PRINT
280 GOTO 130
---- Repeats.
290 PRINT A$;
300 C$=C$+A$
310 PRINT "Return data=";c$;
320 GOTO 130
---- Repeats.
2) Examples of program execution results (In this example, the inverter number is 00.)
Baud rate=9600/4800/2400? 9600
---- Selects 9600 baud.
Parity=even(E)/odd(O)? E
---- Select E (even parity).
Send data? (00R0011)
---- Carries out test communication.
Return data= (00R00111770)
Send data? ()
---- Error
!!! There is no data to return. !!!
---- No data is returned.
Send data? (R0011)
Return data= (R00111770)
Send data?
:
: