CALIBRE

￿

￿

4.4.Libraries for Programming in Microsoft Windows Environments

The library function descriptions in this section apply equally to both C++ and Visual Basic applications.

4.4.1.Users of ICA90 / 93 I2C adapters

For those customers who have already used the ICA90 or ICA93 I2C adapters and are wishing to convert there windows applications to the Parallel I2C Adapter the following changes will have to be made:-

C++ applications

Change the link option to c:\your path\LPTI2C.LIB.

The I2CINC.H file is identical for both the ICA90 / 93 and the PICA93LV applications.

VB3.0 applications

Replace the project file CALI2C.BAS for the LPTI2C.BAS supplied.

To simplify the conversion the setup function retains the base address parameter, this is not used by the PICA93LV function and any integer value may be passed (even your existing 310 hex).

4.4.2.C functions - Function Prototypes

To ensure the prototypes are added correctly copy the file I2CINC.H into the directory containing your project and add the line:

#include "I2CINC.H"

Remember to add the library LPTI2C.LIB to your project make file.

4.4.3.Visual Basic 3.0 functions

Add the file LPTI2C.BAS to your project, this contains the declarations for the procedures within the DLL. If the DLL is not in the root directory change the path to the DLL to suit your system.

The sendbytes and getbytes functions pass the transfer array to the DLL by reference, the following example indicates how to do this:

ReDim transferarray(0 to 258) 'remember 3 locations are required for

 

'the slave write and word addresses so

 

'array allows 256 bytes of data.

transferarray(0) = &HA0

'slave write address.

transferarray(1) = &H00

'slave word address.

transferarray(2) = 256

'the number of bytes.

bytes_sent = sendbytes(transferarray(0))

4.4.4.

setup

 

Function specification

Void setup(int baseaddress, int ownaddress, int sclk, int statuswait)

Parameters are:

int baseaddress

 

 

This has no function and any value may be passed to setup, The

 

 

baseaddress has been retained to enable applications written for the ICA90 /

 

 

ICA93 to be rapidly ported to the PICA93LV.

 

 

int ownaddress

 

 

This is the I2C address to which the adapter is to respond in slave mode. This

 

 

forms the upper 7 bits of the 8 bit address, the lowest bit being the read(1) or

 

 

write(0) bit. This means that if ownaddress = 57H the card will respond to a

 

 

write address of AEH and a read address of AFH.

 

 

int statuswait

Issue 1.3

 

Page 20

22/07/99

Page 23
Image 23
Calibre UK PICA93LV Libraries for Programming in Microsoft Windows Environments, Int baseaddress, Int statuswait