AN137 Silicon_Laboratories, AN137 Datasheet - Page 20

no-image

AN137

Manufacturer Part Number
AN137
Description
Lithium ION Battery Charger Using C8051f300
Manufacturer
Silicon_Laboratories
Datasheet
AN137
//-----------------------------------------------------------------------------
time_struct TIME;
char bdata TERMINATION;
char bdata CHARGE_STATUS;
INT code CHECK_BYTE
LONG code VOLT_SLOPE
LONG code VOLT_OFFSET
LONG code I_NOAMP_SLOPE
LONG code I_NOAMP_OFFSET _at_ 0x1A74;
LONG temp_LONG_1,temp_LONG_2;
INT
//-----------------------------------------------------------------------------
// Bit maskable CHARGE STATUS Register Definition
//-----------------------------------------------------------------------------
sbit BULK
sbit LOWCURRENT = CHARGE_STATUS^1;
sbit ERROR
sbit CONST_V
sbit CONST_C
sbit DELAY
sbit READY
sbit FREE1
//-----------------------------------------------------------------------------
// Bit Maskable TERMINATION Register Definition
//-----------------------------------------------------------------------------
sbit TEMP_MIN
sbit TEMP_MAX
sbit I_MIN
sbit I_MAX
sbit TIME_MAX
sbit VOLT_MAX
sbit VOLT_MIN
sbit FREE2
//-----------------------------------------------------------------------------
// Bit maskable PORT Definitions
//-----------------------------------------------------------------------------
sbit SDA
sbit SCL
sbit CEX0
sbit LED0
sbit SW0
#define TBAT
#define IBAT
#define VBAT
//-----------------------------------------------------------------------------
// 8051F300 PARAMETERS
//-----------------------------------------------------------------------------
#define SYSCLK
20
temp_INT_1,temp_INT_2;
= TERMINATION^0;
= TERMINATION^1;
= TERMINATION^2;
= TERMINATION^3;
= TERMINATION^4;
= TERMINATION^5;
= TERMINATION^6;
= TERMINATION^7;
= P0 ^ 0;
= P0 ^ 1;
= P0 ^ 2;
= P0 ^ 3;
= P0 ^ 7;
0xF8;
0x65;
0xF6;
= CHARGE_STATUS^0;
= CHARGE_STATUS^2;
= CHARGE_STATUS^3;
= CHARGE_STATUS^4;
= CHARGE_STATUS^5;
= CHARGE_STATUS^6;
= CHARGE_STATUS^7;
_at_ 0x1A00;
_at_ 0x1A60;
_at_ 0x1A64;
_at_ 0x1A70;
24500000
// Global Struct to Track Time
// Global Variable to Track Termination
// Global Variable to Track Charging
// 0x0A0A Default value, for later use
// Volt Slope Register
// Volt Offset Register
// Current Slope Register,ext. amp off
// Current Offset Register,ext. amp.off
// Temporary Storage Variables
// Temporary Storage Variables
// bit 0 : BULK charge status bit
// bit 1 : LOWCURRENT charge status bit
// bit 2 : ERROR before/during charging
// bit 3 : charged w/ constant VOLTAGE
// bit 4 : charged w/ constant CURRENT
// bit 5 : BULK charge DELAY for LiIon
//
// bit 6 : Lowcurrent charge is
//
// bit 7 : Not Currently used
// bit 0 : minimum TEMPERATURE overflow
// bit 1 : maximum TEMPERATURE overflow
// bit 2 : minimum CURRENT overflow
// bit 3 : maximum CURRENT overflow
// bit 4 : maximum time overflow
// bit 5 : maximum VOLTAGE overflow
// bit 6 : minimum VOLTAGE overflow
// bit 7 : Not Currently used
// bit 0 : SDA In/Output, Pin P0.
// bit 1 : SCL Output, Pin P1.
// bit 2 : PWM Output, Pin P2.
// bit 3 : LED0, Pin P0.3
// bit 7 : Switch0, Pin P0.7
// AMUX Selections; Analog Inputs
// bit 4 : Temp.
// bit 5 : Current Ch.; Analog In
// bit 6 : Voltage Ch.; Analog In
// System clock frequency
Rev. 1.2
after CURRENT threshold detection
terminated; battery is charged
Ch.; Analog In

Related parts for AN137