Ser: Serial port

Top  Previous  Next

The 'ser' functions are functions that are used for direct access to the RS232 and RS485 ports.

Please consult the technical manual for details on how many serial ports a specific device offers.

 


serOpen

Opens a serial port.


serClose

Closes a serial port after use.


serGetStatus

Get the status of a serial port.


serSendChar

Sends a single character on a serial port.


serSendString

Sends a string on a serial port.


serSendData

Sends a block of memory on a serial port.


serFrameReceiver

Receives data from a serial port.


serFrameReceiveDone

Releases the buffer from SerFrameReceiver after use.


serFlush

Empties the receive buffer.


serForceDataReady

Forces data to be ready in framed receive.


serSetHandshake

Sets the handshake control.


serGetBufferLevel

Returns the amount of buffer used for a serial port.


serGetCTS

Returns the state of the CTS signal.


serSetRTS

Sets the RTS signal.


serSetDTR

Sets the DTR signal.


serGetDCD

Returns the state of the DCD signal.


serGetDSR

Returns the state of the DSR signal.


serSetWakeup

Configures the serial port as a wake-up source for pmSuspend.

 

 

 

Serial port enumeration

The technical manuals and the serial port API enumerates the serial ports differently. Basically, the technical manual enumerates the port starting with 1 and the serial port API starting with 0.

The following relationship exists:

 


Serial port API

Technical Manual

Port


0

1

1st serial port


1

2

2nd serial port


2

3

3rd serial port


3

4

4th serial port

 

 

RS485 port enumeration

The table below shows the relation between the Serial port API number and the RS485 channels as documented in the technical manual of the various devices:

 

Device type

Serial port 0

Serial port 1

Serial port 2

Serial port 3

MX2 turbo

n/a

n/a

RS485 port 1

n/a

MX2 encore / MX2 warp / DX4i warp / flex

n/a

n/a

On-demand RS485 port 1

n/a

MX2i series

Optional RS485 port 1*

n/a

n/a

n/a

DX4i pro / AX9i pro / AX9 turbo

RS485 port 2*

n/a

RS485 port 1

n/a

AX9 encore

On-demand RS485 port 2*

n/a

n/a

n/a

NX-200

n/a

n/a

RS485 port 1

n/a

NX-400

n/a

n/a

RS485 port 1

RS485 port 2

NX-900 / NX-910

n/a

n/a

RS485 port 1

RS485 port 2

LX2

n/a

n/a

RS485 port 1

n/a

LX4

n/a

RS485 port 1

RS485 port 2

n/a

LX5

n/a

RS485 port 1

n/a

n/a

 

Channels marked with a star * indicates that the RS485 shares resources with an RS232 port. Please consult the technical manual for details.

 

 

Primary and Secondary RS485 port

To support a certain degree of portability in the configuration the notion of a Primary and Secondary RS485 port is introduced. This is especially useful when working with the I/O extension so that the configuration will work on any device with a variable number of RS485 ports.
 
The Primary and Secondary RS485 ports on the various devices are:

 

Device type

Primary RS485 port

Secondary RS485 port

MX2 turbo

Port 1

Port 1

MX2 encore / MX2 warp / DX4i warp / flex

On-demand port 1

On-demand port 1

MX2i series

Optional port 1

Optional port 1

DX4i pro / AX9i pro / AX9 turbo

Port 1

Port 2

AX9 encore

On-demand port 2

On-demand port 2

NX-200

Port 1

Port 1

NX-400

Port 1

Port 2

NX-900 / NX-910

Port 1

Port 2

LX2

Port 1

Port 1

LX4

Port 1

Port 2

LX5

Port 1

Port 1

 

Device types not included in the above table does not offer any RS485 functionality.

 

 

Hardware handshake

RTS/CTS hardware handshake is available on certain devices such as RS232 port 2 or on certain dynamic ports.

 

Programming port

The programming/service port either uses a USB interface or an RS232 port shared with the 1st serial port (API port 0).
When using an RS232 based programming port the programming mode is detected by a signal in the cable. Please refer to the technical manual for details.

 

Dynamic ports

Some devices support externally connected serial ports, e.g. using Bluetooth or USB. These ports are assigned dynamic numbers, outside of the normal range, that are valid only while the port is connected.