
1-6
Program coding list “PRO2”
'!TITLE “Reading QR code”
#INCLUDE “var_tab.h” 'Reads the variable macro definition file.
'Store a parts number in [iPartsId].
PROGRAM pro2
DIM len1 AS INTEGER
TAKEVIS 'Obtains the visual semaphore.
VISSCREEN 1,0,1 'Designates draw screen 0 to the draw
See p. 21-24. 'destination.
VISCLS 0 'Clears draw screen 0.
See p. 21-27.
VISOVERLAY 1 'Displays draw screen 0.
See p. 21-9.
CAMIN 1,0,0 'Retrieves the image on the camera to
See p. 21-3. 'process screen 0.
VISPLNOUT 0,1 'Displays process screen 0.
See p. 21-8.
VISREADQR 1,WINDREF(1, 2),WINDREF 'Reads the QR code.
See p. 21-64.
(1, 3),0,0,1
WINDDISP 1 'Displays the window.
See p. 21-23.
VISLOC 10 , 10 'Designates the position to display.
See p. 21-37.
IF VISSTATUS(0) = 0 THEN 'When the measuring result is OK.
len1 = VISGETNUM(0, 0) 'Obtains the number of measured characters.
VISPRINT VISGETSTR(1, len1) 'Displays the measurement result.
I[iPartsId] = VAL(VISGETSTR(1, len1)) 'Stores the part number.
ELSE
VISPRINT “Cannot recognize a code.” 'Displays an error.
I[iPartsId] = -1 'Store –1 when an error occurs.
ENDIF
Branches conditionally. See p. 11-17.
GIVEVIS Releases control on vision device. 'Releases the visual semaphore.
END
Note: Process window 1, for reading the QR code, is assumed to
have been defined already.
Makes local variable declaration "lenl" usable as a local integer variable.
Declares control on vision device. Required to use
vision device.
Komentáře k této Příručce