Calibre UK ICA93LV user manual Getstatus, Sendbytes

Page 19

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

 

Image 19
Contents ICA93LV ContentsPacking List IntroductionSetting the Adapter Base Address Configuring the AdapterWait State Generator Bus Termination and Protection Installing the AdapterBus Capacitance Limitations/Cable Choice Connecting the Adapter to your System Connector PinoutNormal/Long Distance Mode Variable Voltage Bus Power SupplyTurboBASIC Library/Programs Getting Started Resetting the AdapterIntroduction to the Utilities Library/ProgramsRoutines 1. I2C Setup/Initialisation Routine Using the Utilities2. I2C Status Checking Routine 3. I2C Address and Start Sending Routine 4. I2C Read Data Byte from Slave Routine Send an I2C Stop Routine Write Data Byte to Slave Routine7. I2C Restart and Address Sending Routine TurboBASIC Routines 1. I2C Setup/Initialisation Routines2. I2C Status Checking Routine 3. I2C Address and Start Sending Routine Write Data Byte to Slave Routine 7. I2C Restart and Address Sending Routine Visual Basic 3.0 function SetupSendaddress Sendstop SendaddressRestart Sendbytes GetstatusGetbytes Slavelastbyte Further Information Real-Time Bus Monitor BUS ErrorBit 5 The STS Bit Appendix a I2C Communications Adapter Status CodesBit 7 MSB The PIN Bit Bit 6 Not UsedAppendix B I2C Communications Adapter Control Codes DOS Software Questions Question Do you have software to talk to my........?Hkeylocalmachine System