Fcs Check Program Examples (Basic) - Omron V530-R160E User Manual

2d code reader
Hide thumbs Also See for V530-R160E:
Table of Contents

Advertisement

SECTION 10
Appendix

FCS Check Program Examples (BASIC)

 Calculation Examples for Sending FCS
DATA$
L
CODE$
A
100
110
120
130
140
150
160
170
180
190
200
 FCS Check Sub Routine Examples for Received Data
1000
1010
1020
1030
1040
1050
1060
1070
1080
1090
1100
1110
1120
1130
V530-R160
278
Operation Manual
Sample Data Line
Data Length
Data Character
Exclusive Operation
'∗∗∗∗∗CALCULATE FCS∗∗∗∗∗
'∗FCSSET
L=LEN(DATA$)
A=0
FOR J=1 TO L
CODE$=MID$(DATA$,J,1)
A=ASC(CODE$)XOR A
NEXT J
FCS$=HEX$(A)
IF LEN(FCS$)=1 THEN FCS$="0"+FCS$
RETURN
'∗∗∗∗∗FCSHECK∗∗∗∗∗
'∗FCSHECK
Q=0:FCSCK$="OK"
PRINT RESPONSE $
LENGS=LEN(RESPONSE$)-3
FCSP$=MID$(RESPONSE$,LENGS+1,2)
FOR J=1 TO LENGS
Q=ASC(MID$(RESPONSE$,J,1))XOR Q
NEXT J
FCSD$=HEX$(Q)
IF LEN(FCSD$)=1 THEN FCSD$="0"+FCSD$
IF FCSD$<> FCSP$ THEN FCSCK$="ERR"
PRINT "FCSD$=";FCSD$;"FCSP$=";FCSP$;
"FCSCK$=";"FCSCK$="
RETURN
'Response data of FCS
'Calculation range of FCS'
'FCS calculated in a program
'FCS correctly received: OK
'FCS not received correctly: ERR

Advertisement

Table of Contents
loading

This manual is also suitable for:

V530-r160ep

Table of Contents