# Patent

## Title
Distance detection method and apparatus

## Abstract

A focus detecting device in which the in-focus range, within which the result of focus detection is regarded as being in the in-focus state, is made greater than usual when the photo-taking lens is in the infinity movable limit position. The in-focus range is set to a greater value when the lens is in the infinity movable limit position and is detected as being in focus as a result of the earlier focus detection. Thus, it is made easy to effect the in-focus state when the lens is in the limit position.

## Background
1. Field of the Invention

This invention relates to an in-focus state detecting device for use in an auto-focus apparatus or the like.

2. Related Background Art

Heretofore, in an auto focus apparatus, a predetermined in-focus range has been provided and even if the lens is not at the true in-focus position, if the lens is positioned within the in-focus range, it has been detected as being in-focus, thereby stabilizing the detection of the in-focus condition.

As regards the setting of the in-focus range, the greater the range is made, the milder becomes the detection of the in-focus condition and the stabilization of the in-focus state can be achieved while, on the other hand, the accuracy of the in-focus state becomes worse. Accordingly, heretofore, a moderate value has been set from the equilibrium of the stabilization and accuracy of the in-focus state.

Also, the depth of field varies depending on the stop aperture and focal length of the lens and therefore, it has also been proposed to vary the range which can be regarded as in-focus, i.e., the in-focus range, in conformity with the aperture value and the focal length.

Thus, heretofore, the in-focus range has been varied by the stop aperture and the focal length or has been determined with the stabilization of the in-focus state and the accuracy of the in-focus state taken into consideration, but any position the lens is moved to has not been considered at all as a factor which determines said in-focus range and therefore, when the lens is positioned, for example, at the mechanical limit position in the infinity direction, the following inconvenience has occurred.

Even if in a state in which the lens is shifted to the limit position in the infinity direction, it is determined as a result of the focus detection that the lens is not positioned within the in-focus range and the lens is driven in the infinity direction to provide the infocus state of the lens, any further driving of the lens is impossible because the lens is already at said limit position and thus, the focus state can never be improved.

Accordingly, in the case as described above, the indication of the in-focus condition is not effected for any length of time and the photographer may miss a photo opportunity.

As a solution to the above noted problem, it is conceivable that the in-focus range for the result of the focus detection in the state in which the lens has been shifted to the limit position in the infinity direction be set to a greater value than that in the usual case.

One aspect of the present invention is that the in-focus range for the result of the focus detection in the state in which the lens has been shifted to the limit position in the infinity direction is made greater than in the usual case and that the in-focus range is set to a value conforming to the result of the preceding focus detection to thereby provide an easy indication of the in-focus state in the case as described above.

A further aspect of the application is to provide a focus detecting device designed in accordance with the above object such that the in-focus state range is enlarged in a case where the result of the preceding focus detection is indicative of the in-focus state and that it is easy for the indication of the in-focus state to be effected in the state in which the lens is at the limit position in the infinity direction.

Other objects of the present invention will become apparent from the following detailed description of an embodiment thereof taken in conjunction with the accompanying drawings.

FIG. 1 is a circuit diagram showing an embodiment of a camera having an auto-focus apparatus according to the present invention.

FIGS. 2A to 2D illustrate the program contained in the microcomputer PRS of FIG. 1.

FIG. 1 is a circuit diagram showing an embodiment of a camera provided with a signal auto focus apparatus according to the present invention. In FIG. 1, PRS designates a control device of the camera which is, for example, a 1-chip microcomputer having ROM, RAM and A/D converting functions therein and which performs the operations of the camera such as the automatic exposure control function, the automatic focus detecting function, the film advance and the film rewinding functions in accordance with a program to be described stored in the ROM.

The microcomputer PRS communicates with the surrounding circuits and the lens unit by the use of communication signals SO, SI and SCLK, and controls the operations of the respective circuits and the lens unit.

SO is a data signal output from the microcomputer PRS, SI is a data signal input to the microcomputer PRS, and SCLK is a signal synchronous with the signals SO and SI.

LCM denotes a lens communication buffer circuit which provides a power source VL to the lens unit when the camera is being operated, and provides a buffer for the communication between the camera and the lens unit when the signal CLCM from the microcomputer PRS is at a high potential level (hereinafter abbreviated as "H", and a low potential level will hereinafter be abbreviated as "L").

When the microcomputer PRS renders the signal CLCM into "H" and delivers predetermined data as the signal SO in synchronism with the signal SCLK, the circuit LCM is designated and outputs the buffer signals LCK and DCL of the signals SCLK and SO to the lens unit through the contact between the camera and the lens. Simultaneously therewith, the circuit LCM outputs the buffer signal of the signal DLC from the lens unit (the unit encircled by a dot-and-dash line) as the signal SI, and the microcomputer PRS inputs the data of the lens unit as the signal SI in synchronism with the signal SCLK.

SDR designates a driving circuit for a line sensor device SNS for focus detection, and the driving circuit SDR is selected when the signal CSDR from the microcomputer PRS is "H", and is controlled by the microcomputer PRS in accordance with the signals SO, SI and SCLK.

SNS denotes a sensor device including, for example, a pair of CCD line sensors CCD.sub.1 and CCD.sub.2. .phi.1 and .phi.2 designate clock signals for driving the CCDS and are produced by the driving circuit SDR in response to the clock from the microcomputer PRS. SH denotes a signal for causing charges accumulated in the line sensors CCD.sub.1, and CCD.sub.2 to be transferred to a transfer portion, and CLR designates a clear signal for clearing the accumulated charges in the line sensors CCD.sub.1 and CCD.sub.2, and these signals are formed in the driving circuit SDR controlled by the microcomputer PRS.

The output signal O S of the sensor device SNS is an image signal accumulated in each picture element of the sensors CCD.sub.1 and CCD.sub.2 which is time serially output in synchronism with the clock signals .phi.1 and .phi.2, and is output for each bit of the sensors CCD.sub.1 and CCD.sub.2 and amplified by an amplifying circuit in the circuit SDR, and thereafter is input as a signal AOS to the microcomputer PRS. The microcomputer PRS inputs the signal AOS from an analog input terminal and A/D converts it by the internal A/D converting function in synchronism with a signal CK, and thereafter stores it in a predetermined address of the RAM.

A signal AGC which also is an output signal of the sensor device SNS is the output of an accumulation control sensor in the device SNS, and is used to control the accumulation time of the sensors CCD.sub.1 and CCD.sub.2.

SPC designates a photometering sensor which receives light through the photo-taking lens. The output SSPC of the photometering sensor SPC is input to an analog input terminal of the microcomputer PRS and A/D converted, whereafter it is used for automatic exposure control (AE).

DDR denotes a switch sensing and displaying circuit which is selected when the signal CDDR from the microcomputer PRS is "H", and control of the communication thereof with the microcomputer PRS is effected by the signals SO, SI and SCLK. That is, DDR changes over the display of the camera on the basis of data supplied from the microcomputer PRS, and communicates to the microcomputer PRS the switch condition of a group of switches SWS opened and closed in response to various operating modes, including switches SW1 and SW2 operatively associated with a release button.

MDR1 and MDR2 designate driving circuits for film feeding and shutter charging motors MTR1 and MTR, respectively. These driving circuits execute forward and reverse revolutions of the motors by signals M1F, M1R, M2F and M2R.

MG1 and MG2 denote magnets for starting the movement of the forward and rearward shutter curtains. These magnets are supplied with electric power by signals SMG1 and SMG2 and amplifying transistors TR1 and TR2, and thus shutter control is effected by the microcomputer PRS.

The switch sensing and displaying circuit DDR, the motor driving circuits MDR1 and MDR2, and shutter control circuits have no direct relation to the present invention and therefore need not be described in detail.

The signal DCL input to the control circuit LPRS in the lens unit in synchronism with the synchronizing signal LCK is the data of a command from the camera to the lens unit, and the operation of the lens from this command is predetermined.

The control circuit LPRS analyzes the input command in accordance with a predetermined procedure, and effects the operations of focus adjustment and aperture control and outputting of the various parameters of the lens from the output DLC (such as the open F number, the focal length and the coefficient of the defocus amount VS the amount of axial movement).

An example of the generally axially movable lens unit is shown in FIG. 1, and when a focus adjustment command is sent from the camera, signals LMF and LMR are delivered to a focus adjusting motor LMTR in accordance with the amount and direction of drive sent at the same time to thereby drive the motor LMTR, whereby the optical system is moved in the direction of the optic axis to effect focus adjustment. The amount of movement of the optical system is monitored by an encoder circuit ENC the signal SENC is sent to LPRS. At a point in time whereat a predetermined movement of the optical system has been completed, the signals LMF and LMR are rendered into "L" and the motor LMTR is braked.

When an aperture control command is sent from the camera, a conventional stepping motor DMTR operatively associated with the aperture mechanism is driven in accordance with the number of aperture steps sent at the same time. The stepping motor can be open controlled and therefore does not require an encoder for monitoring the operation thereof.

The circuit LPRS is provided with a memory storing parameters such as the focal length information f of the lens (in the case of a zoom lens, focal length information corresponding to the zoomed state) in respective predetermined address portions, and a control circuit for detecting the presence or absence of the monitor signal SENC and judging the stopped condition of the lens, or receiving the monitor signal SENC and comparing the amount of drive of the lens represented by said signal SENC with the defocus amount to be described and rendering the signals LMF and LMR when said two amounts are coincident with each other into "L" to thereby stop the motor LMTR.

A display device DSP has a display element such as an LED for displaying the in-focus state and the impossibility of focus detection.

The encoder ENC may be a pulse plate or the like rotated, for example, in response to movement of the lens and generates a pulse as said monitor signal.

The operation of the camera constructed as described above will now be described with reference to FIG. 2.

When a power source switch, not shown, is operated, electric power is supplied to the microcomputer PRS, which thus executes the stored program.

FIG. 2A is a flow chart showing the general flow of said program. When the execution of the stored program is started by the above mentioned operation, the detection of the condition of the switch SW1 adapted to be closed by the first stage operation of the shutter button is first effected at step 1. If the switch is OFF, the internal flags of the microcomputer PRS are all cleared at step 2 and 0 is set in each flag. Said steps 1 and 2 are repetitively executed until the switch SW1 is detected as being ON, and a shift is then made to step 3. The detecting operation SO of the switch SW1 is executed by rendering the signal CDDR from the microcomputer PRS into "H", designating the circuit DDR, transmitting the detection command SO of the switch SW1 to the circuit DDR, causing the circuit DDR to detect the ON or OFF condition of the switch SW1, and transmitting the result of the detection as the signal SI to the microcomputer PRS. Step 3 is the sub-routine of AE control, and a series of operation controls such as photometric calculations, exposure control, and shutter charge, and film advance after exposure are effected in this AE sub routine. The AE sub routine has no direct relation to the present invention and therefore need not be described in detail, but a summary of this AE control sub-routine is as follows.

As long as the switch SW1 is ON, photometering and exposure control are effected each time the AE control sub-routine is executed. Also, when the second stage operation of the shutter button is effected and the switch SW2 becomes ON, the releasing operation is effected by the interruption process and control of the aperture or the shutter time is effected in conformity with the exposure amount found in the above mentioned exposure control operation, and shutter charge and film feeding are effected after the termination of the exposure.

Assuming that the first stage operation of the shutter button has been performed, photometering and calculation process are effected at step 3, whereafter advance is made to step 4.

Step 4 is the AF control sub routine, and the AF control sub routine shown in FIG. 2B is executed.

In this AF control sub routine, the set condition of flag PRMV is first detected at step 100. When the AF control sub routine is executed for the first time, all flags are cleared and 0 is set at step 2 of FIG. 2A and therefore, an advance is made to step 117 and subsequent steps.

Step 117: The mode of auto focus is determined, and in the case of the servo mode, an advance is made to step 101, and in the case of the one shot mode, an advance is made to step 118.

Assuming that the servo mode is set as the mode, the step proceeds to 101.

Step 101: Whether film feed has been effected in the immediately preceding AE control sub routine is determined.

When it is determined that film feed has been effected in the AE control sub routine by step 3 of FIG. 2A being executed immediately before step 101 is executed, that is, the step 101 has been executed for the first time after the termination of photographing, flag TMACT is set to 1 at step 109, and the counting of a lens drive restriction timer is started at step 110, whereafter a-shift is made to step 102. Also, when it is determined that film feed has not been effected in the AE control sub-routine at step 3 of FIG. 2A being executed immediately before step 102 is executed, a shift is made to step 102 without steps 109 and 110 being executed.

Only the first stage operation of the shutter button is being effected and therefore the film feeding operation is not performed in the AE control sub routine and thus, an advance is made to step 102 without steps 109 and 110 being executed.

Step 102: The focus detection sub routine is executed.

This focus detection sub routine is executed after step 200 shown in FIG. 2C.

The focus detection sub routine will now be described. Step 200: The image signal input sub routine is executed.

In this image signal input sub routine, the signal CSDR is first rendered into "H" by the microcomputer PRS and the driving circuit SDR is selected, and the signal SO is transmitted to this driving circuit SDR. The signal SO is an accumulation start command and in response to this command, the driving circuit SDR transmits the signal CLR to the line sensor device SNS and clears the image accumulation signals of the CCD line sensors, whereafter it causes an accumulating operation for images to be effected. An image light beam which enters through the photo taking lens is incident on the CCD line sensors CCD.sub.1 and CCD.sub.2 of the line sensor device SNS, and the image positions on the sensors CCD.sub.1 and CCD.sub.2 are determined in conformity with the focus state. More particularly, in the in-focus state with respect to an object to be photographed, the same image patterns are projected onto the same positions on the sensors CCD.sub.1  and CCD.sub.2, and in the front or rear focus state, the image patterns on the sensors CCD.sub.1 and CCD.sub.2 are projected onto positions deviated symmetrically from each other in conformity with the direction of focus deviation thereof and the amount of deviation. Accordingly, by detecting the amount and direction of positional deviation between the image patterns on the sensors CCD.sub.1 and CCD.sub.2, the direction of focus deviation and the amount of deviation are detected.

The image patterns projected onto the position corresponding to the focus state in the manner described above are accumulated in the sensors CCD.sub.1 and CCD.sub.2 for a predetermined time after said image signal has been cleared, whereafter the signal SH and clocks .phi.1 and .phi.2 are supplied from the driving circuit SDR to the sensor device SNS. The accumulation time of said image patterns is determined on the basis of the output AGC of the accumulation control sensor in the sensor device SNS.

When the signal SH and clocks .phi.1 and .phi.02 are supplied to the sensor device SNS in the manner described above, the image signals accumulated in the respective picture elements of the sensors CCD.sub.1 and CCD.sub.2 are time-serially delivered in succession as the output OS from the output end of the sensor device SNS, and are amplified by an amplifying circuit in the driving circuit SDR and successively input as signals AOS to the microcomputer PRS. The microcomputer PRS converts said signals AOS to digital values by the internal A/D converting function thereof and stores them in a predetermined RAM.

By the above described operation, the image signals of each sensor corresponding to the image patterns on the sensors CCD.sub.1 and CCD.sub.2 are stored as digital values in the RAM and thus, the image signal input sub routine is terminated and a shift is made to step 201.

Step 201: The defocus amount calculation sub routine is executed. In this sub-routine, the amount of deviation from the in-focus state and the direction of deviation are calculated as the defocus amount DEF on the basis of the digital values corresponding to the image patterns on the sensors CCD.sub.1 and CCD.sub.2 found in the image signal input sub-routine. The specific method of calculating said defocus amount has no direct relation to the present invention and therefore need not be described in detail, but it is such that since the degree of coincidence between the image patterns on the sensors CCD.sub.1 and CCD.sub.2 is determined by the focus state as described above, the digital values of said sensors corresponding to said patterns are compared with each other to find the degree of coincidence between the data thereof, thereby finding the amount and direction of deviation from the in-focus state, that is, the defocus amount DEF. Also, in this sub routine, the contrast CNT is found from the digital values corresponding to the image patterns on the sensors CCD.sub.1 and CCD.sub.2, and the detection of this contrast is also known and therefore need not be described in detail.

Step 202: 0 is set in flags FNC1 and FNC2. These flags are flags for indicating the degree of reliability of focus detection, and in the present embodiment, 0 is set in the two flags when the degree of reliability is highest, 1 and 0 are set in the flags FNC1 and FNC2, respectively, when the degree of reliability is high, and 1 is set in the flag FNC2 when the degree of reliability is worst.

Step 203: The contrast CNT found at said step 201 is compared with a predetermined value C.sub.1.

When the contrast CNT is CNT>C.sub.1, a shift is made to step 207, and when CNT<C.sub.1, a shift is made to step 204.

Step 204: 1 is set in the flag FNC1 and an advance is made to step 205.

Step 205: The contrast CNT is compared with a predetermined value C.sub.2. However, C.sub.1 and C.sub.2 are in the relation that C.sub.1 >C.sub.2. When CNT>C.sub.2, a shift is made to step 207, and when CNT<C.sub.2, a shift is made to step 206.

Step 206: 1 is set in the flag FNC2.

At said steps 203-207, the flags FNC1 and FNC2 are both set to 0 when the contrast CNT is highest; the flags FNC1 and FNC2 are set to 1 and 0, respectively, when the contrast CNT is C.sub.1 >CNT>C.sub.2 ; and the flags FNC1 and FNC2 are both set to 1 when the contrast CNT is C.sub.2 >CNT.

After the set conditions of the flags FNC1 and FNC2 have been determined at said steps, step 207 is executed.

Step 207: 0 is set in flags JFFLG, SDFLG and CHSFLG. This step is a step for initializing said three flags.

Step 208: The condition of flag FNC2 is determined.

When the flag FNC2 is set to 1, the focus detection sub-routine is terminated and a return is made to the AF control sub routine, and then a shift is made to the decision sub routine of step 103. When the flag FNC2 is set to 0, a shift is made to step 209.

Step 209: Comparison of the defocus amount DEF found at said step 201 with a predetermined value CHSFLD is effected, and when DEF>CHSFLD, the focus detection sub routine is terminated, and a return is made to the AF control sub-routine, and a shift is made to the decision sub routine of step 103. The predetermined value CHSFLD is set to a value a little greater than the value for which the defocus amount represents the vicinity of in-focus, and DEF>CHSFLD shows that the defocus amount up to the in-focus state is great.

Also, when CHSFLD.gtoreq.DEF in the above-described comparison, a shift is made to step 210.

Step 210: The flag CHSFLG is set to 1.

Thus, when the defocus amount DEF is within the predetermined value CHSFLD, that is, when the defocus amount is not so great, the flag CHSFLG is set to 1.

Step 211: Comparison of the defocus amount DEF with a predetermined value SDFLD is effected and when DEF>SDFLD, a shift is made to the decision sub routine of step 103. Said predetermined value SDFLD is set to the relation that CHSFLD>SDFLD, and this predetermined value SDFLD is set to a defocus amount representative of the vicinity of the in-focus state.

Also, when SDFLD.gtoreq.DEF is determined in said comparison, 1 is set in the flag SDFLG at step 212. Thus, when the defocus amount DEF is in the vicinity of the in-focus state, the flag SDFLG is set to 1.

Step 213: Comparison of the defocus amount DEF with a predetermined value JFFLD is effected and when DEF>JFFLD, the focus detection sub routine is terminated, and a return is made to the AF control sub-routine and a shift is made to the decision sub-routine of step 103. The value of said JFFLD is in the relation that SDFLD>JFFLD, and is set to a value for which the defocus amount can be regarded as in-focus.

Also, when JFFLD.gtoreq.DEF is determined in said comparison, 1 is set in the flag JFFLG at step 214 and a shift is made to the decision sub routine of step 103.

In the above-described focus detection sub routine, the set conditions of the flags FNC1 and FNC2 are determined in conformity with the degree of reliability of focus detection and when the flag FNC2 is 1, that is, in the other cases than the case where the degree of reliability is very low under low contrast, the flag JFFLG is set to 1 in conformity with the defocus amount DEF during the in-focus condition; the flag SDFLG is set to 1 during the proximity of an in-focus condition; and the flag CHSFLG is set to 1 when the focus state is somewhat far from the vicinity of in-focus.

After the focus detection sub routine has been executed, the focus detection sub routine is terminated and a return is made to the AF control sub routine, and the decision sub routine of step 103 is executed as described above.

The decision sub routine is shown in and after the step 300 of FIG. 2D.

Step 300: 0 is set in flags JF, AFNG and LMVDI, and these flags are initialized.

Step 301: The set condition of the flag JFFLG is detected, and when JFFLG is 1, that is, when in-focus, a shift is made to step 302, and when JFFLG is 0, a shift is made to step 307.

Assuming that the flag JFFLG is set to 1, the condition of the flag FNC1 is determined at step 302, and when the flag FNC1 is 0, a shift is made to step 303, and when the flag FNC1 is 1, a shift is made to step 307.

Thus, the result of the focus detecting operation indicates the in-focus state and the focus detecting operation under high contrast conditions is performed. Only when the result of the detection is of a high degree of reliability, step 303 and subsequent steps are executed.

When an advance has been made to step 303 in the manner described above, 1 is set in in-focus flag JF and 1 is set in flag PREJF at step 303, and an advance is made to the next step 304 and subsequent steps. counting operation, the decision sub routine during the in-focus condition is terminated, a return is made to the AF control sub routine, and a shift is made to the display sub routine of step 104 of FIG. 2B.

The above-described operation is the operation when in-focus determination has made under a high degree of reliability, but during the other times, the flag JFFLG is set to 0 or the flag FNC1 is set to 1 and therefore, at step 301 or step 302, the above-mentioned set condition is detected and step 307 and subsequent steps are executed.

Step 307: The condition of the flag SDFLG is determined, and when the flag SDFLG is 0, a shift is made to step 311, and when the flag SDFLG is 1, a shift is made to step 308. The flag SDFLG is set to 1 when the vicinity of in-focus is determined by focus detection as described above, and therefore, during the proximity to the in-focus state, a shift is made to step 308.

Step 308: The set condition of the flag FNC1 is detected, and when the flag FNC1 is 0, an advance is made to step 314, and when the flag FNC1 is 1, an advance is made to step 309. Assuming that the flag FNC1 is set to 1, a description will now be provided of the case where an advance has been made to step 309.

Step 309: The condition of the flag PREJF is determined. This flag is set to 1 when step 303 has been executed, that is, when the in-focus condition has been detected in the preceding focus detecting operation, and it is set to 0 by the flag clearing operation of step 2 before the first focus detecting operation, and it is set to 0 when the first decision sub routine is executed. The first decision sub routine is now being executed and therefore, a shift is made to step 310.

Step 310: The condition of flag NGONCE is detected. This flag NGONCE is a flag which is set to 1 when the impossibility of focus detection has been detected in the preceding focus detection operation, and it is 0 when the first decision sub routine is executed, and a shift is made to step 311.

Step 311: The set condition of the flag FNC2 is determined. This flag FNC2, as described above, is set to 1 under very low contrast conditions and therefore, an advance is made to step 312 and subsequent steps when focus detection is effected under very low contrast.

The condition under which a shift is made to step 312 at the above-mentioned step during the first focus detecting operation is the case under very low contrast, and in the other cases, a shift is made to step 314 or step 303.

Also, at step 312, a flag AFNG for the impossibility of focus detection and the flag NGONCE are set to 1, and at step 313, the flag LMVDI is set to 1 and the decision sub-routine is terminated. Therefore, in the first focus detecting operation, steps 312 and 313 are executed only when the focus detection under very low contrast conditions is effected, and thus, the flag AFNG for the impossibility of focus detection is set to 1.

As is apparent from the foregoing description, when the first focus detecting operation has been effected, the flag JF for the in-focus condition is set to 1 only when the degree of reliability of focus detection is highest and the in-focus state is judged. The flag AFNG for the impossibility of focus detection is set to 1 only when the degree of reliability is lowest. In the other cases, step 314 and subsequent steps are executed. However, if the focus detecting operation is performed earlier, the operation as described below will take place with the result of the preceding focus detection taken into consideration.

In the process wherein the above-described series of steps are being executed in the decision sub routine, the set condition of the flag PREJF is determined at step 309, and when this flag PREJF is set to 1, a shift is made to step 303. The flag PREJF, as previously described, is set to 1 when step 303 was executed at the last time, that is, when the in-focus state was determined in the preceding focus detecting operation, and therefore, even when the proximity of the in-focus state is detected in the current focus state detecting operation and the degree of reliability is not high, if the in-focus is determined at the last time, a shift is made to step 303 and subsequent steps and the flag JF for the in-focus state is set to 1.

Also, when the impossibility of focus detection has been detected in the preceding focus detecting operation, even if the vicinity of the in-focus state is detected in the current focus detecting operation and the degree of reliability is not high, it is detected at step 310 that the flag NGONCE is 1 and therefore, an advance is made to said step 312 and the flag AFNG for the impossibility of focus detection is set to 1.

The conditions under which the flags JF and AFNG are set to 1 by the operations of said steps 300-312 and the decision sub-routine is terminated are as shown in Table 1 below. __________________________________________________________________________ JF=1   The first focus detecting The second and sub- operation and the second sequent focus and subsequent focus detecting detecting operations when operations when PREJF=0         PREJF=1 JFFLG=1 and FNC1=0 The left-mentioned when in-focus state is condition or determined and the SDFLG=1 degree of reliabilty and FNC=1 is high       and PREJF=1 when the proximity of the in-focus state is detected and the degree of reliability is not high and the in-focus state was detected at the previous time AFNG=1 The first focus detecting The second and operation and the second subsequent focus and subsequent focus detecting operations detecting operations when when NGONCE=1 NGONCE=0 FNC2=1          The left-mentioned (when the degree of condition or reliability is lowest) SDFLG=1 and FNC1=1 and NGONCE= 1 when the proximity of the in-focus state is detected and the degree of reliability is not high and the impossibility of focus detection was detected at the previous time. __________________________________________________________________________

The reason why, as described above, the flag JF or AFNG is set to 1 when a high degree of reliability is not obtained even if the proximity of the in-focus state is detected this time by the result of the preceding focus detecting operation is the consideration that the degree of reliability of the detection of the proximity of the in-focus state as the result of the current focus detecting operation is not so high and therefore there is a doubt as to whether the lens can be accurately moved to the in-focus position even if the lens is driven in accordance with the result of the detection. In this case, if the in-focus state or the impossibility of focus detection is determined in the preceding detection, approximately accurate detection will be made even if the result of the preceding detection is relied on and adopted as the result of the current detection.

Further, in the above described case, when the lens is driven in accordance with the result of the detection, the result of the preceding detection is cancelled by the above mentioned information of not so high a degree of reliability even if the in-focus state or the impossibility of focus detection is once determined. Therefore, even after the in-focus state or the impossibility of focus detection is once detected, a return is immediately made to the state of the detection of the non in-focus state or the state of the detection of the possibility of focus detection. And said detection of the in-focus state or said detection of the impossibility of focus detection changes each time the focus detecting operation is performed. Thus, the stability for the detection of the in-focus state or the detection of the impossibility of focus detection is lost, and the aforementioned reason is for preventing the display t be effected when the in-focus state or the impossibility of focus detection is displayed or the lens is driven as will be described later from changing at all times to confuse the photographer or keep the lens unstopped for any length of time. Consequently, in the present invention, once the in-focus state or the impossibility of focus detection have been detected, even if the result of that detection differs from the detection of the in-focus state or the impossibility of focus detection, the result of that detection, if not high in degree of reliability, will be neglected and a preference will be given to the result of the preceding detection and thus, the above mentioned object will be achieved.

A description will now be given of a case where the shift to step 314 is allowed when the steps 300-313 have been executed.

It should be noted that this step 314 is executed when the conditions other than the conditions shown in Table 1 above are satisfied, that is, in cases other than the in-focus state or an impossibility of focus detection.

Step 314: The set condition of flag LCRN is detected.

This flag LCRN is a flag which is set to 1 when, as will be described later, the lens is shifted to a mechanical limit position such as the infinity position or the close distance position and cannot be driven any more. When the flag LCRN is 0, a shift is made to step 320, and when the flag LCRN is 1, a shift is made to step 315. Let it be assumed that the lens is in the limit position. In such case, step 315 is executed.

Step 315: The signs of the content of a memory LDIR and the defocus amount DEF found in the focus detecting operation are determined. The memory LDIR stores therein the defocus amount found in the preceding focus detecting operation and the defocus amount DEF represents the amount and direction of deviation as described above. Therefore, the sign of the defocus amount DEF is determined in the direction of front focus or rear focus, i.e., the direction in which the lens is driven.

When the sign of the preceding defocus amount in the memory LDIR and the sign of the current defocus amount are not coincident with each other, it is possible to drive the lens and therefore, a shift is made to step 320. If said signs are coincident with each other, any further driving of the lens is impossible and therefore, an advance is made to step 316. Let it be assumed that an advance has been made to step 316.

Step 316: Whether the sign of the defocus amount DEF is representative of the direction in which the lens should be driven toward the infinity side is detected. When said sign is representative of the driving in the direction toward the infinity side, an advance is made to step 317, and when said sign is representative of the direction in which the lens should be driven toward the close distance side, an advance is made to step 312.

Accordingly, when the lens is in the close distance side limit position and further driving of the lens in the close distance direction ha been directed, a shift is made to step 312. At the steps 312 and 313, 1 is set in the flag AFNG, etc., and the decision sub routine is terminated. That is, in the situation as described above, it is impossible to obtain the in-focus state and therefore, this situation is regarded as the state of impossibility of focus detection and the processing during the focus detected state is effected.

Also, when the lens is in the infinity side limit position and further driving of the lens in the infinity direction has been directed, the set condition of the flag PREJF is determined at step 317. When the flag PREJF is detected as 1, i.e., the in-focus state at the last time is detected, an advance is made to step 319. When the flag PREJF is detected as 0, i.e.. the in-focus state at the previous time is not detected, an advance is made to step 318.

Let it be assumed that a shift has been made to step 318.

Step 318 : The defocus amount DEF is compared with a predetermined value A.sub.1, and when DEF<A.sub.1, shift is made to step 303, and when A.sub.1 <DEF, a shift is made to step 312.

When as a result of this comparison, the defocus amount is smaller than the predetermined value A.sub.1, processing similar to that during the detection of the in-focus state is effected at the step 303. When the defocus amount is greater than the predetermined value A.sub.1, processing similar to that during the detection of the impossibility of focus detection is effected at the step 312.

That is, even when the lens is in the infinity side position and is not in the original in-focus state, if the defocus amount is within the predetermined value, that is, in the case of a small defocus amount, there is no problem even if he in-focus state is detected when the characteristic of the lens is taken into consideration. In such a case, the lens is regarded as being in-focus and the in-focus processing of step 303 and subsequent steps is effected. When the defocus amount is greater than said predetermined value, it is impossible to bring about the in-focus state and it is also impossible to regard the lens as being in-focus. Therefore, under such a situation, a shift is made to step 312 and the processing for the impossibility of focus detection is effected.

Also, when at step 317, the flag PREJF is 1, that is, the in-focus state is detected in the preceding focus detecting operation, step 319 is executed. When at step 319, as at step 318, DEF<A.sub.2 as a result of the comparison of the defocus amount DEF with a predetermined value A.sub.2, an advance is made to step 303 and subsequent steps for the same reason as set forth above and the processing for the detection of the in-focus state is effected. When DEF>A.sub.2, an advance is made to step 312 and the processing for the impossibility of focus detection is effected.

The relation between the predetermined values A.sub.1 and A.sub.2 is A.sub.2 >A.sub.1. The reason why there is thus provided the difference between A.sub.1 and A.sub.2 is that the probability with which the lens is in the in-focus state is higher when the in-focus state is determined as a result of the preceding focus detection. There is no problem even if the defocus amount DEF regarded as the in-focus state in such case is greater than the defocus amount DEF when determined as the non in-focus state at the previous time. Also, as previously described, the in-focus condition after the in-focus state has once been determined is stabilized.

The relation between the predetermined value A.sub.1 and the original defocus amount JFFLD for the in-focus detection is A.sub.1 >JFFLD.

The reason why A.sub.1 is set to A.sub.1 >JFFLD and the defocus amount regarded as in-focus is made great at the infinity end position and the in-focus determination is made mild is that as described above. When the characteristic of the lens is considered, even if the defocus amount is more or less great at the infinity end position, there is actually no problem in regarding it as in-focus, and thus the probability with which the in-focus condition is attained is enhanced and the detection of the in-focus state can be accomplished within a short time.

The above-described steps 315-318 are a case where the flag LCRN is set to 1 and the lens driving directions as the result of the preceding focus detection and the result of the current focus detection are identical. That is, the lens cannot be driven in accordance with the result of the focus detection. However, in the other cases, that is, in a case where the lens can be driven in the in-focus direction on the basis of the result of the focus detection and in a case where the current focus detection is the first one even if the lens is in the limit position and the determination that the lens should be further driven toward the limit position has been brought as a result of the focus detection, an advance is made to step 320 and subsequent steps.

Step 320: 0 is set in the flags PREJF and NGONCE.

Step 321: The condition of the flag CHSFLG is determined.

When the flag CHSFLG is set to 1, that is, when the defocus amount obtained in the focus detecting operation at steps 209 and 210 is smaller than said predetermined value CHSFLD and the defocus amount until the in-focus state has not become great, the decision sub routine is terminated later.

When CHSFLG is 0, that is, when the defocus amount has become great, step 322 is executed.

Step 322: The set condition of flag TMACT is detected and, when this flag TMACT is set to 0, the decision sub routine is terminated, and when the flag TMACT is set to 1, a shift is made to step 323.

The flag TMACT is adapted to be set to 1 at step 109 to be described and said step 305 and therefore, the flag TMACT is set to 1 only during the focus detecting operation after a photographing operation has been performed, or only when the in-focus determination has been done and the processing of steps 305 and 306 has been effected, and the flag TMACT is set to 0 in the other cases.

Accordingly, when a photographing operation is not being performed or when the in-focus determination is not done earlier in the focus detecting operation, the decision sub-routine is immediately terminated, and during the focus detecting operation after the photographing operation or when the in-focus judgement is once done in the focus detecting operation, a shift is made to step 323.

A description will now be given of a case where it is assumed that the in-focus determination has been done earlier and the determination that the defocus amount is greater than said predetermined value CHSFLG has been brought in the focus detecting operation after that.

In such a case, it is detected at step 322 that the flag TMACT is set to 1 and a shift is made to step 323, where the product f.times.C.sub.T of the focal length information f of the lens and a predetermined value C.sub.T is found, and this product f.times.C.sub.T is set as a timer time TMLNG and an advance is made to step 324.

Step 324: At this step, the timer time TMLNG is compared with the time lapse from the point of time at which the in-focus condition has been attained earlier and the counting of a lens driving restriction timer has been started at step 306. If the lapse timer time>TMLNG, that is, if the timer time TMLNG has elapsed after the in-focus state has once been attained, the flag TMACT is set to 0 at step 325. On the other hand, if TMLNG> the lapse timer time, that is, if the time TMLNG has not yet elapsed after the in-focus condition has once been attained, the flag LMVDI is set to 1 at step 326 and the decision sub routine is terminated.

In the state in which the lens unit is driven in accordance with the defocus amount based on the result of the focus detection purusant to the operations of the above-described steps 320-326, when said defocus amount is a small defocus within CHSFLD, the lens driving based on said defocus amount is effected at step 106 immediately after the termination of the decision sub routine. If the defocus amount found in the focus detecting operation in a state in which the in-focus detection has not been done earlier or a state in which a photographing operation is not performed, is a great defocus exceeding CHSFLD, the lens driving based on this defocus amount is effected at step 106 immediately after the termination of the decision sub-routine.

Accordingly, in a case where a great amount of defocus has been detected in the focus detecting operation when a photographing operation has not been performed earlier and the focus detecting operation when the in-focus detection is not done in the focus detecting operation, and in a case where a small amount of defocus has been detected in the focus detecting operation; then the lens driving is always based on the calculated defocus amount. Also, after a photographing operation has been performed earlier or when the in-focus detection has once been done in the focus detecting operation, the lens driving is inhibited from after said photographing operation or said in-focus judgement has been done until said time TMLNG has elapsed. Then the lens driving based on the calculated defocus amount is started after the lapse of said time. The reason why, as described above, when the detection of great defocus amount has been done in the focus detecting operation after the in-focus determination has once been made, the lens driving is effected after the lapse of said time is as follows.

In a situation in which a great defocus is detected in the focus detecting operation after the in-focus detection, there may be conceived a state in which the lens is pointed at an object to be photographed lying at a position entirely differing from the object to be photographed during the in-focus judgement. Such a situation occurs, for example, when the distance measuring field of the camera deviates from the object to be photographed, due to a hand vibration. In such case, when the lens is immediately driven on the basis of the defocus amount obtained as a result of the focus detection, the lens driving will focus the lens to an object to be photographed different from the previous object photographed. Therefore the distance measuring field is adjusted to the previous object photographed, and the focus detection is effected to focus the lens to the original object, and thus, wasteful operations are performed.

In the present invention, to prevent the inconvenience noted above, the lens driving is inhibited for a predetermined period of time in the detection of a great amount of defocus after an in-focus condition is determined so that even if the photographer removes the distance measuring field from the object to be photographed due to hand vibration, the distance measuring field can be returned to the original object to be photographed. Even in the above mentioned case, the lens is prevented from being moved from the object to be photographed, under the influence of a hand vibration. Also, the above noted problem of hand vibration is more liable to arise as the focal length of the lens is longer and therefore, in the present invention, said time TMLNG is set to a longer period of time on the basis of the focal length information f of the lens as the focal length becomes longer. The focal length information f of the lens is pre-stored in the microcomputer PRS by rendering the signal CLCM from the microcomputer PRS into H when the defocus amount is calculated at step 201 of the focus detection sub routine, transmitting the signal SO to the communication buffer circuit LCM, transmitting the buffer signal DCL of the signal SO to the control circuit LPRS, reading out various parameters including the focal length of the lens, and inputting these parameters as signals DLC and SI to the microcomputer.

The reason why, in the case of a small amount of defocus, the lens driving is immediately effected irrespective of said time TMLNG is that the small defocus amount often represents the defocus amount provided by the movement of the object to be photographed in a state in which the original object to be photographed is located in the distance measuring field. In such case, the lens is caused to follow the movement of the object to be photographed.

Also, the reason why the lens driving is started after the lapse of said timer time TMLNG when a great amount of defocus has been detected after a photographing operation has been performed is similar to that in the above described case.

The operations of the decision sub-routine are as described above, and may be put in order as follows: of driving is toward the close distance, the impossibility of focus detection is determined; driving is toward infinity, if the preceding in-focus determination has been done and the defocus amount is within A.sub.2, the in-focus condition is determined, and in the other cases, the impossibility of focus detection is judged. If the preceding in-focus determination has not been done, when the defocus amount is within A.sub.1 (A.sub.2 >A.sub.1 >JFFLD), the in-focus state is determined and in the other cases, the impossibility of focus detection is determined. immediately driven on the basis of the defocus amount; CHSFLD: determination has once been done or after the exposure operation (the photographing operation) has been terminated, lens driving based on the defocus amount is effected after the lapse of said time; and based on the defocus amount is immediately effected.

When the above described decision sub routine is terminated, a return is made to the AF control routine and a shift is made to step 104, where the display sub routine is executed. In this sub-routine, when the decision sub-routine result flag JFFLG is set to 1, that is, when the lens is in-focus, signal CDDR is rendered into H by the microcomputer PRS, and a display circuit DDR is designated and the set information 1 of the flag JFFLG is transmitted as the signal SO to the circuit DDR. The circuit DDR is responsive to the signal SO to turn on the in-focus display LED in the display device DSP and effect the display of the in-focus condition.

Also, when flag AFNG has been set to 1, that is, when focus detection is impossible, the set information 1 of the flag AFNG is likewise transmitted to the circuit DDR to turn on an LED for displaying the impossibility of focus detection to the photographer.

After the above-described display sub routine has been executed, step 105 is executed.

Step 105: The set condition of the flag LMVDI is detected.

This flag is set to 1 only at the steps 304, 313 and 326 of the decision sub routine. Consequently, 1 is set in this flag only during the detection of the in-focus state, during the detection of the impossibility of focus and when the timer time TMLNG is waiting to lapse.

Accordingly, in each of the above mentioned states, the AF control sub routine is terminated and a shift is made to step 1 without the lens driving sub-routine being executed, that is, without the lens driving being effected, and in the states other than said states, a shift is made to step 106, where the lens driving sub-routine is executed.

In the lens driving sub routine, the signal CLCM is rendered into H by the microcomputer PRS and the circuit LC is designated.

Also, the defocus amount is transmitted as the signal SO to the circuit LCM, and the signal SO is transmitted as the signal DCL to the control circuit LPRS. The circuit LPRS renders a signal LMF or LMR into H in conformity with said defocus amount, revolves the motor LMTR in the direction determined in conformity with the defocus amount, and moves the photo taking lens LNS in the direction of the optic axis. The amount of movement of this lens is monitored by the encoder ENC, which thus outputs a signal SENC corresponding to the amount of movement, and this signal SENC is compared with a signal representative of said defocus amount transmitted to the circuit LPRS. When the two signals become coincident with each other, the signals LMF and LMR are rendered into L, whereby the revolution of the motor LMTR is stopped to terminate the lens driving.

When the driving of the lens is started by the above-described operation (step 106), the lens driving sub-routine is terminated and a shift is made to step 106', where flag PRMV (for indicating that the lens has been driven) is set to 1, and then a shift is made to step 107.

Step 107: The defocus amount DEF is compared with a predetermined value NJF, and when DEF>NJF, the AF control sub-routine is terminated, and when DEF<NJF, flag NEXT JF is set to 1 at step 108, and the AF control sub routine is terminated.

The predetermined value NJF is set to a defocus amount which is indicative of the proximity to the in-focus condition.

Accordingly, when the defocus amount is in the vicinity of the in-focus state, 1 is set in the flag NEXTJF and the AF control sub-routine is terminated.

Thus, a series of AE and AF control operations are terminated by the above described steps.

The operation control is done in the manner described above, and the above described operations will be put in order as follows to clarify the foregoing description.

When the power source switch is closed during the first photographing operation and the first stage operation of the shutter button is effected in this state, AE control is effected and photometry and calculating processes are effected. Thereafter, a shift is made to AF control.

In the first photographing operation, focus detection and decision sub routines are immediately executed and the focus state is detected and determined. When the in-focus state is determined in the first focus detection, the in-focus display is effected and thereafter, as long as the first stage operation is maintained and the switch SW.sub.1 is ON, AE control and AF control continue to be effected.

Also, when the impossibility of focus detection is determined in the first focus detection, the display of the impossibility of focus detection is effected and thereafter, as long as the switch SW.sub.1 is ON, AE control and AF control are repetitively executed.

Also, when the in-focus state or the impossibility of focus detection is not determined in the first focus detection, the lens is driven by the detected defocus amount.

The above described operation is the operation based on the result of the first focus detection.

A description will now be given of each operation after the above described first operation, based on the result of said first focus detection, has been performed.

A description will first be given of a case where the in-focus state has been determined in the first focus detection. In this case, the in-focus condition continues to be maintained and displayed as long as the in-focus determination is done in the second and subsequent focus detections. Even when the proximity of the in-focus state is determined in a state in which there is no high degree of reliability in the second and subsequent focus detections, the in-focus state is maintained and displayed. That is, as long as the proximity of the in-focus state continues to be determined in a state in which the in-focus determination or a high degree of reliability is not obtained in the second and subsequent focus detections, the in-focus display continues to be effected.

The determinations other than the detection of the proximity of the in-focus state and the determination of the impossibility of focus detection under the focus detecting condition in which the in-focus detection and a high degree of reliability are not obtained in the focus detection in the state in which said in-focus display is being effected are done, and when the determined defocus amount is within CHSFLD, i.e., is a small amount of defocus, lens driving is immediately effected in conformity with the defocus amount. Also, when the defocus amount is greater than CHSFLD, the lens driving in conformity with said defocus amount is effected after the lapse of a time corresponding to the focal length of the lens.

A description will now be given of the operation after the determination of the impossibility of focus detection has been completed in the first focus detecting operation. When the determination of the impossibility of focus detection continues to be done in the second and subsequent focus detecting operations and when the judgement of the proximity of the in-focus state continues to be done in the state in which a high degree of reliability is not obtained, the display of the impossibility of focus detection continues to be effected.

Also, when the determinations other than the determination of the proximity of the in-focus state are done in a state in which the determination of the in-focus condition, the determination of the impossibility of focus detection and a high degree of reliability are not obtained during the repeated focus detecting operations, lens driving in conformity with the detected defocus amount is immediately effected.

A description will now be given of the operation after the lens driving based on the result of the first focus detecting and judging operation has been effected.

In this case, at said step 106, the lens is driven by the detected defocus amount, whereafter a shift is made to the AE control sub-routine, where photometry and calculating processes are effected, and thereafter the AF control sub routing is again executed. At this time, the lens driving based on the result of the preceding focus detecting and judging operation is effected and therefore, after the lens driving, at step 106', flag PRMV is set to 1 and thus, at step 100 when the AF control sub-routine is again executed, it is detected without fail that the flag PRMV is set to 1, and an advance is made to step 111 and subsequent steps.

That is, step 111 and subsequent steps are not executed until the lens driving based on the defocus amount of the previous time has been effected.

Step 111: Whether the lens is in its stopped state is detected. This determination is accomplished by rendering the signal CLCM of the microcomputer PRS into H, designating the circuit LCM, supplying the signal SO to the circuit LCM, and transmitting the signal SO as a signal DCL to the control circuit LPRS by the circuit LCM.

The signal SO in this case is a lens stop detection command, and by this command being transmitted to the circuit LPRS, the circuit LPRS effects the detection of the monitor signal SENC from the encoder ENC. The monitor signal SENC is produced when the lens is being driven, and the circuit LPRS detects the presence or absence of said monitor signal and transmits the result of the detection of the presence or absence of the monitor signal as a signal DLC to the circuit LCM, whereafter the circuit LCM repetitively applies this signal DLC as the signal SI to the microcomputer PRS.

At step 11, whether the monitor signal has been produced is determined as a result of the detection of the presence or absence of the thus detected monitor signal, and when the monitor signal has been produced, that is, when the lens is in its driven state, the AF control sub routine is terminated. Accordingly, as long as the lens is in its driven state, a determination as to whether the lens has been stopped continues to be done at step 111 in the AF control sub routine.

When the lens is stopped while the detection of the stoppage of the lens is thus repetitively done, an advance is made to step 112 for the first time and flag PRMV is set to 0. At step 113, it is determined whether the lens has been driven by said defocus amount and stopped or has been shifted for example to the infinity side or close distance side limit position and as a result, has become unable to be driven and has been stopped.

This determination, like the above described judgement of the stoppage of the lens, is accomplished on the basis of the signal SENC. That is, at this step 13, the signal SENC representative of said amount of movement obtained during said lens driving is compared with the then defocus amount, and when SENC< the defocus amount, it is considered that lens driving is impossible and the lens has been stopped.

When it is determined at said step 113 that the lens has been properly driven on the basis of the defocus amount, flag LCRN is set to 0 at step 114 and thereafter, a shift is made to step 117. When it is determined that the lens has become unable to be driven, the flag LCRN is set to 1 at step 115, and at step 116, the defocus amount DEF, detected at the last time, is stored in a memory LDIR, whereafter a shift is made to step 117.

Step 117: The detection of the auto-focus mode is performed. This detection is accomplished by rendering the signal CDDR from the microcomputer PRS into H, designating the circuit DDR, inputting to the microcomputer PRS the set condition of a mode selecting switch provided in the input switch group SWS as the signal SI, and determining the set condition of the mode selecting switch.

Let it be assumed that the servo mode has been set by the mode selecting switch. In this case, step 101 and subsequent steps are again executed.

When lens driving has been effected on the basis of the first focus detecting and determination operation in the servo mode in the manner described above, confirmation of the stoppage of lens driving and a determination of whether the lens has become unable to be driven are done, whereafter the operations of step 101 and subsequent steps are again executed. Accordingly, if the focus detecting and determination operation is again performed after the lens driving and as a result, the lens is shifted to the in-focus state by said lens driving, the display of the in-focus state will be effected. If the determination of the impossibility of focus detection is done, the display of the impossibility of focus detection will be effected. If the determination of the in-focus state and the impossibility of focus detection is not done, lens driving based on the calculated defocus amount will be effected.

Accordingly, the above-described operation is repetitively executed until the in-focus state is attained.

Also, even if the in-focus state is once attained, said AF control is repeated and therefore, when the object to be photographed has moved, it is detected and the lens is driven to the in-focus position. It should be noted that since this lens driving takes place after the in-focus state has once been attained, the lens driving is effected after the lapse of the aforementioned time TMLNG after the in-focus condition has been attained.

The above described operation refers to the case where in the servo mode, the lens has been driven depending on the result of the first focus detection, but even after the in-focus state or the impossibility of focus detection is determined as a result of the first focus detection and thereafter the object to be photographed moves and said lens driving is effected to focus the lens to the moving object to be photographed, a similar operation will take place and the lens driving will be effected to focus the lens always to the object to be photographed.

Also, when during said lens driving, the lens is shifted to the limit position and at step 115, 1 set in the flag LCRN, said steps 315-319 are executed in the decision sub-routine thereafter. Therefore, when the lens is in the close distance position by at preceding lens driving operation and the direction of driving is directed toward the close distance by the current focus detection, or when the lens is in the infinity position by the preceding lens driving and the direction of driving is directed toward the infinity by the current focus detection and further the then defocus amount is above the predetermined value A.sub.1 or A.sub.2, the above-described processing for the determination of the impossibility of focus detection is effected. In such a case, the lens driving based on the result of the current focus detection is inhibited.

Also, when the lens is likewise in the infinity position by the preceding lens driving and the infinity direction is indicated by the current focus detection and further the then defocus amount is within the predetermined value A.sub.1 or A.sub.2, the above described processing for the determination of in-focus state is effected. Again in this case, the lens driving based on the result of the current focus detection is inhibited.

The above-described operation is performed in the servo mode. A description will now be given of the operation when the one shot mode has been determined at step 117.

The one shot mode is detected at step 117, and is identical to the servo mode in the operation from after the power source switch is closed until the lens is once driven on the basis of the calculated defocus amount.

That is, again in the one-shot mode, the detection of the defocus amount is effected by the focus detecting and determination operation and lens driving by the defocus amount is effected.

In executing the AF control sub-routine after the lens driving has been effected in this manner, steps 111-116 are executed, whereafter steps 117 and 118 are executed. In this case, since the lens driving has been effected, the flag JF is not set to 1 and a shift is made to step 119. At step 119, the condition of the flag NEXTJF is detected, and this flag is set to 0 when the defocus amount during the preceding lens driving is greater than a predetermined value NJF, and is set to 1 when said defocus amount is smaller than said predetermined value NJF.

Accordingly, when a great defocus amount is detected in the preceding focus detecting and determination operation, the operations of step 101 and subsequent steps are performed. After the lens driving, focus detection and determination are again performed, and it is determined whether the lens has been shifted to the in-focus position as a result of said lens driving.

When the in-focus state has been determined in this second focus detection and determination, the flag JF is set to 1. Therefore, when the AF control sub routine after said second focus detecting and determination operation is executed, it is detected at step 118 that the flag JF is set to 1, and a shift is made to step 121, where the in-focus display sub routine is executed to display the in-focus condition. In the one-shot mode, once the detection of the in-focus state is completed in this manner, a shift is immediately made to step 121 after step 118 and thus, the focus detecting and determination operation and lens driving thereafter are inhibited.

Also, when the determination of the in-focus state is not done in the second focus detecting and determination operation after said first lens driving, the lens driving is again effected on the basis of the calculated defocus amount, whereafter said operation is repeated until the determination of the in-focus state is done and, after the shift to the in-focus state, the focus detection and determination and lens driving operations are inhibited.

The above described operation refers to the case where a great defocus amount has been detected during the first lens driving, but when a small defocus amount has been detected, it is determined at step 119 that the flag NEXTJF is set to 1 and therefore, a shift is made to steps 120', 120 and 121.

Accordingly, when the defocus amount is small when the lens driving has been effected in the one shot mode, that is, the lens has been driven from the vicinity of in-focus state toward the in-focus position, as long as the lens is not unable to be driven, a shift is made to step 121 without the second focus detecting and determination operation being performed. Thus, the in-focus state is displayed, and the focus detection and determination and lens driving operations thereafter are inhibited. It is to be understood that at step 121, the flag JF is set to 1 and the display of the in-focus condition is effected.

When in the one shot mode, the preceding defocus amount is thus below the predetermined value and the lens has been driven from the position of the vicinity of the in-focus state toward the in-focus position, it is considered that the lens has been moved to the in-focus position. Thus, the display of the in-focus condition is immediately effected without the second focus detecting and determination operation being performed after the lens driving to confirm whether the in-focus state has been attained. Therefore, the time required for the shift to the in-focus state in the one shot mode is shortened.

Also, even if a small defocus amount has been detected during the one shot mode and steps 119, 120' and 120 have been executed, when the flag LCRN is set to 1, that is, when the lens is stopped at the limit position as a result of lens driving during the one-shot mode, an advance is not made to step 121, but a shift is made to step 101, where the second focus detecting and determination operation is performed. Thus, it is confirmed whether the lens has not been shifted to the in-focus position but has been stopped at the limit position. When it is confirmed that the lens is stopped at the in-focus position, the display of the in-focus condition is effected, and in the other case, the above described focus detecting and determination operation is repeated and finally, the lens is shifted to the in-focus state.

As described above, in the one shot mode, when the lens has been driven by a small defocus amount, it is considered that the lens has been shifted to the in-focus position, and the auto-focus sequence is terminated without the second focus detecting and determination operation after lens driving has been performed. Only in the case where the lens is stopped at the limit position, said second focus detection and determination is performed. Therefore, even if the processing regarding the shift of the lens for a small defocus amount as the shift to the in-focus position as described above is effected, the lens is ensured to be shifted to the in-focus position without greatly deviating from the in-focus state.

As described above, in the present invention, the in-focus range when the lens is in the infinity limit position is made greater than usual. Furthermore, when the result of the earlier focus detection shows the in-focus state, the in-focus range is further enlarged. Therefore, the inconvenience of the conventional device, where the indication of in-focus state is not effected for any length of time and the photographer misses a photo opportunity can be prevented.

As the method of determining the impossibility of lens driving, for example, the encoder may comprise a pulse plate for forming a pulse when the lens is being driven. Whether a pulse is output from the encoder ENC for a predetermined time or longer when the motor LHTR is supplied with electric power may be determined on the basis of the defocus amount so that the impossibility of lens driving may be detected when said pulse is not formed.

As another method, a switch adapted to be closed when the lens has been shifted to the limit position of the infinity end or the close distance end may be disposed. Therefore, during the driving of the motor, said switch may detect the shift of the lens to the limit position and the impossibility of lens driving may be judged. Alternatively, said encoder may be designed to output the absolute positional information of the lens so that when said positional information is indicative of the infinity or close distance position, the impossibility of lens driving may be determined.

## Claims

1. A focus detecting device including: lens and outputting a focus signal; said lens on the basis of the focus signal from said focus detecting circuit; and determination range of said in-focus determining circuit, within which range the photo-taking lens is regarded as being in-focus relative to the focus signal, to a greater value when the photo-taking lens is in a movable limit position than when the photo-taking lens is not in the movable limit position, and for adjusting the in-focus determination range when the photo-taking lens is in the movable limit position in conformity with the result of an earlier focus detection.

2. A focus detecting device according to claim 1, wherein said in-focus range adjusting circuit sets said in-focus determination range to a greater value when the result of the earlier focus detection is determined as in-focus than when said result is not determined as in-focus.

3. A focus detecting device according to claim 2, wherein said in-focus determining circuit has a comparing circuit for comparing the focus signal with a predetermined first value, and determines said in-focus state when the focus signal is smaller than said first value, and wherein said in-focus range adjusting circuit sets said first value to a second value greater than said first value or to a third value greater than said second value when the photo-taking lens is in the movable limit position, and wherein said in-focus range adjusting circuit has selecting means for selecting said third value when the result of the earlier focus detection represents the in-focus state, and for causing said comparing circuit to compare said third value with the focus signal.

4. A focus detecting device according to claim 1, further including a control circuit for operating said in-focus range adjusting circuit when the focus signal detected by said focus detecting circuit is indicative of further movement of the photo-taking lens toward the movable limit position when the photo-taking lens is in the movable limit position.

5. A focus detecting device according to claim 4, wherein said control circuit operates said in-focus range adjusting circuit when the focus signal is indicative of further movement of the photo-taking lens in an infinity direction when the photo-taking lens is in an infinity limit position.

6. A focus detecting device including: corresponding to the focus state of a photo-taking lens; defocus detecting circuit with a reference value, and for determining an in-focus state of said lens when said reference value is greater than the defocus amount; and photo-taking lens is in a movable limit position, to a first value greater than a value when the lens is not in said position, and for setting said reference value, when the lens, is in the movable limit position and a preceding determination by said determination circuit is determined to be the in-focus state, to a second value greater than said first value.