CALIBRE

￿

￿

APPENDIX B Parallel I2C Communications Adapter Control Codes

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

The Control Register is accessed using the controloutp() and controlinp() functions. The function definitions for these are as follows:

void controloutp(int controldata); int controlinp(void);

The Data Register is accessed using the dataoutp() and datainp() functions. The function definitions for these are as follows:

void dataoutp(int controldata); int datainp(void);

E.g. in C, controloutp(0xc3); would cause an Parallel I2C Communications Adapter to generate a Stop condition on the I2C bus. For detailed information on these codes, the Philips data sheet on the PCF8584 device (see Further Information section).

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 start code.

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, send the control code - 1, e.g. 0x40, 0x44, 0x46.

Issue 1.3

Page 29

22/07/99

Page 32
Image 32
Calibre UK PICA93LV user manual Appendix B Parallel I2C Communications Adapter Control Codes