efesotomasyon.com -Toshiba inverter,drive,servo,plc

E6581315

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$+","+PARITY$+",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.

200IF LOC(1)= 0 THEN A$="":GOTO 220

210A$=INPUT$(1,#1)

220

IF A$ <>CHR$(13) THEN 240

---- Carriage return

230

GOTO 290

(CR) to finish reading in.

240IF A$="" THEN 160

250C$=C$+A$

260GOTO 160

270COLOR @0,7:PRINT "!!! There is no data to return. !!! ";:COLOR @7,0:PRINT

280 GOTO 130

---- Repeats.

290PRINT A$;

300C$=C$+A$

310PRINT "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?

 

:

 

:

 

26

Page 27
Image 27
Toshiba TOSVERT VF-AS1 instruction manual Print #1,B$, 160 T=TIMER COUNT=TIMER-T, If Count 0 then T=TIMER