Writing programs, Using the library (cont’d) writing programs – Rockwell Automation 2708-DH5B2L_DH5B4L Attended Workstation User Manual

Page 115

Advertising
background image

Chapter 13

A-B VBASIC Application Library

13–3

If you don’t want to type this in, you will find this sample program under
ENVEX1.BAS. Now, assuming that the VB command (Visual BASIC) is in
your directory or is set up in your DOS PATH for you to access it, you could
enter the following DOS commands:

TYPE ENVPC.BAS > MAIN.BAS
TYPE ENVEX1.BAS > > MAIN.BAS
VB/RUN MAIN.BAS

The first TYPE command copies the ENVPC library source file into
MAIN.BAS. The second type command appends your test program to
MAIN.BAS. Finally, the command VB/RUN MAIN.BAS tells Visual
BASIC to run and start executing MAIN.BAS.

A batch file is provided which you can use to do the DOS commands which
were shown above. This batch file is supplied on the distribution diskette. To
use it, type:

LVB ENVEX1

You will note that LVB.BAT also includes READ.BAS and MENU.BAS into
the MAIN.BAS which it creates. If you do not need these modules, remove
the TYPE lines for them from the batch file.

When you type the VB command, the Visual BASIC screen should be
displayed and the bottom line will display “Loading and parsing” for a few
seconds. Then it will say “Binding”, and then the I/O environment emulator
will be running, with your program executing.

Type ALT X or TAB then X to stop the Emulation.

After examining the example BASIC programs and running them under the
emulator, you should be ready to write your own. The subroutines are listed
in Appendix M, along with the required arguments and returned values. Start
with a small application and refer to the source code of the following files:
FORMEX.BAS, ENV.BAS, READ.BAS and MENU.BAS for info about
how to use each routine. Also print copies; of any BASIC files which interest
you, as these will provide insight into various ways to use A-B VBASIC.

When you are ready to test your program on the workstation, you should first
compile it using the A-B VBASIC Cross-compiler LXB. The LLXB.BAT
batch file has the same syntax as LVB, except it starts with ENV.BAS instead
of ENVPC.BAS.

When having subtle syntax problems, try examining MAIN.BAS or using
LXBC to create a listing of MAIN.BAS.

Using the Library (cont’d)

Writing Programs

Advertising
This manual is related to the following products: