baseaddress is the address at which the adapter has been installed, e.g. 310H

ownaddress 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.

Statuswait is a period of time (in microseconds) to wait for the required bus status. If this time-out expires the I2C functions will exit returning an error code.

sclk is clock rate (bit rate for the I2C serial bus) when operating as a master.

Value of sclk

Approximate SCL-kHz

0

90

1

45

2

11

3

1.5

Parameters returned

none.

Prerequisites

none.

Functional description

This function characterises the PC and initialises adapter ready for I2C

 

transfers.

sendaddress

 

Functional specification

Int sendaddress (int slaveaddress, int setnack)

 

slaveaddress is the address to be accessed via the I2C, e.g. A0H

 

setnack 1 for no acknowledge 0 for acknowledge – see Functional

 

Description

Parameters returned

ErrCode. If the transfer time out occurs error code 8001H is returned

 

otherwise the status is returned.

Prerequisites

adapter must be configures by running setup.

Functional description

The function waits for the bus to be free. Then sends the slave address

 

with the appropriate acknowledge.

 

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.

writebyte

 

Function specification

Int writebyte (int wrData)

 

wrData is the byte of data to be written.

Paramteres returned

ErrCode. If the transfer time out occurs error code 8004H is returned

 

otherwise the status is returned.

Prerequisites

Adapter must be configured using setup, start and write address sent by

 

sendaddress.

Functional description

The function writes the data to the adapter and then waits for it to be

 

sent. Should a time-out occur during the sending of the data then error

 

code 8004H is returned, otherwise the status is returned. Writebyte is

 

compatible with both master write and slave write modes.

readbyte

 

Function specification

Int readbyte (int setnack)

Revision 1.7

Page 16 of 27

09/12/1999

 

Page 17
Image 17
Calibre UK ICA93LV user manual Sendaddress