Applications information, Table 4. autoincrement rules – Rainbow Electronics MAX7360 User Manual
Page 16

I
2
C-Interfaced Key-Switch Controller and LED
Driver/GPIOs with Integrated ESD Protection
MAX7360
16 _____________________________________________________________________________________
transaction, either read or write, if SCL low exceeds
20ms. After a bus timeout, the MAX7360 waits for a valid
START condition before responding to a consecutive
transmission. This feature can be enabled or disabled
under user control by writing to the configuration register
(Table 8 in the Register Tables section).
Message Format for Writing
the Key-Scan Controller
A write to the MAX7360 comprises the transmission of the
slave address with the R/W bit set to zero, followed by at
least 1 byte of information. The first byte of information
is the command byte. The command byte determines
which register of the MAX7360 is to be written by the next
byte, if received. If a STOP condition is detected after the
command byte is received, the MAX7360 takes no further
action (Figure 7) beyond storing the command byte.
Any bytes received after the command byte are data bytes.
The first data byte goes into the internal register of the
MAX7360 selected by the command byte (Figure 8).
If multiple data bytes are transmitted before a STOP condition
is detected, these bytes are generally stored in subsequent
MAX7360 internal registers, because the command byte
address generally autoincrements (Table 4).
Message Format for Reading
the Key-Scan Controller
The MAX7360 is read using the internally stored
command byte as an address pointer, the same way the
stored command byte is used as an address pointer for
a write. The pointer generally autoincrements after each
data byte is read using the same rules as for a write
(Table 4). Thus, a read is initiated by first configuring the
MAX7360’s command byte by performing a write (Figure
6). The master can now read n consecutive bytes from
the MAX7360, with the first data byte being read from
the register addressed by the initialized command byte.
When performing read-after-write verification, remember
to reset the command byte’s address, because the stored
command byte address is generally autoincremented
after the write (Figure 9, Table 4).
Operation with Multiple Masters
When the MAX7360 is operated on a 2-wire interface with
multiple masters, a master reading the MAX7360 uses a
repeated start between the write that sets the MAX7360’s
address pointer, and the read(s) that takes the data
from the location(s). This is because it is possible for
master 2 to take over the bus after master 1 has set up
the MAX7360’s address pointer, but before master 1
has read the data. If master 2 subsequently resets the
MAX7360’s address pointer, master 1’s read can be from
an unexpected location.
Command Address Autoincrementing
Address autoincrementing allows the MAX7360 to be
configured with fewer transmissions by minimizing the
number of times the command address needs to be sent.
The command address stored in the MAX7360 generally
increments after each data byte is written or read (Table
4). Autoincrement only works when doing a multiburst
read or write.
Applications Information
Reset from I
2
C
After a catastrophic event such as ESD discharge or
microcontroller reset, use bit D7 of the configuration
register (0x01) as a software reset for the key-switch
state (the key-switch register values and FIFO remain
unaffected). Use bit D4 of the GPIO global configuration
register (0x40) as a software reset for the GPIOs.
Figure 9. N Data Bytes Received
Table 4. Autoincrement Rules
REGISTER
FUNCTION
ADDRESS
CODE (hex)
AUTOINCREMENT
ADDRESS (hex)
Keys FIFO
0x00
0x00
Autoshutdown
0x06
0x00
All other key switch
0x01 to 0x05
Addr + 0x01
All other GPIO
0x40 to 0x5F
Addr + 0x01
S
A
A
A
P
0
SLAVE ADDRESS
COMMAND BYTE
DATA BYTE
N BYTES
AUTOINCREMENT
COMMAND BYTE ADDRESS
D7
D6
D5
D4
D3
D2
D1
D0
D1
D0
D3
D2
D5
D4
D7
D6
ACKNOWLEDGE FROM MAX7360
ACKNOWLEDGE FROM MAX7360
ACKNOWLEDGE FROM MAX7360
R/W