Professional Documents
Culture Documents
Abstract
Features
Product Overview
Z8 Encore! products are based on the new 8-bit
eZ8 CPU, and introduce Flash memory to Zilogs
extensive line of 8-bit microcontrollers unit
(MCU). The Flash in-circuit programming capability allows for faster development time and program
changes in the field. The new eZ8 core maintains
backward compatibility with Zilogs popular Z8
MCU.
Featuring Zilogs high performance register-to-register based architecture (eZ8), the new Z8 Encore!
MCUs combine a fast 20 MHz core, up to 64 KB
of Flash memory, up to 4 KB of linear register
SRAM, and an extensive array of on-chip peripherals. These peripherals make Z8 Encore! suitable
for a variety of applications including motor control, security systems, home appliances, personal
electronic devices, and sensors.
Up to 4 KB register SRAM
3-channel DMA
Up to 60 I/O pins
On-Chip Debugger
Discussion
A discussion on designing a battery charger is presented in this section. For further details, see Reference on page 8.
Theory of Operation
When designing a battery charger, the following
aspects are considered:
Setpoint
(VSET /I SET )
+
-
Error
Control Signal
(PWM)
Controller
Actuator
(Buck Converter)
Output
(VOUT /I OUT)
Feedback Signal
(VFB /IFB)
Feedback Circuits
AN013703-0708
Page 2 of 17
( t ) = ( k1 e ( t ) + k2 e ( t ) dt )
To be useful for a microcontroller-based (discrete)
system, the integral is approximated by a running
sum of the error signal. Thus, an equation can be
expressed as follows called Equation 1:
k1
[ k ] = C1 e [ k ] + C2 e [ j ]
j=0
k2
[ k 1 ] = C1 e [ k 1 ] + C2 e [ j ]
j=0
Subtracting Equation 2 from Equation 1 and rearranging the terms yields Equation 3, as follows:
[ k ] [ k 1 ] = ( Kp e [ k ] + Ki e [ k 1 ] )
AN013703-0708
Equation 3 is the velocity algorithm. It is a convenient expression, as only the incremental change in
the manipulated variable is calculated.
For a detailed discussion on controllers, see Reference on page 8.
Page 3 of 17
Z8 Encore!-Based Battery
Charger
This section offers an overview of the functional
architecture of the battery charger implementation
using Z8 Encore!.
Hardware Architecture
The Z8 Encore!-based charger features the following hardware blocks. Figure 2 displays the following hardware blocks:
Z8 Encore! MCU
Feedback section
+
Step-Down (Buck)
Converter
Battery
Z8 Encore! MCU
ADC Channels
Converter V/I,
Battery Voltage
Feedback
GPIO as Inputs
Batter Selector
(Jumper Settings)
GPIO as Outputs
Status Indicator
(LED Port)
AN013703-0708
External
Power Source
PWM Output
Status
Description
D4
ON
D5
ON
D6
ON
D7
ON
D8
ON
No battery is selected.
D9
ON
D10
ON
Charging is successfully
completed.
Page 4 of 17
Software Implementation
All Z8 Encore! peripherals are initialized to the
required mode of operation. The jumper settings
are read and the battery type is validated. When the
battery type is fixed, the battery parameters are
loaded into the variables. At present, these battery
parameters are defined in the header file.
Initially, based on battery ratings, each module sets
the safety and termination thresholds. Then typedependent settings, such as converter voltage, current outputs, and current limit are calculated. When
these one-time calculations are completed, the
charger software enters an infinite loop, which is
broken only by a successful charge completion or a
safety error.
Inside the loop, the ADC reads the actual values
for the converter output voltage, the battery voltage, and the current. The ADC measures the output
voltage and output current of the DCDC converter
as a feedback to the controller. It measures the voltage at the battery terminals as an input to determine
the charge termination.
When the actual values are known, they are
checked for safety limit compliance. The safety
routine is responsible for the overall safety features
associated with the battery charger. The charger
ensures safety by comparing the actual converter
voltage and battery voltage with the calculated
thresholds. Crossing these thresholds switches off
the PWM output, which turns off the converter output and terminates charging functions. Such termination protects the batteries in case of a device
failure. The LED status indicator reflects an unsuccessful termination.
Testing
This section contains a detailed test procedure to
demonstrate the working of the Z8 Encore! battery
charger as described in this Application Note. The
test setup to demonstrate the battery charger using
Z8 Encore! is displayed in Figure 3.
AN013703-0708
Page 5 of 17
PWM
Battery
Feedback Attenuators
PC-HyperTerminal
Charger Hardware/External Circuits
Make
Type
Ratings
BPT40
Sony
4 V, 500 mAh
BPT16
Sony
Nickel Cadmium
CP2010H T014
Panasonic
AN013703-0708
Page 6 of 17
300
V out
6000
290
280
5500
Iout
5000
270
260
V batt
250
4500
240
331
361
301
271
211
241
181
151
91
121
61
0
31
3500
Time in minutes
AN013703-0708
91
81
71
61
51
41
31
21
101
160
150
Iout
4800
140
4600
130
4400
120
4200
110
4000
100
1
5000
Iout in mAmps
20
170
V batt
5200
81
3700
5400
73
40
180
65
3900
60
57
Iout
190
5600
49
80
200
V out
5800
41
4100
6000
33
100
25
120
4300
17
140
4500
160
Vbatt
Iout mAmps
180
4700
Time in Minutes
200
Vout
230
11
4000
For SLA batteries, initially the current is effectively limited to 200 mA; it continually falls while
battery voltage increases. The charging profiles
also demonstrate the constant voltage output (Vout)
of the DCDC converter at 4900 mV. See Figure 4.
4900
Iout in mAmps
When the external power supply and the Evaluation Board power supply are switched on, the
PWM waveforms are observed on the oscilloscope.
The battery/converters actual values are indicated
in the HyperTerminal window. The LED status
indicators, as displayed in Figure 2, reflect the
charging status during the charging operation.
Figures 4, 5, and 6 display the test results obtained
while charging various types of batteries.
310
Time in minutes
Page 7 of 17
Summary
This Application Note demonstrates the use of Z8
Encore! in a battery charger implementation. Ordinary battery chargers can charge batteries of a particular type and of a particular voltage. The Z8
Encore!-based hardware/software provides flexibility such that batteries of different types can be
charged with the same charger.
High Frequency Switching Power Supplies: Theory and Design; author: George Chryssis; ISBN:
0-07-010949-4; Publisher: McGraw-Hill Book
Company
Digital Control Systems, Volume 1Fundamentals, Deterministic Control; author: Rolf Isermann; ISBN: 0-387-50266-1; Publisher:
Springer Verlag
Duracellhttp://www.duracell.com/batteries
Eveready/Energizerhttp://data.energizer.com
Sanyohttp://www.sanyo.com/industrial/batteries/index.html
Reference
The documents associated with Z8 Encore! available on www.zilog.com and electronics references
are provided below:
AN013703-0708
Page 8 of 17
Appendix AGlossary
Definitions for terms and expansions for abbreviations used in this application note that are not commonly
used are listed in Table 3.
Table 3. Glossary
Term/Abbreviation
Definition/Expansion
ADC
Analog-to-Digital Converter
ISR
Li-Ion
Lithium Ion
mAh
NiCd
Nickel Cadmium
NiMH
PI
PWM
SLA
AN013703-0708
Page 9 of 17
Appendix BSchematics
This section provides the schematics for the Z8 Encore! battery charger implementation
F1
Z8 Encore! Interface
IN
PA4
PA5
5V
OUT
D5 RXE160
VDD
GND
VCC
S2G
GND
VDD
U14
LM7805C/TO220/0.5A
GND
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
1
3
2
PA1/T0OUT
PA2
PA3/CTS0
GND
VDD
PF7
PC5/MISO
PD3
PD4/RXD1
PD5/TXD1
PC4/MOSI
VDD
GND
PA4/RXD0
PA5/TXD0
PA6/SCL
C
PE4
PE3
GND
PE2
PE1
PE0
GND
VDD
EXTAL
XTAL
PA0/T0IN
PD2
PC2/SS
PF6
RESET
VDD
PF5
PF4
PF3
PE4
PE3
GND
PE2
PE1
PE0
GND
PF2
PF1
PF0
VDD
PD1/T3OUT
PD0/T3IN
EXTAL
XTAL
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
VCC
3
1
PE5
PE6
PE7
VDD
3.3V
VIN VOUT
GND
VDD
VDD
C
R14
680
C24
+ C23
0.1
100/6.3
D6
VDD
GREEN
GND
PC1
R17
U19
VCC
GND
RESET
100K
RESET
DS1233A-15
VDD
R3
1M
C1
C2
18pF
18pF
SW4
RESET
PH3
PH2
PB2
PB3
PB1
PB0
PH1
PH0
C46
C49
C50
0.1uF
0.1uF
0.1uF
0.1uF
GND
0.01
Title
Battery Charger using Z8 Encore!
Size
A
Date:
C45
C30
PB3_ALG3
PB2_ALG2
PH2_ALG10
PH3_ALG11
18.432MHz
GND
VDD
PH0_ALG8
PH1_ALG9
PB0_ALG0
PB1_ALG1
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Y1
100/10
LT1086-3.3/TO220
GND
AVDD
PH0/ALG8
PH1/ALG9
PB0/ALG0
PB1/ALG1
PB4/ALG4
PB5/ALG5
PB6/ALG6
PB7/ALG7
PB3/ALG3
PB2/ALG2
PH2/ALG10
PH3/ALG11
VREF
AGND
XTAL
0.1
C22
47uF
U16
GND
EXTAL
0.1
PA7/SDA
PD6/CTS1
PC3/SCK
PD7/RCOUT
PG0
GND
PG1
PG2
PE5
PE6
PE7
VDD
PG3
PG4
PG5
PG6
VDD
PG7
PC7/T2OUT
PC6/T2IN
DBG
PC1/T1OUT
PC0/T1IN
GND
Z8F
C21
P3
+ C15
RESET
VDD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
C17
U1
PW R JACK
Document Number
<Doc>
Tuesday, January 07, 2003
2
Rev
Sheet
of
Page 10 of 17
Vp
1K
V_out(+)
R37
V_out(-)
IRF9540
Q1
18E
D2
R1
L1
Q2
2N2222
PC1/ T1OUT
3.3K
120uH
MBR360
C1
R4
470E
C2
(+)
R2
D3
MBR360
2.2K
100uF
V_batt(+)
R5
79E
100uF
BT1
BATTERY
TO BE CHARGED
D1
LED
V_batt(-)
(-)
R6A
10E
R6B
10E
C3
0.1uF
Rsense
I_out(+)
3.3 Volts
R7
560E
D4
LED
R8
560E
R9
560E
D5
LED
D6
LED
R10
560E
D7
LED
R11
560E
D8
LED
R12
560E
R13
560E
D9
LED
D10
LED
PE1
PE2
PE3
PE4
PE5
PE6
PE7
Title
Using Z8 Encore! as a Battery Charger
Size
A
Date:
5
Document Number
<Doc>
Tuesday, January 07, 2003
2
Rev
0.0
Sheet
of
Page 11 of 17
0.1uF
0.1uF
C7
C7
R25
1K
R17
Feedback Circuits
12V
R23
10
10K
I_out(+)
PB2/ANA2
V_batt(+)
Battery Current
11
R14
R15
R24
1K
R16
1K
C8
10uF
PB1/ANA1
Battery Voltage
10K
1K
V_batt(-)
R34
LM324
U1A
11
R22
10K
I_out(-)
LM324
U1C
1K
1K
12V
0.1uF
C7
VCC
R21
1K
11
12V
10K
V_out(-)
V_out(+)
R18
7
R19
5
10K
R20
1K
PB3/ANA3
Converter Output Voltage
C10
0.1uF
C9
0.1uF
C11
100uF
LM324
U1B
3.3 Volts
R31
10K
1
2
PH0
PH1
R32
10K
1
2
PH2
R33
10K
1
2
Note:
1. R14 - R30 all 1% MFR.
2. Signal, Digital, and Power Grounds are connected on
the evaluation board.
1
2
PH3
J2
J3
J4
J5
Title
Select
NiCd
Select
NiMH
Select
SLA
Select
Li-Ion
Size
A
Date:
5
Document Number
<Doc>
Tuesday, January 07, 2003
2
Rev
0.0
Sheet
of
Page 12 of 17
Appendix CFlowcharts
The main battery-charging routine is displayed in Figure 10.
Start
Initialize peripherals
No
Yes
No
Yes
Terminate
AN013703-0708
Page 13 of 17
Start ISR
AN013703-0708
Page 14 of 17
AN013703-0708
Page 15 of 17
AN013703-0708
Page 16 of 17
As used herein
Life support devices or systems are devices which (a) are intended for surgical implant into the body, or (b)
support or sustain life and whose failure to perform when properly used in accordance with instructions for
use provided in the labeling can be reasonably expected to result in a significant injury to the user. A
critical component is any component in a life support device or system whose failure to perform can be
reasonably expected to cause the failure of the life support device or system or to affect its safety or
effectiveness.
Document Disclaimer
2008 by Zilog, Inc. All rights reserved. Information in this publication concerning the devices,
applications, or technology described is intended to suggest possible uses and may be superseded. ZILOG,
INC. DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY
OF THE INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT.
Z I L O G A L S O D O E S N O T A S S U M E L I A B I L I T Y F O R I N T E L L E C T U A L P R O P E RT Y
INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR
TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE. The information contained within this
document has been verified according to the general principles of electrical and mechanical engineering.
eZ8, Z8, Z8 Encore!, and Z8 Encore! XP are trademarks or registered trademarks of Zilog, Inc. All other
product or service names are the property of their respective owners.
AN013703-0708
Page 17 of 17