Calibre UK PICA93LV Software Utilities, C\Clib\Spica.Lib, C\Clib\Cpica.Lib, C\Clib\Mpica.Lib

Page 7

CALIBRE

￿

￿

SOFTWARE UTILITIES

3.1.Introduction

Unpack the software from the CD-ROM in accordance with the instructions provided with the licence.

The Software utilities contain simple DOS routines in both C, QBASIC and Windows DLL / LIB (16bit only) for use with Visual Basic and Microsoft C++.

These utilities can be used for setup the PICA and to perform basic communications.

3.2.DOS C Library/Programs

3.2.1.

Files on disc

 

\C\CLIB\SPICA.LIB

The library containing the low level functions (small memory

 

 

model)

\C\CLIB\CPICA.LIB

The library containing the low level functions (compact memory

 

 

model)

\C\CLIB\MPICA.LIB

The library containing the low level functions (medium memory

 

 

model)

\C\CLIB\LPICA.LIB

The library containing the low level functions (large memory

 

 

model)

\C\LIBSOURC\PICA.C

The source code for the libraries

\C\INC\PICA.H

The include file for the library

\C\SOURCE\I2CINC.C

The I2C transfer functions

\C\SOURCE\PROMREAD.C

Sample EEPROM reading function

\C\SOURCE\PROMWRIT.C

Sample EEPROM writing function

\C\SOURCE\READ.MAK

Make file for PROMREAD.C

\C\SOURCE\WRITE.MAK

Make file for PROMWRIT.C

3.2.2.Typical C Project Arrangement

#include DOS.H

PICA.H

MAKELIB

PICA.C

XPICA.LIB

#include PICA.H Compile I2CINC.OBJ I2CINC.C

User applicationCompile PROMREAD.OBJ e.g. PROMREAD.C

LINK

PROMREAD.EXE

Figure 2.0 Typical Project Arrangement.

Figure 2.0 shows a typical C project, Calibre UK Ltd have produced the library files, SPICA.LIB, MPICA.LIB, CPICA.LIB and LPICA.LIB, which contains all the low level functions required to interface to the adapter via the parallel port. These libraries cover the standard memory models, the library appropriate to the memory model of your project will require linking with the object files.

Issue 1.3

Page 4

22/07/99

Image 7
Contents Calibre Copyright CalibreContents Packing List Configuring the AdapterIntroduction General IntroductionTypical PC Connection Installing the AdapterBus Capacitance Limitations Connecting the Adapter to Your SystemConnector Pinout Power Supply\C\CLIB\MPICA.LIB Software Utilities\C\CLIB\SPICA.LIB \C\CLIB\CPICA.LIB\B\SOURCE\PROMWRIT.BAS DOS Qbasic Library/Programs\B\SOURCE\I2CINC.BAS \B\SOURCE\PROMREAD.BASWindows LIB/DLL Functions Int sclk Using the UtilitiesRoutines Int ownaddressInt slaveaddress Int i2cstatusInt setnack Calibre Int i2cdata Calibre Int i2cstatus Number if the adapter is to read from the slave I2cstatus% Qbasic RoutinesOwnaddress% Sclk%Slaveaddress% I2cdata% Setnack%See Appendix a for details status codes I2cstatus% Is to read from the slave Int baseaddress Libraries for Programming in Microsoft Windows EnvironmentsInt statuswait Int wrData Int ErrCodeSendaddress Address to be accessed via the I2C, e.g. A1H Int far *transferarray Int sendbytesint far *transferarrayInt bsent Int nobytesread Int getbytesint far *transferarraySlave using the adapter Further Information Bit 6 Not Used Bit 4 The Bus Error BER BitAppendix a Parallel I2C Communications Adapter Status Codes Bit 7 MSB The Pending Interrupt Not PIN BitAppendix B Parallel I2C Communications Adapter Control Codes Question Question Get corrupted transfers why is this?Most Commonly Asked I2C Questions Question Do you have software to talk to my........?Code. Why? Please Email Your Query to