User's Manual

Table Of Contents
5-25
Example of BASIC program
1:1 Protocol
100 ’***** V670-CD1D SAMPLE PROGRAM *****
110 CLS
120 OPEN “COM:E73NN” AS #1 Opens a RS-232C port.
130 ’
140 ’***** MAIN LOOP ****
150 *LOOP
160 LINE INPUT “Input TX Data : “, ITD$ Inputs a command data.
170 TXD$=ITD$+”*”+CHR$(13) Sets a data string to be sent.
180 PRINT “[TX] : “;ITD$ Displays a command data.
190 PRINT #1,TXD$; Sends a data string.
200 GOSUB *RECEIVE Receives a data string.
210 PRINT “[RX] : “;REC$ Displays a response data.
220 GOTO *LOOP
230 ’
240 ’***** RECEIVE DATA *****
250 *RECEIVE
260 RXD$=” “
270 WHILE (LOC(#1)=0):WEND Checks a receiving buffer.
280 WHILE (INSTR(RXD$,”*”+CHR$(13))=0) Checks a termination code.
290 RXD$=RXD$+INPUT$(1,#1) Reads a received data.
300 WEND
310 REC$=LEFT$(RXD$,LEN(RXD$)-2) Extracts a response data.
320 RETRUN
330 ’
340 END
5-11 Example of Communication Program