Device: barcode scanners (cont’d) – Rockwell Automation 2708-DH5B2L_DH5B4L Attended Workstation User Manual
Page 101
Chapter 12
Special Devices in A-B VBASIC
12–5
This means that:
1. EOF and LOF may be called any number of times before LINE INPUT,
and they will return the information for the current barcode. Program
structure might make it convenient for one procedure to detect the
presence of a barcode with EOF, and another to get its length with LOF,
and yet another to place its contents into a string with LINE INPUT.
2. All barcodes must be accepted by LINE INPUT before subsequent
barcodes can be read! It is not possible to use LOF to read a barcode, then
to ignore it because its length is wrong.
3. Once LINE INPUT is used, EOF and LOF are reset to false and 0 until
another barcode arrives.
The status returned by IOCTL$ is valid from one transition from EOF TRUE
to another.
To summarize, if you do not use the BASIC Language Development Kit
subroutines (which are a faster and easier way to develop larger programs),
the proper programming sequence to read barcodes is:
Optional test for EOF and/or LOF
Optional IOCTL$
LINE INPUT
Optional IOCTL$
CONST BarDev = 2
DO WHILE NOT EOF(BarDev): LOOP ‘Wait for data.
SOUND 1200, 1 ‘Give a nice beep.
LINE INPUT #BarDev, InputData$
DataLength = LEN(InputData$)
Device: Barcode Scanners
(cont’d)