Moxa Technologies NPort Server Pro User Manual Page 97

  • Download
  • Add to my manuals
  • Print
  • Page
    / 246
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 96
CN2510 User’s Manual Setting Up Device Control
5-10
ASPP Library Introduction
The CN2510 Documentation and Software CD contains example programs that illustrate how to
control an ASPP port. After uncompressing the file ASPP.tar, the folder \aspp_unix\aspp.h will
contain several basic subroutines.
The following subroutines are used to control an ASPP port:
1. sio_init()—start ASPP Library
2. sio_open(ipaddr, p)—open a serial port
3. sio_close(fd)—close a serial port
4. sio_ioctl(fd, baud, mode)—configure a serial port’s baud rate, parity, etc.
5. sio_baud(fd, baud, mode)—configure serial port’s baud rate
6. sio_flowctrl(fd, mode)—configure hardware and/or software flow control
7. sio_lctrl(fd, mode)—line control
8. sio_lstatus(fd)—check line status
9. sio_flush(fd, func)—clear input/output buffer
10. sio_write(fd, buf, len)—write data
11. sio_read(fd, buf, len)—read data
12. sio_break(fd, time)—send break signals
13. sio_oqueue(fd)—check how much data is in the output buffer
14. sio_iqueue(fd)—check how much data is in the input buffer
ASPP Examples for Unix
In general, controlling devices attached to ASPP ports involves using the following procedures:
1. Create a socket for the command port, and then connect to the port.
2. Configure the port’s serial parameters, such as baud rate, via the command port.
3. Create a socket for the data port, and then connect to the port.
4. Transfer data via the data port.
This example program continually sends the string “1234567890” to CN2510’s ASPP port and
then reads back data when the program ends.
Settings:
Target port: parity = None, data bits = 8, stop bit = 1, software (XON/XOFF) flow control, no
hardware (RTS/CTS).
Syntax: # ./example ConsoleServerName [port(1) [Baud(9600)]]
For example:
# ./example CN2510 1 19200
Program sends “1234567890” to port 1 at 19200 bps baud rate and reads back any data on it.
Environment: SCO UNIX. If you’re using another system, modify by including the file name and
other variables.
Page view 96
1 2 ... 92 93 94 95 96 97 98 99 100 101 102 ... 245 246

Comments to this Manuals

No comments