4. COMMUNICATION PROTOCOL
IMSRM04-E8
36
Example of temperature set values selecting checking program
1000 '-------------------- Identifier setting ----------------------
1010 ID$="S1"
1020 '
1030 '--------------- Communications initial setting ---------------
1040 CM$="N81NN"
1050 STX$=CHR$(&H2) : EOT$=CHR$(&H4) : ENQ$=CHR$(&H5)
1060 ACK$=CHR$(&H6) : NAC$=CHR$(&H15): ETX$=CHR$(&H3)
1070 OPEN "COM1:"+CM$ AS #1
1080 CONSOLE ,,,1
1090 COLOR 7:CLS 3
1100 '
1110 '------------------ Program main routine ---------------------
1120 *SEL
1130 PRINT " (Selection check) "
1140 PRINT "********Transmission of set values*********"
1150 PRINT "
1160 INPUT "Unit No.=";ADD$:INPUT "Channel No.=";C$
:INPUT "Setvalue=";S$
1170 DT$=EOT$+ADD$+STX$+Z$+C$+" "+S$+ETX$
1180 PRINT "Transmitting data=";DT$
1190 GOSUB *BCCCH
1200 DT$=DT$+CHR$(BCC)
1210 GOSUB *TEXT
1220 GOSUB *RXDT
1230 '
1240 *J20
1250 J=0
1260 '
1270 *IF2
1280 IF LOC(1)=0 THEN J=J+1:IF J<500 THEN *IF1 ELSE PRINT "
TIME OUT ":END
1290 '
1300 K$=INPUT$(1,#1)
1310 IF K$=NAK$ THEN PRINT " NAK":END
1320 IF K$=ACK$ THEN PRINT "Control unit has received the data":END
1330 '
1340 '
1350 '
1360 '--------------------- Sub-routine ----------------------
1370 '
1380 *RXDT'
1390 DT$=""
1400 RETURN
1410 '
1420 *TEXT
1430 PRINT #1,DT$;
1440 RETURN
Identifier setting
Communications data configuration setting
Communications character setting
Opening of RS-232C circuit
Input of the unit and channel number,
and the temperature set value
Data configuration setting 1
Display of transmitting data
Data configuration setting 2
Setting of the receiving waiting time
(Timeout processing)
Communications condition check,
Display of communication result,
and closing of RS-232C circuit
Clearing of circuit buffer
Transfer of selection data
(Continued on the next page.)