Calibre UK UCA93 manual Int DataByte, SendAddress, Int I2CData, None

Page 11

 

 

 

CALIBRE

 

 

WriteByte

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Function specification

Int WriteByte(int DataByte)

Parameters are:

int DataByte

 

 

This is the byte of data to be written.

Parameters returned

int ErrCode.

 

 

If the transfer time out occurs error code 8002H 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 8002H

 

 

is returned, otherwise the status is returned.

 

 

WriteByte is compatible with both master write and slave write modes.

3.3.3.

ReadByte

 

 

 

 

 

Function specification

Int ReadByte(int SetNack)

Parameters are:

int SetNack

 

 

This controls whether the 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

Parameters returned

then acknowledge is enabled, if SetNack = 1 then acknowledge is disabled.

int I2CData

 

 

If a time-out occurs the ErrCode 8003H is returned, otherwise the data is

 

 

returned.

Prerequisites

Adapter must be configured using Setup, start and read address sent by

 

 

SendAddress.

Functional description

The data is read from the Adapter.

 

 

ReadByte is compatible with both master read and slave read modes.

3.3.4.

SendStop

 

 

 

 

 

Function specification

Int SendStop(void)

Parameters are:

None

Parameters returned

int ErrCode.

 

 

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

 

 

status is returned.

Prerequisites

Adapter must be configured using Setup. Should normally only be used at the

 

 

end of a transmission. Correct acknowledge sequence must have been applied

 

 

if the transmission was a read.

Functional description

Instructs the Adapter to send a stop code and wait for it to be sent.

 

 

Should a time-out occur during the sending of a stop then an error code 8006H

 

 

is returned, otherwise the status is returned.

3.3.5.

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 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. It is

Parameters returned

normal to read data after a restart and hence SetNack will normally be 0.

int ErrCode

 

 

If the transfer time out occurs error code 8004H 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.

Issue 1.0

 

 

 

 

 

Page 8

01/07/03

 

 

 

 

 

 

Image 11
Contents Calibre Calibre Contents Bus Termination and Protection Connecting the Adapter to your SystemGeneral Introduction Packing ListBus Capacitance Limitations/Cable Choice Variable Voltage Bus Power SupplyIntroduction Installing the AdapterLibraries for Programming in Microsoft Windows Environments Function Prototypes Calibre Int BusVoltage Int SlaveBlockTimeoutInt ownaddress Int ClockSpeedNone Int DataByteSendAddress Int I2CDataInt I2Cstatus Using the AdapterReturns an unused integer Int NoBytesToSendInt NoTries Int DataValInt NoBytesToTransmit Int TimeoutInt RdData Int NoBytesToReceive Int PullupVoltage Int Int IOStateSendAddressNoStatus WriteByteNoStatus Stop Real-Time Bus MonitorBit 5 The old STS Bit Bit 4 The BER Bus Error BitAppendix a I2C Communications Adapter Status Codes Bit 7 MSB The old PIN BitBlock Write Function USB Bus CharacteristicsPolling the Status Register and how to avoid it Block FunctionsSlave Receiver Function Slave Transmitter FunctionCalibre Question Do you have software to talk to my........? When the the Most Commonly Asked I2C QuestionsQuestion Get corrupted transfers why is this? General Questions