Device: beeper, Device: front panel leds – Rockwell Automation 2708-NBD VBASIC Language Development Kit User Manual

Page 35

Advertising
background image

Chapter 4

Special Devices in A-B VBASIC

4–14

For example, in a new file:

PUT #X, 1, something
PUT #X, 1000, something

will result in space being allocated for 1000 records, not 2!

Moral: Keep record numbers under control.

File Memory Management

Files are allocated in blocks of RAM. Every file has at least one free byte. In
essence this means that a file with a length of zero is allocated one block.
Each block contains 2 bytes of overhead. The remainder contains the file’s
contents. The block size is set via the configuration menu, to 256, 512, 1K,
2K, or 4K bytes. In an application with several small files, a block size of
256 is recommended. In an application with one large file, a block size of 4K
allows for a slightly larger file and slightly better performance. The
maximum file size is limited by a workstation’s memory, not A-B VBASIC.

Visual BASIC does not allow you to PUT a variable length string to a
RANDOM file. In A-B VBASIC this is also not recommended. However, it
can be done. Remember to allow at least 2 bytes of overhead for the carriage
return/line feed sequence that accompanies each variable PUT to a record.
Integrity of data stored and retrieved in this fashion cannot be maintained or
updated with any relative degree of confidence.

This device is accessed through the BEEP and the SOUND statements.
SOUND requires both a frequency and a tone duration. The correspondence
between the frequency and a “true” pitch of that value will be approximate.

The duration of the tone is given in units of 1/20 second.

Unlike Visual BASIC which pauses until a SOUND is finished, A-B
VBASIC initiates a SOUND and continues. A second SOUND or BEEP
which is encountered before the first completes, results in the truncation of
the initial tone.

Device: Front Panel LEDs
Reserved device name: LITE

The LEDs on the keyboard are numbered from 1 up. The maximum LED
number depends on the keyboard style. PUTting a “0” to record number X,
turns off LED number X. PUTting a “1” to record number X, turns it on.

Device: RAM Files (cont’d)

Device: Beeper

Device: Front Panel LEDs

Advertising