Calibre UK ICA93LV user manual Appendix B I2C Communications Adapter Control Codes

Page 25

Appendix B – I2C Communications Adapter Control Codes

The Control Register should normally be written using the setup, sendaddress and sendstop routines. To implement more advanced functions such as enabling hardware interrupt generation or implementing long distance mode, these routines may need to be modified or the users own routines used in their place.

The Control Register is accessed by writing to I/O address: 1+Base address of card (set by links on board).

The Data Register is accessed by writing to I/O address: Base address of card (set by links on board).

E.g. in C, outp(0x311, 0xc3); would cause an I2C Communications Adapter with base address = 0x310 to generate a Stop condition on the I2C bus. For detailed information on these codes, the Philips data sheet on the PCF8584 device (see Section 8, Further Information)

0x00

read/write own address register (followed by a data byte to the data register).

0x20

read/write clock register (followed by a data byte to the data register).

After either of the above operations, 0x41 must be written to the control register to re-enable the I2C interface.

0xc3

send a Stop signal over the I2C bus.

 

 

0x41

I2C NOP (no operation) instruction, acknowledge enabled.

 

 

 

(Use 0x41 and 0x40 to turn on and off acknowledge)

 

 

0x45

(While bus is free) - Send Start & slave address, acknowledge enabled. The address to

 

be sent must have first been written to the data register before sending the startcode.

0x45

(While already master on the bus) - Send Repeated Start & slave address (Restart). The

 

address to be sent is placed in the data register after sending the start code.

0x47

send Stop, Start, slave address (i.e. restart transmission without releasing control of the

 

I2C bus). The address to be sent is placed in the data register

after sending the start

 

code.

 

 

To execute the last four instructions with acknowledge disabled, i.e. negative acknowledge - nack, set; send the control code-1, e.g. 0x40, 0x44, 0x46.

Revision 1.7

Page 24 of 27

09/12/1999

 

Image 25
Contents ICA93LV ContentsPacking List IntroductionSetting the Adapter Base Address Configuring the AdapterWait State Generator 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/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 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