![Microchip Technology ARD00558 Скачать руководство пользователя страница 18](http://html1.mh-extra.com/html/microchip-technology/ard00558/ard00558_user-manual_1785877018.webp)
MCP1632 Single-Cell Li-Ion Battery Charger Demo Board User’s Guide
DS50002321A-page 18
2014 Microchip Technology Inc.
An LED is used to signal the charging state. The on/off states and blinking rates are
defined in
Hardware.h
.
2.4.2.1
CHARGER VARIABLES AND FUNCTIONS
Battery_state – Holds the current charging state of the battery charger. This variable is
available to the main program loop.
enum charge_states { IDLE = 0, FAULT = 1, DONE = 2, PRECHARGE =
3, CHARGE = 4, FLOAT = 5 };
State_counter – Used as a time-out counter for Precharge and Charge states.
I
MIN
– The minimum current value recorded during the constant voltage phase of the
Charge state. When the value of this variable falls below the minimum current threshold
(calculated as a fraction of the battery capacity), the charge is complete.
I
MIN_DB
– The minimum current debouncing counter. When the value of I
SENSE
is
smaller than I
MIN
for I
MIN_UPDATE
times in a row, I
MIN
is updated with the value of I
SENSE.
I
FLAT_DB
– The flat current debouncing counter. This counter is reset every time I
MIN
is
updated. When it reaches zero, it triggers an End of Charge condition.
The charger library has two functions:
•
Init_State_Machine()
initializes the state machine debouncing and time-out
counters, sets the charging voltage and current limits and starts the converter.
This function should be called when starting to charge from Idle.
•
Battery_State_Machine()
contains the code for each of the charge/battery
state machines and will handle state transitions based on the measured current
and voltage values. This function expects to be called every second, otherwise
the time-out counters measure a different interval.
TABLE 2-1:
CHARGING STATES
State Description
Precharge
Charges battery with a low current (usually C/10) until the battery voltage exceeds the defined cutoff
voltage.
Charge
The Charge state has two phases: constant current mode and constant voltage mode. The Charge
cycle starts in constant current mode, in which the battery is charged with a constant current (usually
C/2) until the battery voltage 4.2 V
DC
. After that, it enters the constant voltage mode, keep-
ing a constant voltage at the output (+4.2 V
DC
). When the current is under the minimum threshold or
it does not decrease for a certain time (flat current), the state machine switches to Done state. If the
battery is removed before the charging is complete (battery current is under the battery detection
current), then the state machine switches to Idle state. If a time out occurs before any of these condi-
tions are triggered, then the state machine will switch to Fault state.
Done
When the state machine reaches this state, it means that the battery is fully charged and can be
removed. The converter is stopped, but, if a special Standby_mode is enabled, then this state will
monitor the OCV (Open Circuit Voltage) of the battery and jump back to the Charge state, when it
drops too much. If the Standby_mode is not enabled, then it switches to Idle state.
Idle
In this state, the converter is stopped and the whole system waits for user input. A button press reini-
tializes the state machine, and the charging process starts from the beginning.
Fault
Stops the converter and waits for user input. A button press changes the state to Idle.
TABLE 2-2:
LED STATES
LED State
Description
LED Off
Idle state
LED blinking 0.5 Hz
Precharge and Charge states
LED On
Done state
LED blinking 2 Hz
Fault state
Содержание ARD00558
Страница 23: ...2014 Microchip Technology Inc DS50002321A page 23 A 3 BOARD TOP SILK...
Страница 25: ...2014 Microchip Technology Inc DS50002321A page 25 A 5 BOARD TOP COPPER...
Страница 27: ...2014 Microchip Technology Inc DS50002321A page 27 A 7 BOARD BOTTOM COPPER AND SILK...
Страница 31: ...2014 Microchip Technology Inc DS50002321A page 31 NOTES...