AN137 Silicon_Laboratories, AN137 Datasheet - Page 23

no-image

AN137

Manufacturer Part Number
AN137
Description
Lithium ION Battery Charger Using C8051f300
Manufacturer
Silicon_Laboratories
Datasheet
//-----------------------------------------------------------------------------
//
// Copyright 2002 Cygnal Integrated Products, Inc.
//
// Filename:
// Target Device: 8051F300
// Created:
// Created By:
// Tool chain:
//
// This is a stand alone battery charger for a Lithium ION battery.
// It utilizes a buck converter, controlled by the on-chip 8-bit PWM,
// to provide constant current followed by constant voltage battery charge.
//
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include <c8051f300.h>
#include “LIION_BC_MAIN.h”
//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------
void Config_F300(void)
{ RSTSRC
//-----------------------------------------------------------------------------
// PCA Configuration
//-----------------------------------------------------------------------------
XBR0
XBR1
XBR2
P0MDOUT
P0MDIN
OSCICN
ADC0CN
REF0CN
PCA0MD
PCA0MD
PCA0L
PCA0H
PCA0CN
//Module 0
PCA0CPM0 = 0x00;
PCA0CPL0 = 0xF0;
PCA0CPH0 = 0xF0;
= 0x02;
= 0x70;
= 0x44;
= 0x40;
= 0x0C;
= 0x8F;
= 0x07;
= 0xC0;
= 0x0C;
= 0x00;
= 0x08;
= 0x00;
= 0x00;
= 0x40;
LIION_BC_MAIN.c
11 SEP 2002
DKC
KEIL Eval C51
// Battery Hearder File
// Enable VDD Monitor
// Skip P0.4,5,6; they’re analog In
// Enable SMBus on P0.0, P0.1, and CEX0
// as PWM at P0.2
// Enable crossbar and weak pull-ups
// Set P0.2 & P0.3 output to push-pull
// Configure P0.4,5,6 as Analog Inputs
// Set SYSCLK to 24.5MHz, internal osc.
// Turn on the ADC Module;
//
// Configure ADC’s to use VDD for
//
//
// Disable WDT
// Set PWM Time base = SYSCLK
// Initialize PCA Counter to Zero
// Enable PCA Counter
// Clear PCA Counter Overflow flag
// Configure CCM0 to 8-bit PWM mode
// Initialize PCA PWM to small duty cycle
// 0xF0 Ensures a Soft Initial Charge
Rev. 1.2
enable low power mode for settling
Voltage Reference,
Enable On-chip Temperature Sensor
AN137
23

Related parts for AN137