getstatus

 

Function specification:

Int getstatus ( )

Parameters returned

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.

recover

 

Function specification:

Int recover

Parameters returned

ErrCode. If the bus recovery failed error code 8006H is returned

 

otherwise the status is returned.

Prerequisites

Adapter must be configured using setup.

Functional description

This function issues two consecutive stop commands on the bus, with a

 

delay in between. It then clears the adapter registers and reads the

 

status. This should normally set the adapter into a known idle state when

 

a bus error or other problem has occurred.

 

If the status does not indicate bus free or the Bus Error bit is still set then

 

8006H is returned otherwise the status is returned.

sendbytes

Function specification Int sendbytes (int far *transferarray)

The far pointer must point to a single dimensional array the format of which is detailed below. The calling function must have initialised elements 0, 1 and 2 prior to calling the function.

Element no

Element name

Description

0

slaveaddress

Slaveaddress is the address to be accessed via the I2C

 

 

Bus, this is in hexadecimal e.g. A0H.

1

wordaddress

Wordaddress is the offset within the slave to which the

 

 

first byte of data is to be written, see transmission format

 

 

for more details.

2

nobytes

The number of bytes (n) to be sent. Min value 1.

3

byte 0

First byte to be sent.

 

 

 

 

 

byte n

Last byte to be sent.

Parameters returned

bsent, the number of bytes actually sent.

Prerequisites

Adapter must be configured using setup. Array elements 0, 1 and 2

 

must be initialised. Usually elements 3 to n would also be initialised.

 

Array must be pre-defined to a size at least large enough to hold all the

 

parameters and data concerned.

Transmission format

There are two transmission formats, these are:

i.start-slaveaddress-byte(s)-stop

If transmission format i.) is required set the wordaddress to a number greater than FFH.

ii.start-slaveaddress-wordaddress-byte(s)-stop

If transmission format ii.) is required set the wordaddress to a number less than or equal to FFH.

Functional description

The function determines the required transmission format and then

 

sends a start code and the slave address. If transmission format ii) has

 

been selected the wordaddress is sent.

 

The data bytes are then transmitted sequentially.

 

Should a time-out occur or he slave not acknowledge a transfer the

 

transmission is terminated by a stop and the number of bytes actually

 

transmitted is returned.

Revision 1.7

Page 18 of 27

09/12/1999

 

Page 19
Image 19
Calibre UK ICA93LV user manual Getstatus, Sendbytes