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
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
Revision 1.7 | Page 24 of 27 |
09/12/1999 |
|