API I/O Access Over TruePort

API I/O Access Over TruePort

You can access IOLAN I/O data through TruePort using the Perle API. The API uses the command/response format. See the ioapiotp.c sample program, found on the product CD-ROM, for an example implementation.

API Request Format

All data in the Request must be sent as a single write to the COM port. The API command takes the following format:

Number of Bytes

Value

1Function Code (in hex):

z 01—Get read/write boolean register z 03—Get read/write register

z 04—Get read only register

z 15—Set read/write boolean register (0x0F) z 16—Set read/write register (0x10)

2Starting register number (see A4/T4 Registers on page 280, A4D2/A4R2 Registers on page 281, or D4/D2R2 Registers on page 282 for this value).

2Number of registers to act on starting from the register defined in byte 2 above.

nData for write. Some values must be read/written as a unit consisting of 2 consecutive registers. If the request is to write, the data to write follows the number of registers. If accessing registers consisting of 2 bytes or 4 bytes, the data is in big endian (network order) format.

API Response Format

The API command takes the following response format:

Number of Bytes

Value

1Function code of request if no error. Most significant bit will be set if an error occurred.

1Length of data in response if no error occurred. If an error occurred, the byte will contain the error code (see the Error Codes table below).

nData response for request (the number of bytes is dependent on the number and type of registers requested). If the request returns 2 or 4 byte values, it will be in big endian (network order) format. If the request returns boolean values, the least significant bit (bit 0) represents the first value requested and bits 1 to 7 represents subsequent boolean values. If more than 8 boolean registers are requested, they are returned in successive bytes.

392

IOLAN SDS/SCS/STS/MDC User’s Guide, Version 4.0

Page 392
Image 392
Perle Systems 5500161-40 manual API I/O Access Over TruePort, API Request Format, API Response Format