E6581222
25
4.6. Examples of RS232C communication programs
Ex. 1: BASIC program for monitoring the operation frequency continuously (RS232C, ASCII mode)
(Toshiba version of Advanced BASIC-86 Ver. 3.01.05J)
◊ Monitoring the operation frequency continuously
1) Examples of programs
10 OPEN "COM1:9600,E,8,1" AS #1 --- 9600 baud, even parity, 8-bit length, 1 stop bit
20 A$=”FE00” --- Specifies the communication number for
monitoring the operation frequency.
30 PRINT #1,"("+”R”+A$+")" --- Transmits data to the inverter.
Note: The carriage return code is added
automatically.
40 INPUT#1,B$ --- Receives data returned from the inverter.
50 AAA$=“&H”+MID$(B$,7,4) --- Extracts only data items from the data re-
turned.
60 F$=LEFT$(STR$(VAL(AAA$)/100),6) --- Converts data into decimal form.
70 PRINT " Operation frequency =";F$+“Hz” --- Displays the operation frequency.
80 GOTO 20 --- Repeats.
2) Examples of program execution results (stop command issued during 80 Hz operation)
Operation frequency = 80 Hz ...
Operation frequency = 79.95Hz
:
:
Operation frequency = 0Hz