Specifications

Chapter 8. Files
137
8.3.2 Programming for Bar Code Device
Code Mark
The MARK$ function allows you to check the code mark (denoting the code type) and the
length of the inputted bar code data.
This function returns a total of three bytes: one byte for the code mark and two bytes for the
data length.
BHT-100Q
If the data length of a read 2D code exceeds 99 digits, the two bytes of the
returned value for the data length will indicate 00. To check the length of such 2D code
data, therefore, use the
LOC function.
Multiple Code Reading
You may activate the multiple code reading feature which reads more than one code type
while automatically identifying them. To do it, you should designate desired code types fol-
lowing the CODE in the
OPEN "BAR:" statement.
The BHT-100Q can identify more than one bar code type and/or more than one 2D code
type; the BHT-100B can do more than one bar code type.
Note for Reading Data in a 2D Code (for the BHT-100Q)
A single 2D code can contain more than hundreds of digits of data. From a 2D code con-
taining 255 digits or more, a single
INPUT# or LINE INPUT# statement cannot read out
all of the data. For such a 2D code, you need to check the data length with the
LOC func-
tion and then call the
INPUT$ function by the number of times required.
Given below is a typical programming sample for reading a 2D code containing more than
255 digits of data.
dim BUF$(20)[255] Define the data buffer for 5100
bytes.
f.no%=2 Designate the bar code device file.
open"BAR:B"as #f.no% code "Q","A" Enable reading of QR codes and
universal product codes.
wait 0,&h02 Wait for completion of code reading.
for n%=1 to 100
len%=loc (#f.no%) Check the number of digits.
if len%>0 then Inspect the number of digits.
if len%>255 then
len%=255
endif
BUF$ (n%)=input$(len%,f.no%) Read out data.
else Has read out all data.
n%=20
endif
next n%
READEND:
close #f.no%