Instruction manual

6. RKC COMMUNICATION
IMS01J02-E1
61
6.1.4 Examples of polling and selecting check programs
The following is the sample program for NEC PC-9800 series computers in BASIC language for
carrying out polling and selecting checking by RS-232C specification. There will be some differences
in the computer languages according to the type of computer. Before executing the program, confirm
that there is no mistake in the wiring of the communications cable and check that the control unit data
bit configuration is set to 8 for data bit and Without for parity bit. In addition, the communications
speed setting should be set to match the host computer speed setting.
Example of temperature set values polling check program
1000 '-------------------- Identifier setting ----------------------
1010 ID$="S1"
1020 '
1030 '--------------- Communications initial setting ---------------
1040 CM$="N81NN"
1050 INPUT "Control unit address=";ADD$
1060 STX$=CHR$(&H2) : EOT$=CHR$(&H4) : ENQ$=CHR$(&H5)
1070 ACK$=CHR$(&H6) : NAK$=CHR$(&H15): ETX$=CHR$(&H3)
1080 OPEN "COM1:"+CM$ AS #1
1090 CONSOLE ,,,1
1100 COLOR 7:CLS 3
1110 '
1120 '------------------ Program main routine ---------------------
1130 *POL
1140 PRINT " (Polling check) "
1150 PRINT "*********Receiving the set values************"
1160 PRINT "
1170 DT$=EOT$+ADD$+ID$+ENQ$
1180 GOSUB *TEXT
1190 GOSUB *RXDT
1200 '
1210 *J10
1220 J=0
1230 '
1240 *IF1
1250 IF LOC(1)=0 THEN J=J+1:IF J<500 THEN *IF1 ELSE PRINT "
TIME OUT ":END
1260 '
1270 K$=INPUT$(1,#1)
1280 IF K$=ETX$ GOTO *ETXRX
1290 IF K$=NAK$ THEN PRINT " NAK":END
1300 IF K$=EOT$ THEN PRINT " EOT":END
1310 IF K$=ACK$ THEN PRINT " ACK":END
Identifier setting
Communications data configuration setting
Control unit address input
Communications character setting
Open RS-232C circuit
Data configuration setting
Setting of the receiving waiting time
1
(Timeout processing)
Communications condition checking
1
Setting of the receiving waiting time:
If time out occurs in using high speed computer (Except no response), the numeral value of 500 in
the program should be changed to an appropriately-sized numeral value.
Continued on the next page.