beautypg.com

Toshiba Tosvert RS485 User Manual

Page 26

background image

E6581315

25

Ex. 2: BASIC program for executing an input command with checksum (RS232C, ASCII mode)

(Toshiba version of Advanced BASIC-86 Ver. 3.01.05J)

◊ Checking if the maximum frequency setting has been changed correctly
1) Examples of programs

10 OPEN "COM1:9600,E,8,1" AS #1

--- 9600 baud, even parity, 8-bit length, 1 stop bit

20 INPUT"Send Data=";A$

--- Reads in data to be sent to the inverter.

30 S$="("+A$+"&"

--- Adds “(“ and “&” to the read data in.

40 S=0
50 L=LEN(S$)
60 FOR I=1 TO L

Calculates the number of bits (checksum).

70 S=S+ASC(MID$(S$,I,1))
80 NEXT I
90 CHS$=RIGHT$(HEX$(S),2)
100 PRINT #1,"("+A$+"&"+CHS$+")"

--- Sends the data including the checksum result

to the inverter.

110 INPUT #1,B$

--- Receives data returned from the inverter.

120 PRINT "Receive data= ";B$

--- Displays the data received.

130 GOTO 20

--- Repeats.

2) Examples of program execution results

Send Data=? R0011

--- Reads the maximum frequency (0011).

Receive Data= (R00111F40&3D)

--- 1F40 (Maximum frequency: 80 Hz)

Send Data=? W00111770

--- Changes the maximum frequency to 60 Hz

(1770).

Receive Data= (W00111770&36)
Send Data=? R0011

--- Reads the maximum frequency (0011).

Receive Data= (R00111770&31)

--- 1770 (Maximum frequency: 60 Hz)

This manual is related to the following products: