Details of specific statements and functions – Rockwell Automation 2708-NBD VBASIC Language Development Kit User Manual

Page 29

Advertising
background image

Chapter 4

Special Devices in A-B VBASIC

4–8

For example:

PRINT #NETDEV, “BAD INVENTORY NUMBER”

may be trapped by the host computer as a BASIC ERROR because the
complete record sent to the host will look something like this:

0101000100BAD INVENTORY NUMBER

If the host program is testing for zeroes in digits 9 and 10, and is then
looking for “BA” to indicate a BASIC ERROR, it will become confused by
this error message, and potentially abort the programs.

We suggest that, if you must use NET instead of HOST, make your first two
bytes something odd like **.

7. A maximum length is imposed on all records moving through the

network. Consult Appendix D in this manual.

8. AnyA-B VBASIC program reading from HOST or NET must do so at a

rate fast enough to “Keep up” with the host. If a new record arrives before
the previous one is input, the “lost” count is incremented on the #5 status
display.

We highly recommend that you utilize the subroutines contained in the
BASIC Language Development Kit (Catalog No. 2708-NBD) to do all I/O in
the workstation. These library routines allow you to simulate the workstation
on a PC during development, saving you hours of time and headaches. When
using the BASIC Language Development Kit, you will only need to call
OpenLINX, then execute a ReadEvent and wait for a return. Any data
received from the devices (slot reader, COM ports, etc.) will be returned in
appropriate variables, and flags will be set to let you know where the data
came from. Refer to Appendix C for details. If you must use the devices
directly, the following programming examples will show you how:

OPEN “HOST”

Host should be opened only as a sequential or random access file, in keeping
with the record oriented nature of network I/O. QUE may be OPENed for
binary access so long as the general restrictions are observed.

An OPEN “HOST” has a very important side effect: it allows the network
task to deque records from the QUE and forward them to the host.

Program initiation CLOSEs HOST. Program termination leaves HOST
unchanged.

Device: Host Computer
(cont’d)

Details of Specific Statements
and Functions

Advertising