Interface ISerial

Description

The ISerial interface provides the methods and properties specific to ASRL INSTR sessions.

ISerial derives from IVisaSession.

Methods

GetAttribute

Use of this method is discouraged. All the non-deprecated standard attributes are accessible via properties on the appropriate COM interfaces.

SetAttribute

Use of this method is discouraged. All the non-deprecated standard attributes are accessible via properties on the appropriate COM interfaces.

LockRsrc

Locks the resource.

UnlockRsrc

Unlocks the resource

Init

Opens the resource. This is the first method on IVisaSession or any of its derived interfaces to be called. In general, you will not call this method because you will use the Resource Manager to create resources.

Close

Closes the resource. Sending the resource's COM object's reference count to zero (and thus destroying the object) also executes a close, but this method may be useful for environments with garbage collection or other facilities that make object lifetimes non-deterministic.

SetBufferSize

Sets the size of the read and/or write buffer for serial communication.  The mask parameter specifies whether the buffer is a read or write buffer:

  • IO_IN_BUF
  • IO_IN_BUF
  • IO_IN_BUF

Flush

Manually flushes the read and write buffers associated with serial interfaces.

Properties

ComponentVersion

A numeric version for this component.

SpecVersion

The VISA-defined version information for the specification version to which this component complies.

HardwareInterfaceName

The name of the hardware interface (GPIB, ASRL, etc.).

HardwareInterfaceNumber

The board number of the hardware interface.

HardwareInterfaceType

The type number of the hardware interface.

LockState

The current locking state of the interface.

OptionString

The option string corresponding to the current state of the resource.

ProgID

The programmatic ID that can be used by COM to create this object.

ResourceName

The VISA resource name of the currently open resource. This name is the canonical version of the resource name and therefore may vary from the resource string used to open/init the resource.

SessionType

The session type string, such as "INSTR" or "INTFC".

SoftwareManufacturerID

The ID number of the vendor of this software component.

SoftwareManufacturerName

The name of the vendor of this software component.

Timeout

The I/O timeout in milliseconds for I/O communication on this resource session.

LastStatus

The return value from the last method call on this interface. This property may be useful in Visual Basic, where positive return values, such as warnings and other non-error return values, cannot be retrieved.

See the Return Values page for a list of positive return values.

BytesAvailable

Shows the number of bytes available in the global receive buffer.

BaudRate

The baud rate of the interface. It is represented as an unsigned 32-bit integer so that any baud rate can be used, but it usually requires a commonly used rate such as 300, 1200, 2400, or 9600 baud.

DataBits

The number of data bits contained in each frame (from 5 to 8). The data bits for each frame are located in the low-order bits of every byte stored in memory.

ClearToSendState

Shows the current state of the Clear To Send (CTS) input signal.

DataCarrierDetectState

Shows the current state of the Data Carrier Detect (DCD) input signal. The DCD signal is often used by modems to indicate the detection of a carrier (remote modem) on the telephone line. The DCD signal is also known as Receive Line Signal Detect (RLSD).

DataSetReadyState

Shows the current state of the Data Set Ready (DSR) input signal.

DataTerminalReadyState

Manually asserts or deasserts the Data Terminal Ready (DTR) output signal.

EndIn

Indicates the method used to terminate read operations.  If it is set to ASRL_END_NONE, the read will not terminate until all of the requested data is received (or an error occurs).  If it is set to ASRL_END_TERMCHAR, the read will terminate as soon as the character in the TerminationCharacter property of IBaseMessage is received.  If it is set to ASRL_END_LAST_BIT, the read will terminate as soon as a character arrives with its last bit set.  For example, if ASRL_DATA_BITS is set to 8, then the read will terminate when a character arrives with the 8th bit set.

EndOut

Indicates the method used to terminate write operations. If it is set to ASRL_END_NONE, the write will not append anything to the data being written.  If it is set to ASRL_END_BREAK, the write will transmit a break after all the characters for the write have been sent.  If it is set to ASRL_END_LAST_BIT, the write will send all but the last character with the last bit clear, then transmit the last character with the last bit set.  For example, if ASRL_DATA_BITS is set to 8, then the write will clear the 8th bit for all but the last character, then transmit the last character with the 8th bit set.  If it is set to ASRL_END_TERMCHAR, the write will send the character in the TerminationCharacter property of the IBaseMessage interface after the data being transmitted.

FlowControl

If this property is set to ASRL_FLOW_NONE, the transfer mechanism does not use flow control, and buffers on both sides of the connection are assumed to be large enough to hold all data transferred. If this property is set to ASRL_FLOW_XON_XOFF, the transfer mechanism uses the XON and XOFF characters to perform flow control. The transfer mechanism controls input flow by sending XOFF when the receive buffer is nearly full, and it controls the output flow by suspending transmission when XOFF is received.

If this property is set to ASRL_FLOW_RTS_CTS, the transfer mechanism uses the RTS output signal and the CTS input signal to perform flow control. The transfer mechanism controls input flow by unasserting the RTS signal when the receive buffer is nearly full, and it controls output flow by suspending the transmission when the CTS signal is unasserted.

If this property is set to ASRL_FLOW_DTR_DSR, the transfer mechanism uses the DTR output signal and the DSR input signal to perform flow control. The transfer mechanism controls input flow by unasserting the DTR signal when the receive buffer is nearly full, and it controls output flow by suspending the transmission when the DSR signal is unasserted.

This property can specify multiple flow control mechanisms by bit-ORing multiple values together. However, certain combinations may not be supported by all serial ports and/or operating systems.

Parity

The parity used with every frame transmitted and received. ASRL_PAR_MARK means that the parity bit exists and is always 1.  ASRL_PAR_SPACE means that the parity bit exists and is always 0.

RingIndicatorState

Shows the current state of the Ring Indicator (RI) input signal.  The RI signal is often used by modems to indicate that the telephone line is ringing.

RequestToSendState

Manually asserts or deasserts the Request To Send (RTS) output signal.  When the ASRL_FLOW_CNTRL attribute is set to ASRL_FLOW_RTS_CTS, this attribute is ignored when changed, but can be read to determine whether the background flow control is asserting or unasserting the signal.

StopBits

The number of stop bits used to indicate the end of a frame.  The value ASRL_STOP_ONE5 indicates one and one-half (1.5) stop bits.

ReplacementCharacter

Specifies the character to be used to replace incoming characters that arrive with errors (such as parity error.)

XONCharacter

Specifies the value of the XON character used for XON/XOFF flow control (both directions).  If XON/XOFF flow control (software handshaking) is not being used, the value of this attribute is ignored.

XOFFCharacter

Specifies the value of the XOFF character used for XON/XOFF flow control (both directions).  If XON/XOFF flow control (software handshaking) is not being used, the value of this attribute is ignored.