Calibre UK UCA93 manual Int NoBytesToReceive

Page 15

CALIBRE

3.3.16.BlockSlaveTransmitterStatus

Function specification

int BlockSlaveTransmitterStatus (void))

Parameters are:

None

 

Parameters returned

int TransferStatus.

 

Returns 0 if the transfer has not been completed.

 

Returns the a status if the transfer is completed (see below).

 

Bit 0

Set if a write address received

 

Bit 1

Set if word address 0 received

 

Bit 2

Set if word address 1 received

 

Bit 3

Set if restart received

 

Bit 4

Stop detected

 

Bit 5

Set if the transfer timeout (Value in Setup function) occurred

 

Returns 900BH if the transfer time out.

Prerequisites

Adapter must be configured using Setup. The transfer must be started using

 

the BlockSlaveTransmittter function.

Functional description

Returns the current status of the BlockSlaveTransmittter transfer NOTE this

 

function will time out the BlockSlaveTransmittter function.

 

Read two bytes of data from the Adapter using GetBlockData to determine

 

where the master read from in the block (high byte first), read the next two

 

bytes to determine how many bytes of data the master read from the slave

 

(high byte first), read 1 byte to determine the status.

3.3.17.BlockSlaveReceiver

Function specification

int BlockSlaveReceiver (int NoBytesToReceive, int Timeout)

Parameters are:

int NoBytesToReceive

 

The number of bytes to expected from the master. NOTE if the protocol

 

requires the master to transmit one or more word address bytes these MUST

 

be included in the NoBytesToReceive. The maximum size of this buffer is 2048

 

exceeding this WILL cause the data to be corrupted.

 

PLEASE NOTE THIS MUST INCLUDE THE NUMBER OF WORD ADDRESS

 

BYTES IF THEY ARE TRANSMITTED BY THE MASTER

 

Int Timeout

 

If the transfer is not completed within Timeout seconds the

 

BlockSlaveReceiverStatus will return a Timeout error.

Parameters returned

Returns an unused integer.

Prerequisites

Adapter must be configured using Setup.

Functional description

This function causes the Adapter to respond to I2C master transmission of

 

data. This function supports transfers where the master sends WordAddress

 

pointers to data locations within the transfer block.

 

Should the master exceed the number of bytes expected the Adapter will

 

honour all transfers for data and the overflow will be reported see

 

BlockSlaveReceiverStatus.

 

This function allows the user to emulate simple slave devices e.g. EEPROM

 

BUT once the master has completed the transfer the Adapter will NOT respond

 

to any further requests for data until the BlockSlaveReceiver is called again.

Issue 1.0

Page 12

01/07/03

 

Image 15
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 Timeout Int RdDataInt NoBytesToTransmit 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