OPEN

Open a device

Format:

OPEN "device string" AS #device

Group:

Character I/O

See also:

PRINT, INPUT, CLOSE

This command opens a device. The valid range for "device" is 0 to 3. Each program has it's own device #0 which is used as its default device. Devices #1 through #3 are board-wide system resources that can be opened and used from within any program or from any system or program prompt.

The "device string" describes the device that is to be opened. Serial device strings contain information required to set up communications. Valid device strings are:

"FIFO:"

"COM1:baudrate,parity,databits,stopbits"

"COM2:baudrate,parity,databits,stopbits"

"OPS:" (Valid only when using an OPS1200 Display and Keyboard)

baudrate

= 300,600,1200,2400,9600,19200,38400

parity = N,E,O

databits

=

5,6,7,8

stopbits

=

1,2

When a device is opened, the operating system attached to that device enters an idle state, allowing incoming characters to be used by a program instead of being interpreted as commands. When the device is closed, the device will enter its auto- detect mode as if it were starting from power-up.

Usage example:

10 OPEN "COM1:9600,N,8,1" AS #1

20 PRINT #1, "Hello world!"

30 CLOSE #1

12

OPS1200 User’s Manual

Page 18
Image 18
Parker  Products OPS1200 user manual Open a device, PRINT, INPUT, Close