MC-Basic:OPEN

From SoftMC-Wiki
Revision as of 03:01, 25 April 2017 by Chi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Language: English  • 中文(简体)‎

Opens the serial port for asynchronous ASCII protocol connection
<comport>: serial port to open (COM2)
<baudrate>: sets the baud rate of the device to the specified value
<parity>: enables/disables parity detection. If enabled, parity may be odd or even
<databits>: sets the number of data bits
<stopbit>: defines the number of stop bits that are used       <DeviceHandle>: a free handle

<xonoff_mode>: sets raw mode or  ^S/^Q flow control protocol mode .

In raw mode, each input character is available to readers as soon as it is input from the device. Reading from a device in raw mode causes as many characters as possible to be extracted from the input ring, up to the limit of the user's read buffer. Input cannot be modified except as directed by other device option bits.

In CTRL+Q and CTRL+S receipt of a CTRL+S input character suspends output to that channel. Subsequent receipt of a CTRL+Q resumes the output. Conversely, when the softMC input buffer is almost full, a CTRL+S is output to signal the other side to suspend transmission. When the input buffer is empty enough, a CTRL+Q is output to signal the other side to resume transmission.

Syntax

Open <comport>BaudRate=<baudrate>Parity=<parity>DataBits=<databits> StopBit=<stopbit> ( XOnOff = <xonoff_mode> ) As #<DeviceHandle>

Availability

All versions

Type

<comport>: Long
<baudrate>: Long
<parity>:  Long
<databits>: Long
<stopbit>: Long
<DeviceHandle>: Long

<xonoff_mode>: Long

Range

<comport>: COM2
<baudrate>: 1200, 2000, 2400, 3600, 4800, 7200, 9600, 19200,
                      38400, 57600,115200
<parity>: 0 (disabled), 1 (enabled – odd), 2 (enabled – even)
<databits>: 5, 6, 7, 8
<stopbit>: 1, 2
<DeviceHandle>: 1 to 255

<xonoff_mode>:  0 - for  raw mode

1- for ^S/^Q flow control protocol

Default

<xonoff_mode>:  0

Scope

Configuration, Task or Terminal

Limitations

All flags should meet to output device connection settings

Examples

Open COM2 BaudRate=9600 Parity=0 DataBits=8 StopBit=1 XOnOff=1 As #1

See Also