Serial port control functions

In this section

serial_port.create

See also

Predefined Variables

Input and output control functions

Threaded script functions

Support for Python modules

serial_port.create

Opens communication to a serial port on the device.

By default, the Duplex argument is set to zero, which means the RS-422 protocol will be used. If you want to use RS-485, set the Duplex argument to 1.

Name

The name of the port.

Data type: string.

On nControl units, the format is COM<number>. For example: COM1.

On NIONs, this is the path to the port. For example: /dev/ttyS1.

This argument is required.

Baud rate

Baud rate for data transmission and reception in bits per second.

Data type: Integer.

This argument is required.

Data bits

Data type: Integer.

Default is 8.

Parity

Data type: String.

Default is none.

 

none

No parity bit is sent. Error detection is handled by the communication protocol.

even

The parity bit is set to 1 if the number of ones in the set of bits is odd, therefore making the number of ones even.

odd

The parity bit is set to 1 if the number of ones in the set of bits is even, therefore making the number of ones odd.

mark

Parity bit is always set to the mark signal condition (logical 1).

space

Parity bit is always set to the space signal condition.

Stop bits

Bits sent at the end of every character to signify the end of the character in the data transmission. Normally, 1 stop bit is used.

Data type: Float.

Can be set to 1, 1.5, 2. Default is 1.

Duplex

Integer. Default is 0.

0

Full duplex.

1

Half duplex.