Getstatus, Recover, Slavelastbyte – Calibre UK UCA93 User Manual

Page 12: Calibre

Advertising
background image

CALIBRE

Issue 1.0

Page 9

01/07/03

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

Functional description

Sends a start code and the slave address.
The function waits for the address to be sent. Should a time-out occur during
the sending of an address then an error code 8004H is returned, otherwise the
status is returned.

3.3.6.

GetStatus

Function specification: Int GetStatus(void)
Parameters are:

None

Parameters returned

int I2Cstatus
The current value of the bus status is returned.

Prerequisites

Adapter must be configured using Setup.

Functional description

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

3.3.7.

Recover

Function specification

Int Recover(void)

Parameters are:

None

Parameters returned

int ErrCode.
If the bus recovery failed error code 800FH is returned otherwise the status is
returned.

Prerequisites

Adapter must be configured using Setup.

Functional description

This function clears all USB buffers and issues three consecutive stop
commands on the bus, with a delay of about 5uS 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
800FH is returned otherwise the status is returned.

3.3.8.

SlaveLastByte

Function specification

void SlaveLastByte(void)

Parameters are:

None

Parameters returned

None.

Prerequisites

Adapter must be configured using setup. This function would normally only be
called following the end of a transmission in slave write mode - when the
Adapter is being read as a slave, by another master, not when writing to a slave
using the Adapter.

Functional description

This function is used when the Adapter is a slave being read by a master
elsewhere on the bus - the Adapter is in slave write mode. The function must
be called immediately after the master indicates the last byte has been read (by
not acknowledging that byte). This function is required to clear the I2C data
lines so that the master can send a stop signal.

Advertising