Using the library – Rockwell Automation 2708-DH5B2L_DH5B4L Attended Workstation User Manual

Page 114

Advertising
background image

Chapter 13

A-B VBASIC Application Library

13–2

Installation consists of installing the diskette in drive A: and typing:

A:
INSTALIB d:

Where d is the destination drive.

You must first set up Visual BASIC, see Microsoft manual “Learning to Use
Microsoft Visual BASIC” for installation procedures (manual is provided
with the software). Also, make sure that the commands VB and LXBC are
available from the installed directory “ \ LIB”.

The A-B VBASIC compiler requires that all of your program reside in a
single file. (It does not support a LINK step which would combine multiple
independent object files into a single run file.) Since the BASIC Language
Development Kit is made up of multiple files, the normal way to use it is to
append all of the desired modules together and then load the resultant file
under Visual BASIC or compile it with the A-B VBASIC Compiler.

The only required module of the library when testing on the PC is
ENVPC.BAS.

Suppose you have the following program:

DEFINT A–Z ’ Recommend default variable type
OpenLINX

’ REQUIRED library initialization

TIMEOUT% = 1000

’ Set a 10 second timeout

DO

CLD
PRINT “Library Test”
PRINT “Do something” ;

’ 2nd line MUST have; or scrolls

e = ReadEvent% (2)

’ The mask (the 2) means read

SELECT CASE e

’ from keyboard/bdg with timeout.

CASE TimeoutEvent

’ The 10 seconds expired so make

CLS: PRINT “ *Timeout* ” ’ this obvious.
BEEP : SLEEP 2

CASE BadgeEvent : CLS

’ The event that occurred was a

PRINT “Badge read”

’ Bar code badge.

PRINT InBuf$;

’ The badge contents is in InBuf$

BEEP : SLEEP 2

’ Make some noise, and show badge.

CASE ELSE : CLS

’ Case Else required in LinxBASIC!!

PRINT “Key = ” ;e;

’ Display ASCII code for the key

SLEEP 2

’ or negative code if its special.

END SELECT

LOOP

’ Do this test forever

Using the Library

Advertising
This manual is related to the following products: