User manual

I2C API reference
46 © 2007-2010 Analytica GmbH
I2COpenDevice
I2COpenDevice — Opens a network connection to an AnaGate I2C or an AnaGate Universal
Programmer).
Syntax
#include <AnaGateDllI2C.h>
int I2COpenDevice(int * pHandle, unsigned int nBaudrate, const char *
pcIPAddress, int nTimeout);
Parameter
pHandle Pointer to a variable, in which the access handle is saved in the event of a successful
connection to the AnaGate device.
nBaudrate Baud rate to be used for the I2C bus. Teh value can be set individually, like
• 100000 for 100kBit (standard mode)
• 400000 for 400kBit (fast mode)
Note
pcIPAddress Network address of the AnaGate partner.
nTimeout Default timeout for accessing the AnaGate in milliseconds.
A timeout is reported if the AnaGate partner does not respond within the defined
timeout period. This global timeout value is valid on the current network connection
for all commands and functions which do not offer a specific timeout value.
Return value
Returns Null if successful, or an error value otherwise (Appendix A, Return Codes).
Description
Opens a TCP/IP connection to an AnaGate I2C (resp. AnaGate Universal Programmer). After the
connection is established, access to the I2C bus is possible.
Note
The AnaGate I2C (resp. the I2C interface of an AnaGate Universal Programmer) does
not allow more than one concurrent network connection. During an established network
connection all new connections are refused.
See the following example for the initial programming steps.
#include <AnaGateDllI2C.h>