M
*
Use the WriteComp01 and WriteComp23 commands to
define the COMP register contents (Table 3). Since the
Write-Word protocol supports only 16-bit data transfers,
sequentially execute these commands to write the
entire 32-bit COMP word. First execute WriteComp01
to write C OMP0 and C OMP1, and then execute
WriteComp23 to write COMP2 and COMP3. Executing
WriteComp01 internally disables the COMPINT interrupt
and writes the Write-Word protocol’s LSB into COMP0
and its MSB into COMP1. The COMPINT interrupt dis-
ables on SCL’s 18th rising edge during WriteComp01
execution (Figure 6). Executing WriteComp23 writes the
Write-Word protocol’s LSB and MSB into COMP2 and
COMP3, and enables the COMPINT interrupt. The
COMPINT interrupt reenables on the falling edge fol-
lowing SCL’s 36th rising edge during WriteComp23
execution. Disabling the COMPINT interrupt with the
WriteComp01 command prevents an erroneous inter-
rupt, due to incomplete data in the COMP register. To
ensure proper execution, issue these commands in the
correct sequence.
Direc tion-Change Detec tion Func tion
The MAX1660’s direction-change detection function
informs the host whenever the current flow changes
direction. When it is used in conjunction with the
MAX1660’s digital compare function and CHARGE-
STATUS bit in end-of-charge and end-of-discharge
detection routines, the host can ensure that the digital
compare function continues to monitor the proper
counter when the current flow changes direction.
The direction-change function is simple: the status
word’s DIRCHANGE bit sets any time the current flow
changes direction. Once DIRCHANGE is set, it remains
set until it is cleared; additional changes in the current-
flow direction do not affect the bit. To clear the DIR-
CHANGE bit, write a 1 to the configuration word’s
CLRINT bit. DIRCHANGE also clears when the
MAX1660 enters soft-shutdown mode and after a
power-on reset. In end-of-charge and end-of-discharge
routines, in which the host must be informed immediate-
ly of a change in current-flow direction, set the configu-
ration word’s DIRINTENABLE bit to generate an interrupt
whenever the status word’s DIRCHANGE bit is set.
Digitally Controlled
Fuel-Gauge Interfac e
10
______________________________________________________________________________________
COMMAND
NAME
DESCRIPTION
WriteComp01
Disables the COMPINT interrupt; writes the Write-Word protocol’s LSB into COMP0 and its MSB into
COMP1.
WriteComp23
Writes the Write-Word protocol’s LSB into COMP2 and its MSB into COMP3, and enables the
COMPINT interrupt.
WriteConfig()
Writes the Write-Word protocol’s data bytes into the configuration word. See Table 6 for a descrip-
tion of the configuration bits.
COMMAND
CODE
0x00
0x01
0x04
Table 3. Write-Word Commands
SCL
SDA
BOLD LINE INDICATES MAX1660
PULLING SDA LOW
STOP
CONDITION
ACK BIT CLOCKED
INTOHOST
18TH RISING EDGE OF
SCL DURING WriteComp01
WRITE-WORD PROTOCOL
STOP
CONDITION
INTERRUPT
ENABLES ON
SCL’s FALLING
EDGE
ACK BIT CLOCKED
INTOHOST
36TH RISING EDGE OF
SCL DURING WriteComp23
WRITE-WORD PROTOCOL
INTERRUPT
DISABLES ON
SCL’s RISING
EDGE
Figure 6. Automatic Interrupt Enable/Disable During COMP Update
*Patent pending