User`s manual
Serial Programming Tools
Intellio C320Turbo User's Manual 4-5
UNIX
Programming the MOXA Ports
The system calls that apply to standard tty port also apply to MOXA port since
MOXA port conforms to UNIX tty standard. System calls are like open(), ioctl(),
read(), write(), close(), etc. Please refer to your UNIX Programmer's Reference manual.
However, these system services only provide limited functions and thus may not
satisfy the sophisticated programmers’s need. In order to fully control the hardware,
MOXA supports extended services through ioctl() command, which are:
1. MIBUFED (=0x401) To get byte count in input buffer.
2. MOBUFED (=0x402) To get byte count in output buffer.
3. MTCRTS (=0x403) To control RTS output signal.
4. MTCDTR (=0x404) To control DTR output signal.
5. MLOWATER (=0x405) To set output buffer low water level.
6. MSTATUS (=0x407) To read modem line status (CTS/DSR/DCD).
7. MHWFLOW (=0x40e) To enable/disable the hardware flow control.
The next Section details all the commands.
Extended UNIX Ioctl() Commands
The following describes the syntax and usage of MOXA extended functions for both
non-SVR4.x and SVR4.x UNIX. The variable moxa_fd is the returned file descriptor by
open() a specific MOXA port. For example,
int moxa_fd;
moxa_fd = open("/dev/ttya11",O_RDWR);