Calibre UK PICA93LV user manual Address to be accessed via the I2C, e.g. A1H

Page 26

CALIBRE

￿

￿

4.4.9.restart

Function specification

Int restart(int slaveaddress, int setnack)

Parameters are:

int slaveaddress

 

 

The address to be accessed via the I2C, e.g. A1H.

 

 

int setnack

 

 

This controls whether the Parallel I2C Communications Adapter transmits an

 

 

Acknowledge down the I2C Bus on reception of a byte. The last byte received

 

 

during a transfer must not be acknowledged, in all other cases acknowledge

 

 

must be enabled. If setnack = 0 then acknowledge is enabled, if setnack = 1

 

 

then acknowledge is disabled. Therefore, if a read (odd numbered) address is

 

 

being sent AND only 1 Byte is to be read, setnack should be set to = 1; in all

 

 

other cases it must be clear = 0.

Parameters returned

int ErrCode

 

 

If the transfer time out occurs error code 8003H is returned otherwise the

 

 

status is returned.

Prerequisites

Adapter must be configured using setup. A start and slave address must

 

 

have previously been sent using sendaddress.

 

 

Usually a data pointer would already have been written using writebyte.

Functional description

Sends a start code and the slave address specified and presets the

 

 

acknowledge status depending on the value of setnack.

 

 

The acknowledge is set ready for the data transfer after the address and

 

 

hence in read mode (odd address being sent) if only one byte is to be read

 

 

the setnack parameter must equal 1. If more than one byte is to be read or if

 

 

in write mode (even address being sent) then setnack must equal 0.

 

 

The function waits for the address to be sent. Should a time-out occur during

 

 

the sending of an address then an error code 8003H is returned, otherwise

 

 

the status is returned.

4.4.10.

getstatus

 

Function specification:

Int getstatus(void)

Parameters are:

None.

Parameters returned

int I2Cstatus

 

 

The current value of the bus status.

Prerequisites

Adapter must be configured using setup.

Functional description

The function reads status word from the adapter and returns it.

4.4.11.

recover

 

Function specification

Int recover(void)

Parameters are:

None.

Parameters returned

int ErrCode.

 

 

If the bus recovery failed error code 8006H is returned otherwise the status is

 

 

returned.

Prerequisites

Adapter must be configured using setup.

Issue 1.3

 

Page 23

22/07/99

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