Phone:(705) 671-2652
    Fax:(705) 671-6127
   Email: tom@ontrak.net
Home Products Programming Applications Custom Designs Ordering News
    
ADU  Series - USB Data Acquisition Interface SDK 
 

ADU RS232 Pipe

The AduHid DLL provides a pipe to transmit data between an application program and the RS232 port on the ADU device.

Data sent to the ADU device via the RS232 pipe is forwarded out on the DB9-RS232 connector. Data coming in from the DB9-RS232 connector is forwarded back to the host PC via the RS232 pipe.

An application opens an ADU RS232 Pipe with the OpenAdu232 function.

Outbound data is written to the RS232 pipe with WriteAdu232.

Inbound data is read from the RS232 pipe with ReadAdu232.

When finished close the RS232 pipe with CloseAdu232.


Note: all RS232 pipe functions include "Adu232" in their name

Command-Response Behavior

The RS232 pipe is a half-duplex connection that can handle one message in one direction at a time.

Thus an application that issues a responsive command must read the response before issuing another command. If two responsive commands are written to the RS232 pipe without an intervening read, then the two responses may corrupt one another.

For example the RD command sent to an ADR2010 board responds with the ASCII values of the 8 analog converters on the board. Every write of an RD command must be followed by a read of the response.

        WriteAdu232(handle, "RD", 2, 0, 0);
        memset(sResponse, 0, sizeof(sResponse));
        ReadAdu232(handle, sResponse, 40, 0, 0);
        // sResponse contains valid data

If two commands are sent sequentially, then a subsequent read of the RS232 pipe may return corrupted data.

        WriteAdu232(handle, "RD", 2, 0, 0);
        WriteAdu232(handle, "RD", 2, 0, 0);
        memset(sResponse, 0, sizeof(sResponse));
        ReadAdu232(handle, sResponse, 40, 0, 0);
        // sResponse may contain corrupted data

The recommended approach for an application program is to create a single thread that controls communication with the ADU device. Thus the sequence of writing commands and reading responses can be enforced.

 

    
Contact Information
Address Telephone Electronic Mail
Ontrak Control Systems Inc.
764 Notre Dame Ave., Unit #1
Tel: (705) 671-2652 General Information Sales or Support
Sudbury,Ontario Fax:(705) 671-6127 tom@ontrak.net
CANADA P3A 2T2    
              
Next-Day shipping anywhere in Continental U.S. via Fed-Ex
Copyright 2012 ONTRAK CONTROL SYSTEMS 764 Notre Dame Ave, Unit #1 , Sudbury, Ontario, CANADA P3A 2T2  
"Quality serial Data Acquisition Interfaces"           PH. (705) 671-2652 FAX (705) 671-6127