User Manual
Table Of Contents
- V670 Series
- Introduction
- Contents
- Structure of This Manual
- Chapter 1 Features and System Configuration
- Chapter 2 Specifications and Performance
- Chapter 3 Setting and Installation
- Chapter 4 Functions
- Chapter 5 Control From Host Device
- Chapter 6 How to Use Self-Execution Mode
- Chapter 7 How to Use Programming Console
- Chapter 8 From Startup to Run
- Chapter 9 Characteristic Data Depending on Operating Condition (Reference)
- Appendix
5-11 Example of Communication Program
5-26
1:n 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 IP$=”00”+ITD$:COSUB *FCS ’Calculates FCS.
180 TXD$=CHR$(1)+IP$+OP$+”*”+CHR$(13) ’Sets a data string to be sent.
190 PRINT #[TX] : ”;ITD$ ’Displays a command data.
200 PRINT #1,TXD$; ’Sends a data string.
210 GOSUB *RECEIVE ’Receives a data string.
220 PRINT “[RX] : “;REC$ ’Displays a response data.
230 GOTO *LOOP
240 ’
250 ’***** RECEIVE DATA *****
260 *RECEIVE
270 RXD$=” “
280 WHILE (LOC(#1)=0):WEND
290 WHILE (INSTR(RXD$,”*”+CHR$(13))=0)
300 RXD$=RXD$+INPUT$(1,#1)
310 WEND
320 IP$=MID$(RXD$,2,LEN(RXD$)-5):GOSUB *FCS ’Calculates FCS
330 REC$=MID$(RXD$,4,LEN(RXD$)-7)
340 FCS$=MID$(RXD$,LEN(RXD$)-3,2):GOSUB *CHK.FCS ’Checks FCS
350 RETRUN
360 ’
370 ‘***** CALCULATE FCS *****
380 *FCS
390 K=0
400 FOR I=1 TO LEN(IP$)
410 TMP$=MID$(IP$,I,1)
420 K=K XOR ASC(TMP$)
430 NEXT=1
440 OP$=HEX$(K)
450 RETURN
460 ‘
470 ‘***** CHECK FCS *****
480 *CHK.FCS
490 IF FCS$<>OP$ THEN REC$=”FCS ERR!!
500 RETURN
510 +
520 END










