Patent Publication Number: US-5158062-A

Title: Adaptive air/fuel ratio control method

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to an adaptive learning air/fuel ratio control applied to a fuel injection system for an internal combustion engine. 
     2. Prior Art 
     Precise air/fuel ratio control is required for maximizing the reduction of hydrocarbon (HC), carbon monoxide (CO) and oxides of nitrogen (NOx) emissions. In order to achieve good air/fuel ratio control, closed-loop fuel control systems employing an exhaust gas oxygen (EGO) sensor to correct any air/fuel ratio errors have been used. Furthermore, adaptive air/fuel control methods have been used to achieve better air/fuel ratio control by reducing the time it takes for the feedback loop to find the set point, i.e., stoichiometry, subsequent to a change in the engine operating point or upon entering closed loop engine control. 
     In a fuel injection system with an adaptive air/fuel ratio control capability, the actual fuel injection time duration can be obtained by multiplying the basic fuel injection time duration based on the current operating condition by the learning control correction factor. 
     It is known, for example from U.S. Pat. No. 4,594,985, in an adaptive learning control to obtain the learning control correction factor by initially setting its value at a predetermined initial value. Its value is adjusted according to the mean value of each two successive end values of the air/fuel ratio feedback complementing factor in the constantly increasing and constantly decreasing mode. If the mean value is larger than a predetermined high limit value, the current value of the learning control correction factor is incremented by a predetermined amount. If the mean value is smaller than a predetermined low limit value, the current value of the learning control correction factor is decremented by a predetermined amount. If the mean value is between the high limit and the low limit, the current value of the learning control correction factor is unchanged. 
     Whether such a system is rich or lean is determined by the mean value of the two successive peak and valley values of the air/fuel ratio feedback complementing factor. If the mean value is greater than an upper limit, the system is considered to be running lean, the learning control correction factor is thus incremented in order to adjust the system towards stoichiometry. If the mean value is less than a lower limit, the system is considered to be running rich, the learning control correction factor is then decremented in order to adjust the system towards the stoichiometry. Also, the increment or decrement amount of the learning control correction factor is a predetermined constant. 
     Such a system has drawbacks, first, by using only the mean value of two successive end values it is not always possible to correctly determine if the system is running lean or rich. In addition, the mean value of the two successive end values of the air/fuel ratio does not tell how far off the system is operating away from the stoichiometry point. Moreover, by using a fixed increment amount or decrement amount to adjust the learning control correction factor, the adjusting amount may be too small in some situations and too large in other situations. 
     It is also known to have a system with open loop fuel control wherein the air/fuel ratio is determined by a predetermined table based on the engine operating conditions such as load, engine speed, engine coolant temperature, etc. During system closed-loop fuel operation, the air/fuel ratio is constantly decremented when the EGO sensor indicates lean until a transition from lean to rich is sensed and the air/fuel ratio is constantly incremented when the EGO sensor indicates rich until a transition from rich to lean is sensed. At the time when the EGO sensor senses a transition from rich to lean status, because of the transport delay of the system, the air/fuel ratio is in fact too large. In order to make the air/fuel ratio converge faster towards stoichiometry, the air/fuel ratio is decremented by an amount when the EGO sensor indicates a rich to lean transition. Likewise, the air/fuel ratio is incremented by an amount when the EGO sensor indicates a lean to rich transition. 
     Accordingly, in the normal closed-loop fuel operation, the interleaved lean cycle and rich cycle continue and the desired normalized air/fuel ratio should stay in the neighborhood of stoichiometry (i.e., 1.0) regardless whether it is in lean cycle or in rich cycle. Thus, the mean value of the air/fuel ratio in one complete lean and rich cycle gives a proper measure of the system&#39;s rich or lean status. If the mean value is greater than an upper limit, the system is rich. If it is less than a lower limit, the system is lean. Since the mean value is calculated over the period of a complete lean and rich cycle, this method is more accurate than the method taking the mean value of each two successive end values of the air/fuel ratio. However, this method requires more calculation than the previous method. It requires an accumulator for summing the air/fuel ratio and a counter for summing the number of air/fuel ratio reading over one complete rich and lean cycle. At the end of one complete rich and lean cycle, a divide operation is required to obtain the mean value of the air/fuel ratio. 
     It would be desirable to improve the adaptive learning control system for air/fuel ratio and remove the drawbacks as described above. In particular it would be desirable to have a system which is easier to implement. 
     SUMMARY OF THE INVENTION 
     In this invention, an air/fuel ratio system&#39;s rich or lean status is measured by the time period difference between the time period that the air/fuel ratio is greater than an upper limit and the time period that the air/fuel ratio is less than a lower limit in one complete (or more generally, equal number of successive) rich and lean cycle. If the time period that the air/fuel ratio is greater than an upper limit is greater than the time period that the air/fuel ratio is less than a lower limit in equal number of successive rich and lean cycles, the system is rich. Conversely, if the time period that the air/fuel ratio is less than a lower limit is greater than the time period that the air/fuel ratio is greater than an upper limit in equal number of successive rich and lean cycles, the system is lean. The time period difference also indicates the degree that the system is too rich or too lean. The bigger the time period difference is, the farther off the system is away from the stoichiometry. In accordance with the present invention, the adjustment amount for the learning control correction factor is determined by making it proportional to the time period difference. 
     The present invention provides a method which can more accurately determine whether the system is running rich or lean. It can also determine how far off the system is away form the stoichiometry point. It can therefore determine the proper adjusting amount. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of an internal combustion engine with an electronic control unit for adaptive air/fuel ratio control; 
     FIG. 2 is an example of a function FN025 (VMAF) for addressing adaptive keep-alive memory (KAM) cells; 
     FIG. 3 is a graphical illustration of normalized air/fuel ratio in accordance with an embodiment of this invention; 
     FIG. 4 is a flow chart of a part of a main routine for an adaptive air/fuel ratio control in accordance with an embodiment of this invention; 
     FIG. 5 is a flow chart of an adaptive learning entry routine in accordance with an embodiment of the invention. 
     FIG. 6 is a flow chart of a rich/lean difference timer update routine in accordance with an embodiment of this invention. 
     FIG. 7 is a flow chart of an adaptive KAM cell update routine in accordance with an embodiment of this invention. 
     FIG. 8 is a flow chart of a rich lean difference timer flag setting routine in accordance with another embodiment of this invention; and 
     FIG. 9 is a flow chart of a 1-ms foreground routine similar to FIG. 6 for updating the rich/lean difference timer in accordance with the second embodiment. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 1 is a simplified block diagram of an internal combustion engine with the electronic control unit for the adaptive air/fuel ratio control of the mixture supplied to the engine in accordance with the principles of the present invention. In FIG. 1, air enters an air passage 2 through an air cleaner 1 and passes to the combustion chamber 8 of the engine through an airflow meter 3 and a throttle valve 4 via an inlet manifold 5. The exhaust from the combustion chamber 8 is carried through an exhaust passage 6 and a catalyst 7. An electronic control unit 9 monitors the input signals from a variety of engine sensors 10, 11, 12, 13, 14, 15, to determine the engine operating conditions and generates appropriate ignition pulses to spark plugs 16 at the appropriate time to ignite the air/fuel mixture which enters the combustion chamber. In addition, control unit 9 calculates the appropriate fuel injection pulse time duration and applies it to fuel injectors 17 at the appropriate time in order to obtain the desired air/fuel ratio. 
     Air charge temperature sensor 10 is used to measure the temperature of the intake air which flows through the intake air passage. Airflow sensor 11 is used to measure the airflow rate which represents the engine load. The airflow rate is also used to determine the air mass entering the inlet manifold. Throttle valve position sensor 12 indicates the throttle position which is used as a condition for the open-loop fuel or closed-loop fuel control. Engine coolant temperature sensor 13 measures the temperature of the engine. Engine revolution sensor 14 measures the engine speed. Exhaust gas oxygen sensor 15 monitors the oxygen level in the exhaust gas when in closed-loop fuel control to indicate whether the engine is running on the lean side or the rich side so that the air/fuel ratio can be adjusted accordingly by electronic control unit 9. 
     Electronic control unit 9 contains a microprocessor unit MPU 20, a memory unit 21, an input interface circuitry 22 which contains buffers, A/D converters, etc., an output interface circuitry 23 which contains buffers, drivers etc., a timer 24, an interrupt controller 25, and an internal bus 26 connecting all these components. Memory units 21 have a read-only memory (ROM) 27 for storing the engine control program including an adaptive air/fuel ratio control routine and related constants, a read-write memory (RAM) 28 for use as counters or timers or as temporary registers for storing data, a keep-alive memory (KAM) 29 for storing learned value for the learning control correction factor. The KAM 29 is always powered even if the ignition key (not shown) is turned off. Timer 24 can be set to a fixed time which is then continuously counted down. When it counts down and passes zero, an interrupt signal will be generated which is sent to interrupt controller 25 to generate an interrupt signal to the MPU and activates a special service routine. 
     The normalized air/fuel ratio with respect to stoichiometry is given by 
     
         LAMBDA=AM / (14.64* FM) 
    
     where, 
     AM=air mass in 1 bm/min. 
     FM=fuel mass flow in 1 bm/min. 
     LAMBDA=normalized air/fuel ratio. 
     By measuring the air mass AM and determining the desired normalized air/fuel ratio LAMBDA based on the operating condition, the fuel mass FM can thus be obtained by 
     
         FM=AM / (14.64* LAMBDA) 
    
     and the fuel pulse time duration t can be obtained by 
     
         t=FM * c 
    
     where, c is the conversion factor 
     The corrected fuel pulse time duration T c  is obtained by multiplying t by the adaptive learning control correction factor L c  at the present engine operating point: 
     
         T.sub.c =t * L.sub.c 
    
     The main function of the adaptive air/fuel ratio control logic is to properly update the learning control correction factor at the appropriate time. The values for the learning control correction factor at different operating points are stored in an array form in keep-alive memory (KAM) 29 which is continuously powered by the vehicle battery even when the vehicle is shut off. Each memory cell in KAM 29 is addressed by the engine operating condition defined by parameters such as the engine load and engine speed. For illustration purposes, in the following discussion, the engine operating condition used to address the memory cell to update is defined only by the engine load which is determined by the intake airflow. 
     Accordingly, in the embodiments described below when it is time to update the learning control correction factor, the memory cell in KAM 29 to be updated is determined by a linear function FN025 (VMAF), where VMAF is the mass airflow in voltage obtained by converting the A/D count from the airflow measuring circuitry. The input to this function is VMAF and the output is the cell number in KAM 29. An example of this function with an array size 32 is shown in FIG. 2. Higher accuracy can be obtained by enlarging the array size, to say 64. The procedure to determine the cell number in KAM 29 for a certain VMAF value is: a) use FN025 to determine a cell number with integer and fraction portions by the linear interpolation process, and b) round the result obtained in step a) and use the resultant integer as the cell number. When it is time to obtain the learning control correction factor L c  for calculating the actual injection pulse time duration T c , FN025 and current VMAF value are used to determine a cell number with integer and fraction portions by the linear interpolation process. The value for the learning control correction factor L c  is then obtained by the linear interpolation process using the contents of the KAM cells addressed by the integer and fraction obtained previously. 
     In open loop fuel operation, the desired air/fuel ratio is determined by a predetermined table based on the engine operating conditions such as load, engine speed, engine coolant temperature, etc. In closed-loop fuel operation, the desired normalized air/fuel ratio is constantly decremented when the EGO sensor indicates lean until a transition from lean to rich is sensed, and the air/fuel ratio is constantly incremented when the EGO sensor indicates rich until a transition from rich to lean is sensed. At the time when the EGO sensor senses a transition from rich to lean status, because of the transport delay of the system, the air/fuel ratio is in fact too large. 
     In order to make the air/fuel ratio converge faster towards stoichiometry, the air/fuel ratio is decremented by an amount when the EGO sensor indicates a rich to lean transition. Likewise, the air/fuel ratio is incremented by an amount when the EGO sensor indicates a lean to rich transition. Accordingly, in the normal closed-loop fuel operation, the interleaved lean cycle and rich cycle continue and the desired normalized air/fuel ratio should stay in the neighborhood of stoichiometry (i.e., 1.0) regardless whether it is in lean cycle or in rich cycle. The system&#39;s rich or lean status is measured by the time period difference between the time period that the air/fuel ratio is greater than an upper limit and the time period that the air/fuel ratio is less than the lower limit in equal number of successive rich and lean cycles. If the time period that the air/fuel ratio is greater than an upper limit is greater than the time period that the air/fuel ratio is less than a lower limit in equal number of successive rich and lean cycles, the system is rich. Conversely, if the time period that the air/fuel ratio is less than a lower limit is greater than the time period that the air/fuel ratio is greater than an upper limit in equal number of successive rich and lean cycles, the system is lean. The time period difference also indicates the degree that the system is too rich or too lean. The bigger the time period difference is, the farther off the system is away from the stoichiometry. Consequently, the adjusting amount for the learning control factor is determined by making it proportional to the time period difference. 
     FIG. 3 graphically illustrates the principle of the present invention. In the closed loop fuel control, the normalized desired air/fuel ratio (A/F) n  is constantly incremented when the EGO sensor indicates rich until the EGO sensor senses a rich to lean transition. At that time, (A/F) n  is instantaneously decremented by an amount D L  which can be a constant or can be a function of the current (A/F) n  and the previous modified (A/F) n  when a lean to rich transition occurred. Thereafter, (A/F) n  is constantly decremented until the EGO sensor senses a lean to rich transition. At that instant, (A/F) n  is instantaneously incremented by an amount D R  which again can be a constant or can be a function of the current (A/F) n  and the previous modified (A/F) n  when a rich to lean transition occurred. In this manner, the rich cycles interleave the lean cycles as shown in FIG. 3. 
     Referring to FIG. 3, at time t 1 , the EGO sensor indicates a rich to lean transition. The time period t 11  is the duration that (A/F) n  is smaller than a lower limit during the first lean cycle after t 1 . While, the time period t r1  is the duration that (A/F) n  is greater than an upper limit during the first rich cycle after t 1 . If t r1  is greater than t 11  then the system is running rich during the first lean and rich cycle as it spends more time in the rich cycle than in the lean cycle. Conversely, if t r1  is less than t 11  then the system is running lean during the first lean and rich cycle as it spends more time in the lean cycle than in the rich cycle. The absolute difference value between these two time period, that is, |t r1  -t 11  |, also indicates how far off the system is away from the stoichiometry during the first complete rich and lean cycles. The adjusting amount to the learning control correction factor can thus be made proportional to t r1  -t 11 , for instance, k*|(t r1  -t 11 )|, where k is a scaling factor. This concept can be extended to the more general case in which the time period for (A/F) n  being smaller than a lower limit are accounted for during equal number of successive interleaved rich and lean cycles. As an example, in FIG. 3, if (t r1  +t r2 )&gt;(t 11  +t 12 ) then the system is running rich during the two successive interleaved lean and rich cycles after t 1 . 
     Two implementations of the present invention are now discussed. The first is to use two different timers: a rich timer and a lean timer. The rich timer is used to record the time period when (A/F) n  is greater than an upper limit; while, the lean timer is used to record the time period when (A/F) n  is less than a lower limit. The difference between these two timers at the end of an equal number of successive rich and lean cycles determines whether the system is running rich or lean during that period. If the contents of the rich timer are greater than those of the lean timer, the system is running rich; and vice versa. The second implementation is to use on single timer: a rich/lean difference timer. This difference timer is incremented when (A/F) n  is greater than the upper limit and decremented when (A/F) n  is less than a lower limit. At the end of equal number of successive rich and lean cycles, the contents of the difference timer determine whether the system is running rich or lean during that period. If the contents of the difference timer are positive, the system is running rich; while, if the contents of the difference timer are negative, the system is running lean. The second implementation requires less memory as well as less processing time than the first implementation. Two preferred embodiments to be discussed use only one difference timer. 
     FIG. 4 shows a flow chart of a part of a main routine for controlling the engine operation. In this main routine, the process is returned to the first step after the process has completed the last step. In other words, the process is carried out repeatedly for as long as the engine is running. This part of the main routine as shown in FIG. 4 contains three steps: step 51, step 52, and step 53, which form the substance of the adaptive air/fuel ratio control strategy. In step 51, the adaptive learning entry routine is performed. If the adaptive learning condition is satisfied the process proceeds to step 52; otherwise, the process is discontinued and step 52 and step 53 are omitted. In step 52, the rich/lean difference timer update routine is executed. Step 53 begins after step 52 is carried out. In step 53, the adaptive learning KAM cell update routine is carried out. Each of these steps will be elaborated further in the following paragraphs. 
     FIG. 5 illustrates the adaptive learning entry routine 51. In step 101, it is determined whether or not the adaptive learning condition is satisfied. In this embodiment, the learning condition is satisfied when the closed-loop fuel control is being carried out, the acceleration enrichment fuel strategy is not activated, the air charge temperature (ACT) is in the range between AFACT1 and AFACT2 (i.e., AFACT1&lt;ACT&lt;AFACT2), the engine coolant temperature (ECT) is in the range between AFECT1 and AFECT2 (i.e., AFECT1&lt;ECT&lt;AFECT2), and when the adaptive timer ADPTMR has exceeded a predetermined time, for example, ADAPTM seconds. The adaptive timer ADPTMR is cleared during engine crank or when the ECT is greater than an upper limit AFECT2 or the ECT is less than a lower limit AFECT1. In other cases, ADPTMR is continuously incremented by 1 for every second until the maximum value is achieved. The parameters AFACT1, AFACT2, AFECT1, AFECT2, and ADAPTM are calibration constants. 
     When the learning entry condition is satisfied, the process proceeds to step 111. If the learning entry condition is not satisfied, the process proceeds to step 102, where a rich/lean difference timer DIFTMR and an EGO switch counter EGOCNT are reset to 0. Then step 52 and 53 are omitted and the whole learning Process is discontinued. 
     In step 111, the memory cell `N` to be updated in the special KAM is determined based on VMAF value and function FN025 using the linear interpolation process as described previously. In step 112, the difference between the current memory cell number N and the previously recorded memory cell number NLAST is checked. This check is to ensure that the learning process is carried out when the vehicle is operating under rather constant operating condition. If |N-NLAST|&gt;NDELTA, where NDELTA is calibration constant, the operating points are too far off to be practical for the learning process to continue. In this case, the process proceeds to step 113, where DIFTMR and EGOCNT are reset to 0 and NLAST is set equal to N, routine 51 is then exited and the rest of the learning steps are omitted. If |N-NLAST|≦NDELTA, the process proceeds to step 121, where the status of the exhaust gas oxygen sensor output is checked. If the EGO sensor indicates a transition from lean to rich or vice versa since the previous EGO status check, the process goes to step 122, where the EGO switch counter EGOCNT is incremented by 1. Then routine 51 is ended. If the output status of the EGO sensor has not changed since the previous check, step 122 is omitted and routine 51 is terminated. 
     FIG. 6 illustrates the rich/lean difference timer update routine 52. In step 201, it is determined whether or not it is the appropriate time to update the rich/lean difference timer DIFTMR. The condition which allows to update DIFTMR is that EGOCTL≦EGOCNT&lt;EGOCTL+2*EGOCYC. In the normal closed-loop fuel operation, a rich cycle is followed by a lean cycle and vice versa. Accordingly, the above condition means that right after EGO sensor has sensed EGOCTL number of rich-to-lean or lean-to-rich transitions, DIFTMR begins to be updated. Thereafter, DIFTMR continues to be updated during an equal predetermined number EGOCYC of successive rich and lean cycle period. EGOCTL and EGOCYC are calibration constants. Note that EGOCTL has to be at least 1 to ensure DIFTMR is not updated until after the EGO status has just switched so that DIFTMR is updated for a complete rich or lean cycle. EGOCTL partially controls the adaptive learning cell update rate. Maximum update rate is achieved when EGOCTL=1. EGOCYC also control the learning rate in Part. However, its major function is to control the responsiveness of the adaptive system to the air/fuel ratio change. Obviously, maximum responsiveness is achieved when EGOCYC=1. However, higher value for EGOCYC can reduce the effect of the abrupt change of the EGO status due to noise. Higher EGOCYC can also minimize the errors due to the timer counting inaccuracy as it tends to average the process. 
     In step 201, if it is determined it is not time to update DIFTMR, i.e., either EGOCNT&lt;EGOCTL or EGOCNT≦EGOCTL+2*EGOCYC, the rest of the steps are omitted and routine 52 is ended. Otherwise, the process proceeds to to step 202. In step 202, it is determined whether or not the normalized air/fuel ratio LAMBDA is greater than an upper limit (1.0+DELAMB), where DELAMB is a calibration constant. If it is, the process proceeds to step 203 to increment the rich/lean difference timer DIFTMR by 1. Then routine 52 is ended. If in step 202, it is determined that the normalized air/fuel ratio LAMBDA is less than or equal to the upper limit, step 211 is carried out. In step 211, it is determined whether or not LAMBDA is less than a lower limit (1.0-DELAMB). If it is, the process proceeds to step 212, where the rich/lean difference timer DIFTMR is decremented by 1. Then routine 52 is ended. If in step 211, it is determined that LAMBDA is greater than or equal to the lower limit, timer DIFTMR remains unchanged and routine 52 is terminated. Note that when DIFTMR is incremented, it is clipped to a maximum, DIFMAX, to avoid the overflow problem. Similarly, when DIFTMR is decremented, it is clipped to a minimum, DIFMIN, to avoid the underflow problem. 
     At the end of the rich/lean difference timer update period, i.e., when EGOCNT=EGOCTL+2*EGOCYC, the amount stored in timer DIFTMR not only tells whether the system was biased towards the rich or the lean side but also indicates the degree that it was operating away from the stoichiometry during the DIFTMR update period. Thus, the next step is to check the rich or lean status of the system and adjust it towards stoichiometry. In other words, if the system is operating rich, it is desired to reduce the fuel flow by reducing the learning control correction factor L c . This can be achieved by decreasing the value in the KAM cell corresponding to the operating point. Conversely, if the system is operating lean, it is desired to increase the fuel flow by increasing the value in the KAM cell corresponding to the operating point. Since the value in timer DIFTMR indicates the degree that the system is away from stoichiometry, it is most suitable to use an adaptive amount k* |DIFTMR | as the incremental amount or decremental amount for the value stored in the KAM cell corresponding to the operating point, where k is a calibration constant. 
     FIG. 7 illustrates such an adaptive KAM cell update routine 53. The purpose of this routine is to change the value stored in the KAM cell corresponding to the operating point so that the system is adjusted towards stoichiometry. In step 301, it is determined whether or not it is time to update the KAM cell. When EGOCNT&gt;or=EGOCTL+2*EGOCYC, the update process for DIFTMR has stopped, and thus it is time to update the KAM cell and the process proceeds to step 302. In step 302, it is determined whether or not the system was biased towards the rich side. If it is and DIFTMR is greater than an upper threshold DIFADP and the KAM cell corresponding to the operating point, i.e., KAM(N), contains a value greater than the lower limit MIDADP, then the process proceeds to step 303, where the adaptive amount k* |DIFTMR| is subtracted from KAM(N). The resultant KAM(N) is then clipped to the minimum, MINADP. Then the process proceeds to step 306, where the rich/lean difference timer DIFTMR and the EGO switch counter EGOCNT are reset to 0 and NLAST is set equal to N. Routine 53 is then ended. If any of the conditions checked in step 302 is not true, the process proceeds to step 304, where whether the system was biased towards the lean side is checked. If it is and DIFTMR is less than a lower threshold -DIFADP and KAM(N) is less than an upper limit MAXADP, the process proceeds to step 305, where, the adaptive amount is added to KAM(N). The resultant KAM(N) is then clipped to the maximum, MAXADP. The above-mentioned parameters DIFADP, MINADP, and MAXADP are calibration constants. If DIFTMR is in between the lower threshold and the upper threshold, that is, -DIFADP≦DIFTMR≦DIFADP, then it is not necessary to update the KAM cell, and the process proceeds from step 304 to step 306 to clear DIFTMR and EGOCNT and set NLAST equal to N. 
     In this embodiment described as above, after the condition for updating the rich/lean difference timer is satisfied, DIFTMR is incremented or decremented by 1 per background loop based on LAMBDA value. Therefore, the contents of DIFTMR are not the actual time but a multiple of the background loop time. This background loop time may vary in accord with the system&#39;s operating condition. Consequently, the time period difference obtained is not always accurate. A more accurate method of measuring the time period is to update DIFTMR at fixed timer after the condition for updating the rich/lean difference timer is met. 
     This results in another embodiment of the present invention. In this second embodiment, a foreground interrupt service routine 60 as shown in FIG. 9 which is activated every 1 ms is included and the rich/lean difference timer update routine 52 as shown in FIG. 6 has to be replaced by a new routine 62 as shown in FIG. 8. In addition, routine 51 has to be slightly modified, which will be explained later. But, routine 53 remains the same. Therefore, in this second embodiment, the flow of the main routine is similar to that of the first embodiment as shown in FIG. 4. That is, a slightly modified adaptive learning entry routine is executed first, followed by routine 62, then followed by routine 53. The new 1 ms foreground routine 60 is carried out once every 1 ms and is independent of the execution of the main routine. 
     Referring to FIG. 8, in step 401 whether it is time to update DIFTMR is examined. This step is the same as step 201 in FIG. 6. If it is time to update DIFTMR, a flag TMRFLG is set to 1 in step 402; otherwise, the flag TMRFLG is cleared to 0 in step 403. Then routine 62 is terminated. In the foreground routine 60 as shown in FIG. 9 and which is activated every 1 ms, the flag TMRFLG is first checked in step 501. If TMRFLG is 0, it is not time to update DIFTMR, routine 60 is exited. If TMRFLG is 1, it is time to update DIFTMR, the process proceeds to step 502. In step 502, the normalized air/fuel ratio LAMBDA is checked. If LAMBDA is greater than an upper limit (1.0+DELAMB), the process proceeds to step 503 to increment DIFTMR by 1; otherwise, the process proceeds to step 511 to check if LAMBDA is less than a lower limit (1.0-DELAMB). If LAMBDA is less than the lower limit, DIFTMR is decremented by 1 in step 512; otherwise, foreground routine 60 is terminated. Because routine 60 is executed once every 1 ms, DIFTMR will be incremented or decremented if TMRFLG is set and LAMBDA is greater than an upper limit or less than a lower limit. In order to ensure that DIFTMR is not erroneously updated when the adaptive learning condition is not satisfied or when, |N-NLAST&gt;NDELTA, step 102 and step 113 in the adaptive learning entry routine 51 have to be modified to include an operation to clear flag TMRFLG in addition to resetting EGOCNT and DIFTMR. 
     Various modifications and variations will no doubt occur to those skilled in the arts to which this invention pertains. For example, the method of determining the KAM cell number may be varied from those described herein. These and all other variations which basically rely on the teachings through which this disclosure has advanced the art are properly considered within the scope of this invention.