Calibre UK ICA93LV Appendix a I2C Communications Adapter Status Codes, Bit 7 MSB The PIN Bit

Page 24

Appendix A I2C Communications Adapter Status Codes

This is an eight bit register, read using the getstatus routine. Each individual bit has its own meaning as follows:

Bit 7 (MSB) - The PIN Bit

The PIN bit “Pending Interrupt Not” is a read-only flag which is used to synchronize serial communication. Each time a serial data transmission is initiated (by sendaddress routine or setting STA bit) the PIN will be set (= 1) automatically. After successful transmission of one byte (9 clock pulses, including acknowledge), this bit will be automatically reset (= 0) indicating a complete transmission. When the ENI bit (enable interrupt) is also set, the PIN triggers an external interrupt via the selected IRQ line when PIN is reset. When in receiver mode, the PIN is also reset on completion of each received byte. In polled applications, the PIN bit is tested (using the getstatus routine) to determine when a serial transmission has been completed. In receiver mode, the PIN bit is tested (using the readbyte function). When the PIN becomes set all other status bits will be reset, with the exception of the BB (not Bus Busy) bit.

In short, when transmitting data, if PIN = 0 then the data has been sent, if PIN = 1 then it has not. When receiving data, if PIN = 0 then there is unread received data ready to read, if PIN = 1 then either the data received has already been read, or no data has yet been received.

Bit 6 - Not Used

This bit is not currently used and will always = 0.

Bit 5 - The STS Bit

When in slave-receiver mode (i.e. transmission initiated by a master elsewhere on the I2C bus), the flag STS = 1 when an externally generated Stop condition is detected, otherwise STS = 0. This flag is used only in slave-receiver mode.

Bit 4 - The BER Bit

The BER (Bus Error) bit. BER = 1 when a misplaced Start or Stop has been detected, otherwise BER = 0. This can be quite serious since the I2C devices on the bus may be left in an undefined state after a bus error has occurred - in some circumstances the only way to get the bus going again may be to reset all the I2C devices on it.

Bit 3 - The LRB/ADO Bit

The LRB (Last received Bit) / ADO (Address 0 “General Call” Address Received) bit. This dual function status bit holds the value of the last received bit over the I2C bus when AAS (Bit 2) = 0. Normally this will be the value of the slave acknowledge; thus checking for slave acknowledgement is done via testing of the LRB bit. When AAS (Bit 2) = 1 (“Addressed As Slave”), the I2C Communications Adapter has been addressed as a slave and the ADO bit will = 1 if the slave address received was the “General Call” address. For further information on the “General Call” Address, see the Philips data books referenced in Section 8 of this User Manual.

Bit 2 - The AAS Bit

The AAS (“Addressed As Slave”) bit. When acting as a slave-receiver, this flag is set = 1 when an incoming address over the I2C bus matches the value defined by the setup routine, or if the slave address received was the I2C bus “General Call” address (00 Hex). In all other circumstances, AAS = 0.

Bit 1 - The LAB Bit

The LAB (Lost Arbitration) bit. This bit is set = 1 when, in multimaster operation (more than one master present on the I2C bus) arbitration is lost to another master on the I2C bus. In all other circumstances, LAB = 0.

Bit 0 - The BB Bit

The BB (not Bus Busy) bit. This is a read-only flag indicating when the I2C bus is in use. BB = 0 indicates that the bus is busy, and access is not possible (unless of course it is busy because the I2C Communications Adapter itself has control of the bus). This bit is set = 1 by Stop conditions and reset = 0 by Start conditions. In short, BB = 1 means that the bus is free and a new transmission can be started.

Revision 1.7

Page 23 of 27

09/12/1999

 

Image 24
Contents Contents ICA93LVIntroduction Packing ListConfiguring the Adapter Setting the Adapter Base AddressWait State Generator Installing the Adapter Bus Termination and ProtectionConnecting the Adapter to your System Connector Pinout Normal/Long Distance ModeVariable Voltage Bus Power Supply Bus Capacitance Limitations/Cable ChoiceGetting Started Resetting the Adapter Introduction to the UtilitiesLibrary/Programs TurboBASIC Library/ProgramsUsing the Utilities Routines 1. I2C Setup/Initialisation Routine2. I2C Status Checking Routine 3. I2C Address and Start Sending Routine 4. I2C Read Data Byte from Slave Routine Write Data Byte to Slave Routine Send an I2C Stop RoutineTurboBASIC Routines 1. I2C Setup/Initialisation Routines 7. I2C Restart and Address Sending Routine2. I2C Status Checking Routine 3. I2C Address and Start Sending Routine Write Data Byte to Slave Routine 7. I2C Restart and Address Sending Routine Setup Visual Basic 3.0 functionSendaddress Sendaddress SendstopRestart Getstatus SendbytesGetbytes Slavelastbyte Further Information BUS Error Real-Time Bus MonitorAppendix a I2C Communications Adapter Status Codes Bit 7 MSB The PIN BitBit 6 Not Used Bit 5 The STS BitAppendix B I2C Communications Adapter Control Codes Question Do you have software to talk to my........? DOS Software QuestionsHkeylocalmachine System