Calibre UK UCA93 manual Int I2Cstatus, Using the Adapter

Page 12

 

 

 

CALIBRE

 

 

 

 

 

 

 

 

 

 

 

 

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.

Issue 1.0

Page 9

01/07/03

 

Image 12
Contents Calibre Calibre Contents Connecting the Adapter to your System General IntroductionPacking List Bus Termination and ProtectionVariable Voltage Bus Power Supply Bus Capacitance Limitations/Cable ChoiceInstalling the Adapter IntroductionLibraries for Programming in Microsoft Windows Environments Function Prototypes Calibre Int SlaveBlockTimeout Int ownaddressInt ClockSpeed Int BusVoltageInt DataByte SendAddressInt I2CData NoneUsing the Adapter Int I2CstatusInt NoBytesToSend Int NoTriesInt DataVal Returns an unused integerInt Timeout Int RdDataInt NoBytesToTransmit Int NoBytesToReceive Int PullupVoltage Int IOState IntSendAddressNoStatus WriteByteNoStatus Real-Time Bus Monitor StopBit 4 The BER Bus Error Bit Appendix a I2C Communications Adapter Status CodesBit 7 MSB The old PIN Bit Bit 5 The old STS BitUSB Bus Characteristics Polling the Status Register and how to avoid itBlock Functions Block Write FunctionSlave Transmitter Function Slave Receiver FunctionCalibre When the the Most Commonly Asked I2C Questions Question Get corrupted transfers why is this?General Questions Question Do you have software to talk to my........?