Moxa Technologies NPort 5200 Serie User Manual Page 99

  • Download
  • Add to my manuals
  • Print
  • Page
    / 259
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 98
CN2610 User’s Manual Setting Up Device Control
5-10
ASPP Library Introduction
The CN2610 Documentation and Software CD contains example programs that illustrate how to
control an ASPP port. After uncompressing the file ASPP.tar.z, the folder \aspp\as.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 baudrate, parity, etc.
5. sio_baud(fd, baud, mode)—configure serial port’s baudrate
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 baudrate, 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 CN2610’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 CN2610 1 19200
Program sends “1234567890” to port 1 at 19200 bps baudrate 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 98
1 2 ... 94 95 96 97 98 99 100 101 102 103 104 ... 258 259

Comments to this Manuals

No comments