1. Field of the Invention
The invention relates to an electrical charge/discharge calculation scheme, and more particularly to an apparatus and method for calculating quantity of electrical charge or quantity of electrical discharge for a battery unit according to a calibration parameter that is used for adjusting/calibrating a time interval of electrical charge calculation.
2. Description of the Prior Art
A conventional scheme employed for calculating electrical charge quantity or electrical discharge quantity for a battery unit is performed based on a fixed integral time interval. In practice, the fixed integral time interval is indicated by a group of consecutive clock cycles having a fixed cycle number, where the clock cycles are carried by a clock signal generated from an oscillator. Ideally, calculating electrical charge/discharge quantity based on the clock cycles having a fixed cycle number will obtain a precise calculation result; however, some variations may be introduced into the oscillator, which result in frequency shifts in the clock cycles. As a result, the clock cycles having a fixed cycle number cannot precisely indicate the integral time interval. Calculating electrical charge/discharge quantity based on clock cycles having a fixed cycle number actually may result in calculation errors.
Therefore, one of the objectives of the present invention is to provide an apparatus and method for calculating an electrical charge quantity or electrical discharge quantity for a battery unit according to a calibration parameter used for adjusting/calibrating a time interval of electrical charge/discharge calculation, in order to solve the above-mentioned problems.
According to an embodiment of the present invention, a method for calculating electrical charge/discharge quantity for a battery unit is disclosed. The method comprises: utilizing an oscillator for generating a clock signal; providing a storage unit for storing a calibration parameter that is used for adjusting or calibrating a time interval of electrical charge/discharge calculation; determining when to generate an interrupt signal to a controller according to the clock signal and the calibration parameter; and measuring a current for the battery unit and calculating the electrical charge/discharge quantity for the battery unit when the interrupt signal is generated.
According to the embodiment of the present invention, an apparatus for calculating electrical charge/discharge quantity for a battery unit is disclosed. The apparatus comprises an oscillator, a storage unit, a timer, and a controller. The oscillator is utilized for generating a clock signal. The storage unit is utilized for storing a calibration parameter that is used for adjusting or calibrating a time interval of electrical charge/discharge calculation. The timer is coupled to the oscillator and the storage element and utilized for determining when to generate an interrupt signal to the controller according to the clock signal and the calibration parameter. The controller is coupled to the timer and utilized for measuring a current for the battery unit and calculating the electrical charge/discharge quantity for the battery unit when the interrupt signal is generated.
According to another embodiment of the present invention, a method for calibrating an integral time interval actually used by coulometry integration is disclosed. The method comprises: utilizing an oscillator for generating a clock signal; providing a storage unit for storing a calibration parameter that is used for adjusting or calibrating the integral time interval; and replacing a fixed integral time interval by using a time interval represented by the calibration parameter, to calibrate the integral time interval actually used.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, electronic equipment manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following description and in the claims, the terms “include” and “comprise” are used in an open-ended fashion, and thus should be interpreted to mean “include, but not limited to . . . ”. Also, the term “couple” is intended to mean either an indirect or direct electric connection. Accordingly, if one device is coupled to another device, that connection may be through a direct electric connection, or through an indirect electric connection via other devices and connections.
Please refer to
As shown in
In detail, the timer 120 receives the clock signal SCLK and the calibration parameter, and is arranged to determine when to trigger/generate an interrupt event to the interrupt generator 125 in accordance with the clock signal SCLK and the calibration parameter. In this embodiment, the timer 120 is arranged to count a number of clock cycles of the clock signal SCLK upwards from zero once the timer 120 receives the clock signal SCLK. The timer 120 does not stop counting until the number of clock cycles counted by the timer 120 matches the calibration parameter. When the counted number matches the calibration parameter, this indicates that the predetermined integral time interval ends, and the timer 120 is arranged to trigger an interrupt event to the following-stage circuit so as to complete the coulometry integration calculation. The calibration parameter indicates an actual cycle number corresponding to the predetermined integral time interval wherein the actual cycle number can be configured to be dependent upon the frequency of the clock signal SCLK. This is because using a fixed cycle number to indicate the predetermined integral time interval will introduce some calculation errors, because the total number of clock cycles of the clock signal SCLK during the predetermined integral time interval may change when frequency variations/shifts are introduced to the clock signal SCLK. Thus, the flexible calibration parameter is used by the apparatus 100 to adjust or modify the fixed cycle number, in order to obtain a precise result regardless of a frequency shift of the clock signal SCLK. Equivalently, the fixed cycle number is replaced with the flexible calibration parameter that indicates a precise clock cycle number.
When receiving the interrupt event triggered by the timer 120, the interrupt generator 125 is arranged to generate an interrupt signal SINT to the controller 130. When receiving the interrupt signal SINT from the interrupt generator 125, the controller 130 is arranged to complete the detection or measurement of the current for the battery unit 105. As a result, by using the calibration parameter for adjusting the fixed cycle number, the adjusted cycle number precisely corresponds to the predetermined integral time interval, and the operation of accumulating the current detected/measured (i.e. the coulometry integration calculation) each time can be performed correctly. A calculation result of the electrical charge quantity will become more precise.
Please refer to
The calibration parameter can be configured in the storage unit before the apparatus 100 leaves the factory or can be downloaded to the storage unit from any external circuit when the apparatus 100 is being used. Please refer to
It should be noted that the assertion of a signal denotes its active state and the de-assertion of the signal denotes its inactive state. In the above-mentioned embodiment, the assertion of the reference pulse signal SREF occurring indicates its rising edge occurring, and the de-assertion of the reference pulse signal SREF occurring indicates its falling edge occurring. However, this is not indented to be a limitation of the present invention. In another embodiment, a different reference pulse signal (not shown), which includes a reverse waveform of the reference pulse signal SREF, can be used to replace the reference pulse signal SREF. That is, in the embodiment, when the falling edge of the different reference pulse signal occurs, the counter 335 starts to count the clock cycles of the clock signal SCLK. Once the rising edge of the different reference pulse signal occurs, the counter 335 counts the number of clock cycles of the clock signal SCLK, records the counted number to the storage unit 315 for setting the calibration number as the recorded number, and completes the number counting.
Furthermore, in other embodiments, the apparatus 100 as shown in
Please refer to
Step 405: Start;
Step 410: The oscillator 310 generates the clock signal SCLK, and the clock signal SCLK is transmitted to the counter 335 and timer 320;
Step 415: The apparatus 300 receives the reference pulse signal SREF from the external port P1, and the reference pulse signal SREF is transmitted to the counter 335;
Step 420: The counter 335 starts to count the number of clock cycles of the clock signal SCLK when the assertion of the reference pulse signal SREF occurs, and does not complete the number counting until the de-assertion of the reference pulse signal SREF occurs;
Step 425: When completing the number counting, the counter 335 records the cycle number currently/finally counted and outputs the cycle number to the storage unit 315;
Step 430: The recorded cycle number is used to set the calibration parameter and stored in the storage unit 315;
Step 435: The timer 320 determines when to generate an interrupt event to the interrupt generator 325 according to the calibration parameter stored in the storage unit and the cycle number of the clock signal SCLK that is being counted by the timer 320;
Step 440: The interrupt generator 325 generates an interrupt signal to the controller 330 once the interrupt event is received;
Step 445: The controller 330 performs detection or measurement of the current for the battery unit 105 based on the interrupt signal generated from the interrupt generator 325, and calculates the electrical charge quantity according to the detection/measurement of the current;
Step 450: End.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.