EasyManuals Logo

Omron CV500 User Manual

Omron CV500
147 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #126 background imageLoading...
Page #126 background image
Appendix DSample Programs Including Commands for Host Computer
124
110 DIM CHDATA$(300) :’Array declaration of the reception data.
120 OPEN ”COM:E73” AS #1 :’Opens the port.
130 ’*****************************************
140 ’********** Main processing **********
150 ’*****************************************
160 INPUT #1,COMMAND$ :’Data reception via the PC line.
170 T$=LEFT$(COMMAND$,LEN(COMMAND$)–3) :’Checks the FCS.
180 GOSUB *FCS
190 IF FCS$<>MID$(COMMAND$,LEN(COMMAND$)–2,2) THEN ENDCODE$=”1004#:GOTO *RE-
SPONSE
200 CMNDCODE$=MID$(COMMAND$,27,4) :’Checks the command code.
210 IF CMNDCODE$<>”0102” THEN ENDCODE$=”0401”:GOTO *RESPONSE
220 FOR I=0 TO VAL(”&H”+MID$(COMMAND$,39,4))–1 :’Reads the data to be written.
230 CHDATA$(I)=MID$(COMMAND$,43+I*4,4)
240 PRINT ”DATA”;I+1;”:”;CHDATA$(I)
250 NEXT I
260 ENDCODE$=”0000” :’Assigns 0000 to the response code.
270 ’*****************************************
280 *RESPONSE :’Creates a response frame.
290 RSV$=MID$(COMMAND$,9,2) :’Returns the RSV and SID that
300 DA$=MID$(COMMAND$,19,6) :’were received.
310 SA$=MID$(COMMAND$,13,6) :’Exchanges DNA, DA1, and DA2 with
320 SID$=MID$(COMMAND$,25,2) :’SNA, SA1, and SA2 and returns them.
330 TS=”@000F00C0”+RSV$+”02”+DA$+SA$+SID$+CMNDCODE$+ENDCODE$
340 GOSUB *FCS
350 RESPONSE$=T$+FCS$+”*”
360 PRINT #1,RESPONSE$ :’Transmits the data via the PC line.
370 GOTO 160
380 ’*****************************************
390 ’******FCS Operation Processing Subroutine*******
400 ’*****************************************
410 *FCS :’Calculates the FCS.
420 L=LEN(T$)
430 A=0
440 FOR J=1 TO L
450 TJ$=MID$(T$,J,1)
460 A=ASC(TJ$) XOR A
470 NEXT J
480 FCS$=HEX$(A)
490 IF LEN(FCS$)=1 THEN FCS$=”0”+FCS$
500 RETURN
510 ’*****************************************
520 ’********** Error processing **********
530 ’*****************************************
540 *EROPE
550 PRINT ”ERL=”:ERL,”ERR”;ERR
560 CLOSE 1
570 END

Table of Contents

Other manuals for Omron CV500

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron CV500 and is the answer not in the manual?

Omron CV500 Specifications

General IconGeneral
BrandOmron
ModelCV500
CategoryController
LanguageEnglish

Related product manuals