Rockwell Automation 2708-NBD VBASIC Language Development Kit User Manual

Page 71

Advertising
background image

Appendix C

Application Library Subroutines

C–3

The most important events are:

TimeoutEvent

The input timer has expired

. . . .

NetEvent

Read from network has occurred

. . . . . . . .

ComEvent

Read from the main comm port

. . . . . . .

AuxEvent

Read from the aux comm port

. . . . . . .

When ComEvent or AuxEvent has occurred, InCom$ contains the LINE
INPUT format line which was read from the comm line. When NetEvent has
occurred, InNet$ contains the record from the host. The events which you
want to test for are indicated by the “mask” parameter. Each device which
you want tested MUST have a bit set in the mask. Bits are set by building a
mask using the constants: KbdMask, TimeoutMask, BadgeMask, NetMask,
ComMask, AuxMask, and SensorMask.

To simplify matters, some special mask values are also allowed. These are:

0 = Read from keyboard only
1 = Read from keyboard with timeout (see ReadEvent%)
2 = Read from keyboard and SLOT, etc. with timeout

Note: Timeouts only apply to reads which wait for an event. TestEvent%
never waits. See ReadEvent% for more info.

e = TestEvent% ( mask% )

FUNCTION TestEvent% ( mask% )

SaveEvent

Saves the previous event to allow it to happen again.

Saves the event which has just occurred from TestEvent%. The very next
TestEvent% will return this event code.

SaveEvent eventcode%
SUB SaveEvent ( e% )

ReadEvent%

Waits for a low level event.

Waits for an event to occur. The event(s) to wait for are specified in the same
manner as TestEvent%.

For timeouts set the global variable TIMEOUT% to the number of 1/100
second intervals you want to wait before a TimeoutEvent is returned. The
value of TIMEOUT% is not modified by %.

e = % ( mask );
FUNCTION % ( mask% )

Advertising