Moxa Technologies C168HS user manual Programming the Moxa Ports, Extended Unix Ioctl Commands

Page 64

UNIX

Programming the MOXA Ports

The system calls that apply to standard tty port can also be applied 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' need. In order to meet the user's special purpose, 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 lists the syntax 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/ttye11”,O_RDWR);

1. MIBUFED

This function let you know how many bytes queued in input buffer when this function is issued.

4-6Smartio C168H/HS User’s Manual

Image 64
Contents Smartio C168H/HS User’s Manual May 1999 6th EditionTrademarks Copyright NoticeDisclaimer Moxa Internet Services Hardware Installation Software InstallationConnection Option Opt8x and Cable Wiring TroubleshootingTable of Contents Connection Option Opt8x and Cable Wiring TroubleshootingSerial Programming Tools Technical ReferenceSmartio The Smart Multiport Async Solutions OverviewQuick Installation JP1Introduction Surge Protection Operating System SupportMoxa Serial Comm Tools Wide ApplicationsFeatures UartIntroduction Check ListOpt8A/Opt8B/Opt8S Opt8C/Opt8D Opt8F/Opt8ZRS-422 Mode Introduction Opt8JInstallation Guide RS-485 ModeDefault Settings Smartio C168 SeriesAddress INT Vector 0x1C0Quick Hardware Installation How to Do Quick Hardware InstallationHardware Installation with IO-IRQ Utility Configuration changedIO-IRQ Utility and Hardware Configuration Hardware Installation IRQ SpeedHardware Installation Normal Speed Spectrum High Speed Spectrum Software Installation Windows NTInstalling Driver Software Installation 4Smartio C168H/HS User’s Manual Rx Fifo Trigger Port NumberTx Fifo Size 6Smartio C168H/HS User’s Manual Configuring Board and Port 8Smartio C168H/HS User’s Manual Windows 95/98 Updating DriverRemoving Driver Driver10Smartio C168H/HS User’s Manual Software Installation 12Smartio C168H/HS User’s Manual Software Installation 14Smartio C168H/HS User’s Manual Updating Driver 16Smartio C168H/HS User’s Manual DOS Driver Setup Software Installation 20Smartio C168H/HS User’s Manual Software Installation Loading Driver Unix Unloading Driver# /tmp/moxa/mxinstall # cdSCO Unix # moxaadmFor Unix SVR4.2 For SCO UNIX/OpenServerFor SCO UNIX/OpenServer For Unix SVR4.2 Moxa TTY Device Naming Convention Baud Rate Settings Administration Utility moxaadmSoftware Installation Basic Configuration Non-Modem and Modem Baud RateAdvanced Configuration Baud Rate MappingLabel High/Normal Speed High Speed Low Band High Band Tx Fifo Trigger Port MonitoringRTS/CTS Hardware Flow Control Software Installation Terminal Emulation Driver Removal Setting Moxa Ports to Terminal SCO UNIX/OpenServer36Smartio C168H/HS User’s Manual Installation Windows NT and Windows 95/98PComm Programming Library UtilitiesSerial Programming Tools Diagnostic for Moxa boards only Monitor for Moxa boards under Windows NT Only Serial Programming Tools Terminal Emulator Extended Unix Ioctl Commands Programming the Moxa PortsSyntax for SCO UNIX/OpenServer Syntax for Unix SVR4.2Mtcrts Mtcdtr Mstatus Mhwflow 12Smartio C168H/HS User’s Manual Utilities Terminal Emulator DOS API-232 Library Data Scope RS-485 Programming for Opt8J DiagnoseFunction in PComm or API-232 library. It SolutionThere is a dedicated RS-485 Connection Option Opt8x and Cable Wiring RS-232 Cable Wiring for Opt8A/B/C/D/SOpt8B/C DTE, DB25 Male Opt8A/S DCE, DB25 FemaleOpt8D DTE, DB9 Male Type 1 To connect Smartio C168 Series to a DTE device RTS CTS DSR DTR GND DCDType 2 To connect Smartio C168 Series to a DCE device Opt8B/C Opt8B/C DTE Device DB25 Male RS-422 Cable Wiring for Opt8J/F/Z Opt8D DTE Device DB9 Male DB25 MaleOpt8J/F/Z Followings are operation modes for RS-422 RS-485 Cable Wiring for Opt8J Opt8JRS-422/485 Impedance Matching 12Smartio C168H/HS User’s Manual General Troubleshooting Hardware causes and solutionsSoftware Causes and Solutions Step Io-irqRemove the jumper on position JP1 COM number of the Smartio C168 Series conflicts with others Windows NT system panic blue screenSoftware Cause and Solution Under UNIXs, the newly rebuilt kernel could not boot 8Smartio C168H/HS User’s Manual Specifications AppendixUart 16C550C SCO Xenix QNXPC I/O Port Address Map IO/ Address DeviceDB62 Connector Pinouts Pin no SignalOperating System o Moxa Driver Version Moxa hardware settingsPC Host Return Procedure