![background image](http://html1.mh-extra.com/html/omron/v530-r160e/v530-r160e_user-manual_741447280.webp)
278
SE
C
T
IO
N 1
0
FCS Chec
k Progr
am Ex
amples
(B
ASIC)
SECTION 10
V530-R160
Operation Manual
SECTION 10
Appendix
FCS Check Program Examples (BASIC)
Calculation Examples for Sending FCS
100
‘
∗∗∗∗∗
CALCULATE FCS
∗∗∗∗∗
110
‘
∗
FCSSET
120
L=LEN(DATA$)
130
A=0
140
FOR J=1 TO L
150
CODE$=MID$(DATA$,J,1)
160
A=ASC(CODE$)XOR A
170
NEXT J
180
FCS$=HEX$(A)
190
IF LEN(FCS$)=1 THEN FCS$=“0”+FCS$
200
RETURN
FCS Check Sub Routine Examples for Received Data
1000
‘
∗∗∗∗∗
FCSHECK
∗∗∗∗∗
1010
‘
∗
FCSHECK
1020
Q=0:FCSCK$=“OK”
1030
PRINT RESPONSE $
1040
LENGS=LEN(RESPONSE$)-3
1050
FCSP$=MID$(RESPONSE$,LENGS+1,2)
1060
FOR J=1 TO LENGS
1070
Q=ASC(MID$(RESPONSE$,J,1))XOR Q
1080
NEXT J
1090
FCSD$=HEX$(Q)
1100
IF LEN(FCSD$)=1 THEN FCSD$=“0”+FCSD$
1110
IF FCSD$<> FCSP$ THEN FCSCK$=“ERR”
1120
PRINT “FCSD$=”;FCSD$;“FCSP$=”;FCSP$;
“FCSCK$=”;“FCSCK$=”
1130
RETURN
DATA$
Sample Data Line
L
Data Length
CODE$
Data Character
A
Exclusive Operation
‘Response data of FCS
‘Calculation range of FCS’
‘FCS correctly received: OK
‘FCS not received correctly: ERR
‘FCS calculated in a program
Содержание V530-R160E
Страница 36: ...34 SECTION 1 Operational Flow V530 R160 Operation Manual SECTION 1 Outline MEMO...
Страница 144: ...142 SECTION 5 Setting Reading Conditions QRCode V530 R160 Operation Manual SECTION 5 Setting Reading Conditions MEMO...
Страница 192: ...190 SECTION 7 Checking the Version Version V530 R160 Operation Manual SECTION 7 System Settings MEMO...
Страница 250: ...248 SECTION 8 Serial Interface Host Link V530 R160 Operation Manual SECTION 8 Communication with the Host MEMO...
Страница 288: ...286 SECTION 10 Glossary SECTION 10 V530 R160 Operation Manual SECTION 10 Appendix MEMO...