Rockwell Automation 2708-NBD VBASIC Language Development Kit User Manual

Page 64

Advertising
background image

A-B VBASIC and Visual BASIC

Appendix B

Differences Between

B–16

statements

END SELECT

SGN(numeric–expression)

Indicates the sign of a numeric expression. See VBDOS manual for specific
details.

SHARED variable [AS type] [,variable [AS type]]...

Gives a SUB or FUNCTION procedure access to variables declared at the
module level without passing them as parameters. All arrays in the
SHARED statement must have been previously DIMensioned in module
level code. LXB also requires non–arrays to have previously appeared at the
module level. See example on next page.

‘Module level code...
DIM Datain AS STRING
DO

LINE INPUT; Datain
CALL ShowDatain

LOOP

‘Sub–routine
SUB ShowDatain

SHARED Datain AS STRING
LOCATE 1, 1, 0
PRINT Datain;

END SUB

SLEEP seconds

Suspends execution of the calling program. Seconds may be a non–integer,
unlike VBDOS. Sleep continues until the specified number of seconds have
elapsed completely. Unlike VBDOS, the DH5 program will NOT wake up
early if a key is pressed. ON COM, ON TIMER, and forms are not
supported, so references to those in the VBDOS manual are irrelevent. The
EGG timer will be disabled when a SLEEP statement is used.

SLEEP 5 ‘Suspends execution for 5 seconds.

In A-B VBASIC, fractional second delays are supported to a resolution of
1/100ths of a second. This is different from VBDOS, where delays under .5
are rounded down to zero, suspending program execution indefinitely.

SOUND frequency,duration

Generates sound through the speaker. In the DH5, the correspondence
between the “frequency” specification and the true sound of that frequency is
approximate. Also, in certain firmware versions, unlike VBDOS, the sound
is initiated and the program continues without waiting for the sound to
complete.

Advertising