AN137 Silicon_Laboratories, AN137 Datasheet - Page 34

no-image

AN137

Manufacturer Part Number
AN137
Description
Lithium ION Battery Charger Using C8051f300
Manufacturer
Silicon_Laboratories
Datasheet
AN137
}
//-----------------------------------------------------------------------------
// Main Function
//-----------------------------------------------------------------------------
void main(void)
{
}
//-----------------------------------------------------------------------------
// PCA_ISR
//-----------------------------------------------------------------------------
// This routine counts the elapsed time in seconds, minutes, hours.
// It also toggles LED0 every second when in Lowcurrent Charge Mode.
// This routine interrupts every time the PCA counter overflows, every 256
//
//
void PCA_OVERFLOW_ISR (void) interrupt 9
{
34
EA = 0;
Reset_Time_Base();
Config_F300();
CalibrateADCforMeasurement();
EA = 1;
while(1)
{
}
LED0 = 0;
TERMINATION = 0x00;
CHARGE_STATUS = 0x00;
BULK = 1;
CONST_C = 1;
while (SW0 == 1);
Delay_Loop();
while (ERROR == 0)
{
}
if (ERROR == 1)
{
}
SYSCLK cycles. After SYSCLK/256 interrupts, one second has elapsed.
}
if (BULK == 1)
{
if (LOWCURRENT == 1)
Turn_PWM_Off();;
LED0 = 0;
EA = 0;
while (1);
LED0 = 1;
Bulk_Charge();
Lowcurrent_Charge();
// Disable All Interrupts
// Config F300
// Calibrate F300
// Enable All Active Interrupts
// Turn LED0 off
// Reset Termination Flags
// Reset Charge Status Flags
// Start in LOWCURRENT Charge mode
// Wait until SW0 pushed
// Wait for Switch Bounce
// Turn LED0,indicates Bulk Mode
// Enter Bulk Charge Mode
// Enter Lowcurrent_Charge function
// Toggle LED0 at 1 Hz rate via ISR
// Turn PWM Off
// Turn OFF LED0 to indicate “ERROR”.
// Disable All Interrupts
// Enter a eternal loop
// No recovery except “reset-button”
Rev. 1.2

Related parts for AN137