Moxa UC-8416-T-LX [65/90] Setinterface

Moxa UC-8430-T-LX [65/90] Setinterface
UC-8410/8416/8418/8430 Programmer's Guide
5-13
Note: For the UC-8418, 8 additional digital input channels and 8 additional digital output channels
are provided. The port numbers for these go from 4 to 11.
UART
The normal tty device node is located at /dev/ttyM0 … ttyM7, and the modem tty device node is located at
/dev/cum0 … cum7.
The UC-8410/8416/8418/8430/8430 supports Linux standard termios control. The Moxa UART Device API
allows you to configure ttyM0 to ttyM7 as RS-232, RS-422, 4-wire RS-485, or 2-wire RS-485. The
UC-8410/8416/8418/8430/8430 supports RS-232, RS-422, 2-wire RS-485, and 4-wire RS485.
You must include <moxadevice.h>.
#define RS232_MODE 0
#define RS485_2WIRE_MODE 1
#define RS422_MODE 2
#define RS485_4WIRE_MODE 3
1. Function: MOXA_SET_OP_MODE
int ioctl(fd, MOXA_SET_OP_MODE, &mode)
Description
Set the interface mode. Argument 3 mode will pass to the UART device driver and change it.
2. Function: MOXA_GET_OP_MODE
int ioctl(fd, MOXA_GET_OP_MODE, &mode)
Description
Get the interface mode. Argument 3 mode will return the interface mode.
There are two Moxa private ioctl commands for setting up special baudrates.
Function: MOXA_SET_SPECIAL_BAUD_RATE
Function: MOXA_GET_SPECIAL_BAUD_RATE
If you use this ioctl to set a special baudrate, the termios cflag will be B4000000, in which case the B4000000
definition will be different. If the baudrate you get from termios (or from calling tcgetattr()) is B4000000, you
must call ioctl with MOXA_GET_SPECIAL_BAUD_RATE to get the actual baudrate.
Setinterface
The Serial Port Expansion Module has 8 serial ports, labeled ttyM0 to ttyM7. The ports support RS-232, RS-422,
and RS-485 2-wire and 4-wire operation modes with baudrate settings up to 921600 bps.
The default operation mode is set to RS-232. You can use the setinterface command to change the serial port
operation mode.
Usage: setinterface device-node [interface-no]
device-node -- /dev/ttyMn; n = 0,1,2,...
interface-no -- As shown in the following table:
interface-no Operation Mode
None Display current setting
0 RS-232
1 RS-485 2-wire

Содержание

Скачать