Calibre UK ICA93LV user manual Sendaddress

Page 17

baseaddress is the address at which the adapter has been installed, e.g. 310H

ownaddress I2C address to which the adapter is to respond in slave mode. This forms the upper 7 bits of the 8 bit address, the lowest bit being the read (1) or write (0) bit. This means that if ownaddress = 57H the card will respond to a write address of AEH and a read address of AFH.

Statuswait is a period of time (in microseconds) to wait for the required bus status. If this time-out expires the I2C functions will exit returning an error code.

sclk is clock rate (bit rate for the I2C serial bus) when operating as a master.

Value of sclk

Approximate SCL-kHz

0

90

1

45

2

11

3

1.5

Parameters returned

none.

Prerequisites

none.

Functional description

This function characterises the PC and initialises adapter ready for I2C

 

transfers.

sendaddress

 

Functional specification

Int sendaddress (int slaveaddress, int setnack)

 

slaveaddress is the address to be accessed via the I2C, e.g. A0H

 

setnack 1 for no acknowledge 0 for acknowledge – see Functional

 

Description

Parameters returned

ErrCode. If the transfer time out occurs error code 8001H is returned

 

otherwise the status is returned.

Prerequisites

adapter must be configures by running setup.

Functional description

The function waits for the bus to be free. Then sends the slave address

 

with the appropriate acknowledge.

 

The acknowledge is set ready for the data transfer after the address and

 

hence in read mode (odd address being sent) if only one byte is to be

 

read the setnack parameter must equal 1. If more than one byte is to be

 

read or if in write mode (even address being sent) then setnack must

 

equal 0.

writebyte

 

Function specification

Int writebyte (int wrData)

 

wrData is the byte of data to be written.

Paramteres returned

ErrCode. If the transfer time out occurs error code 8004H 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 8004H is returned, otherwise the status is returned. Writebyte is

 

compatible with both master write and slave write modes.

readbyte

 

Function specification

Int readbyte (int setnack)

Revision 1.7

Page 16 of 27

09/12/1999

 

Image 17
Contents ICA93LV ContentsPacking List IntroductionWait State Generator Configuring the AdapterSetting the Adapter Base Address Bus Termination and Protection Installing the AdapterNormal/Long Distance Mode Connecting the Adapter to your System Connector PinoutVariable Voltage Bus Power Supply Bus Capacitance Limitations/Cable ChoiceIntroduction to the Utilities Getting Started Resetting the AdapterLibrary/Programs TurboBASIC Library/Programs2. I2C Status Checking Routine Using the UtilitiesRoutines 1. I2C Setup/Initialisation 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 Restart SendaddressSendstop Sendbytes GetstatusGetbytes Slavelastbyte Further Information Real-Time Bus Monitor BUS ErrorBit 7 MSB The PIN Bit Appendix a I2C Communications Adapter Status CodesBit 6 Not Used Bit 5 The STS BitAppendix B I2C Communications Adapter Control Codes DOS Software Questions Question Do you have software to talk to my........?Hkeylocalmachine System