Data recording apparatus for camera
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a data recording apparatus for cameras, and more particularly to a data recording apparatus for optically or magnetically recording various types of data on a photographic film while the film is advanced. 
     2. Description of the Related Art 
     It is known to utilize cameras capable of recording photographing data on a photographic film at the time of taking a photograph. The photographing data may relate to shutter speed, aperture value, electronic flash conditions, aspect ratio representing a print format, position of a main subject on a picture frame, or other variables. This photographing data is read from the photographic film during the photofinishing process for controlling the print exposure, setting the print format, and the like. A magnetic data recording method described, for example, in U.S. Pat. No. 4,864,332 and U.S. Pat. No. 5,021,820 and an optical recording method described, for example, in U.S. Pat. No. 5,023,656 are known. Digital recording is advantageous over analog recording in that errors in reading and writing the data can be minimized. When digital recording is used, data is represented by a binary code consisting of a plurality of bits, and the binary code may be written as a combination of magnetic areas and non-magnetic areas, or as a combination of photographically exposed areas and non-exposed areas. 
     If the film advance speed of the camera is always constant, a binary code representing photographing data can be written on the film loaded in the camera while the film is advanced, with bit lengths being constant, by driving the magnetic recording head or light recording head in accordance with the constant film advance speed. However, it is very difficult to maintain a constant film advance speed over the full length of a film roll, because the diameter of the film wound on the film take-up spool increases as the film is advanced frame by frame. Therefore, in order to record each bit of the binary code in a predetermined fixed length of film, it is necessary to drive the recording head in accordance with the precisely detected film advance speed. 
     Conventionally, the film advance amount is measured by an encoder constructed of an encoded disk and a photo-detector. The encoded disk has a plurality of slits formed therein at a fine pitch so as to extend in the radial direction. The encoded disk is coupled to the camera advance mechanism and rotates synchronously with the film advance. The photo-detector detects a passage of each slit. A film advance speed is detected from the number of slits which pass per unit time, and a film winding amount is detected from the total number of slits which have passed. Using these detected values, the recording head is controlled and driven. 
     As the amount of data written within a length of one frame increases, the bit record length (unit bit length) of each bit constituting a binary code must be shortened. Under such a condition, it is very difficult to write a binary code correctly and avoid the generation of read errors if the recording head is driven in the manner described above. To solve this problem, it is necessary to more accurately measure a film advance speed and winding amount through the use of an encoded disk having a finer pitch of slits. This requires a high precision in machining of the encoded disk, and a high resolution photo-detector. Such a construction is expensive, resulting in a high cost of manufacturing of the camera. 
     SUMMARY OF THE INVENTION 
     It is a principal object of the present invention to provide a data recording apparatus for a camera capable of maintaining a constant record length of each data bit even if the film advance speed fluctuates. 
     It is another object of the present invention to provide a data recording apparatus for a camera capable of maintaining a constant record length of each bit by using a low cost encoder having a simple structure. 
     The above and other objects of the present invention can be achieved by determining the data recording timings by predicting the time when the next encoded pulse is generated. 
     In the present invention, an encoded pulse generating device generates a pulse each time a photographic film loaded in a camera is advanced by a predetermined length. A measuring device measures a pulse period between previous and current pulses when the current pulse is generated. A calculating device calculates, from this measured result, a predicted pulse period between the current pulse and next pulse, and determines the data recording timings. In response to the data recording timings, a recording device is driven to record the data on the film until the next encode pulse is generated. In recording N bits during the encoded pulse period, the recording timing for each bit is determined from a time duration obtained by dividing the predicted pulse period by N. 
     According to a preferred embodiment, the encoded pulse generating device generates a plurality of pulses synchronously during advancement of the film through one frame. The pulse period is measured to obtain an allowable range of a pulse period. The allowable range may be determined by a preset variance, the upper and lower limits of pulse periods, or through other methods. When the pulse period between the previously generated pulse and presently generated pulse enters this range, the recording is driven to record data. If the film is advanced without causing the pulse period to enter the predetermined range, and the film advance amount left within the length of one frame is not long enough for recording the data, the film is rewound to the initial position before the frame advance, and thereafter it is again advanced while the data is recorded. 
     According to the present invention, by using the period between previously measured pulses, the generation timing of the next pulse is predicted. In accordance with the predicted data, the data recording timings are determined. As a result, even if data of a plurality of bits is recorded in a shorter period than the pulse period, it is possible to maintain the record length of each bit, so that read errors by a photographic printer or the like can be minimized. It is possible to record N bits during one pulse period by using bit recording timings obtained by dividing the pulse period between the current and predicted next pulse by N. Since the film advance speed can be monitored from the pulse period, it is possible to start data recording after the film advance speed becomes constant. If the data recording is difficult because of an unstable film advance speed, the film is rewound and the data is recorded again. Therefore, a film advance function without a corresponding data recording function can be prevented. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The above and other objects and advantages of the present invention will become apparent from the detailed description of the preferred embodiments when read in conjunction with the accompanying drawings, in which: 
     FIG. 1 is a schematic diagram illustrating a camera using a data recording apparatus according to the present invention; 
     FIG. 2 is a cross sectional view of a light recording head; 
     FIG. 3 is a plan view of a photographic film having a recording area for photographic data; 
     FIG. 4 is a timing chart for film advance next; 
     FIG. 5 is a flow chart illustrating the process of data writing; 
     FIG. 6 is a timing chart illustrating a relationship between ENC pulses and data write timing pulses; 
     FIG. 7 is a flow chart illustrating the process of obtaining a predicted pulse period according to a third embodiment; 
     FIG. 8 is a flow chart illustrating an example of the process of obtaining a predicted pulse period according to a fourth embodiment; and 
     FIG. 9 is a flow chart illustrating the process of advancing a film under a condition wherein the film advance speed is not constant. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring to FIG. 1, a film take-up motor 3 is disposed inside a take-up spool 2. The motor 3 is driven by a motor driver 6 in response to a command from a microcomputer 5. When the back door of the camera is closed after a film cassette 28 is loaded therein, the microcomputer 5 causes the motor 3 to rotate. Rotation of the motor 3 is transmitted to the take-up spool 2 via a transmission mechanism 7. A portion of the photographic film 8 pulled out from the film cassette 28 is wound on the outer circumference of the take-up spool 2, to set the first frame in opposition to an exposure opening 19. After the first frame is exposed in response to actuation of a shutter, the motor 3 is again driven in response to a signal from the microcomputer 5, so that the film 8 is advanced by one frame to set the second frame at the back of the exposure opening 19. 
     The film 8 of this embodiment has one perforation 8a formed therein per each frame. Three or four perforations 8b are formed in the leader portion of the film 8 with a short interval therebetween. These perforations 8b are captured by claws 2a of the take-up spool 2. A reflection or transmission type photo sensor 11 for detecting a passage of each perforation 8a is mounted in the film passage of the camera. When the film is wound, the light projector of the photo sensor 11 emits an electromagnetic wave having a wavelength which does not expose the film, e.g., an infrared wave. When the light receiver of the photo sensor 11 detects the perforation 8a, a perforation signal generator 12 supplies a perforation (PF) pulse to the microcomputer 5 which in turn sends a stop signal to the motor driver 6 to quickly stop the motor 3. 
     A 135 type photographic film which is commercially available has eight perforations per frame formed at a constant pitch. For such a film, the number of PF pulses is counted and film winding is stopped when eight pulses are counted. When the film cassette 28 is loaded in the camera, the leader portion advances toward the take-up spool 2. During this advancement, it is possible to evaluate the quality of the film loading procedure by checking whether or not intermittent PF pulses are generated. 
     A driven roller 14 is in contact with the film 8, and rotates along with the advancement of the film 8 without any slip. An encoded disk 15 is coupled to the driven roller 14, and rotates integrally with the driven roller 14. A plurality of radial slits 15a are formed in the encoded disk 15 at a constant pitch. Each time the photo-interrupter 16 detects the passage of a slit 15a of the encoded disk 15 as it rotates, an encode pulse generator 17 generates an encode (ENC) pulse which is input into the microcomputer 5. As described above, since the driven roller 14 rotates with the advance of the film 8, an ENC pulse is generated each time the film 8 is advanced by a predetermined amount. 
     A recording head 20 is mounted just outside of the camera exposure opening 19. As shown in FIG. 2, the recording head 20 can be a light recording head 20&#39; which is constructed of a housing 30, two LEDs 31 and 32 mounted within the housing 30, and a mask plate 33. Alternatively, recording head 20 can be a magnetic head and other portions of the camera and film can be suited for magnetic reading and writing of data. Two slits are formed in the mask plate 33 to shape light emanating from LEDs 31 and 32 into a laterally elongated form. The recording head 20 is driven by an appropriate driver 21 as the film is wound onto take-up spool 2, and as shown in FIG. 3, records photographing data in two hatched stripe areas 37 which are above each frame. As described above, the photographing data includes exposure control data (shutter speed, aperture value, and the like) and print instruction data (aspect ratio, main subject position, type of illumination light source, and the like). In this embodiment, a data ROM 22 storing binary coded exposure control data is accessible by the microcomputer 5 for writing exposure control data. 
     A program ROM 23 stores sequence programs for controlling the above-described various sequences and the data write operation which is described below. A RAM 24 is used as a work area for temporarily storing programs and flags necessary for executing a photographing sequence and a data write operation. A frame counter 25 counts the number of exposed frames of the film 8. Both LEDs 31 and 32 are used in the preferred embodiment. However, a single LED may be used depending upon the amount of data to be written. Also, a magnetic data recording device may be utilized. 
     Similar to the leading portion-of the film 8, the trailer portion also has three or four perforations formed therein with a short interval therebetween. When the film 8 begins to be wound up after the final frame was exposed, the number of ENC pulses is counted to measure a film advance amount. If perforations are successively detected by the photo sensor 11 before the film is advanced an amount corresponding to one frame length, the transmission mechanism 7 switches to a film rewinding state in response to a command from the microcomputer 5. In such a state, a drive shaft 27 is rotated by virtue of motor 3 and transmission mechanism 7 in the rewinding direction to rewind the exposed film 8 into the cassette 28. A completion of the rewinding operation is detected in response to a signal from the photo sensor 11 (e.g., pulses corresponding to the leader perforations or a constant signal corresponding to the absence of film), and the motor 3 is stopped upon this detection. A clutch mechanism, which is coupled to microcomputer 5, may be provided in the transmission mechanism to selectively switch between the winding and rewinding states by changing the rotation direction of the motor 3. 
     A data write function of the camera having the above described structure will be described below. FIG. 4 shows an example of the timings of PF and ENC pulses generated when the film 8 is advanced by one frame. When an exposure completion signal is supplied from the shutter device to the microcomputer 5, the motor 3 starts rotating to wind the film 8. When a PF pulse is detected during the winding operation, the motor 3 is stopped. During advancement of the film 8, each time the film 8 is advanced by a preset distance, one ENC pulse is generated. Consider now the case where ten ENC pulses are generated during a one frame advancement. If data consisting of ten bits is to be recorded during the one frame advancement, each data bit is optically recorded by actuating the LEDs 31 and 32 in accordance with the timing of each ENC pulse generation. Namely, a period between two consecutive ENC pulses is predicted, and during this predicted period, the LED&#39;s 31 and 32 are driven appropriately. In this manner, each bit can be recorded at the correct position while maintaining a constant bit record length. 
     However, if the data to be recorded during one frame advance consists of more than 10 bits, particularly if several bits are to be recorded during a period between two ENC pulses, it is not possible to use the ENC pulse timing as the data write timing and determine the bit record length while predicting the period between two consecutive ENC pulses. In such a case, it is conceivable to obtain timings based on clock pulses from the microcomputer 5. However, as shown in FIG. 4, since the film roll diameter at the take-up spool 2 increases as each frame is exposed, the advance speed of the film 8 also increases. The time ΔS required for winding the film by one frame is not constant for all frames, but is reduced so that: 
     
         ΔS1&gt;ΔS2&gt;ΔS3 
    
     (wherein ΔS1 is the time required for advancing the first frame, ΔS2 is the time for the second frame etc..). 
     It is therefore very difficult to determine the drive timing of the light recording head 20 in accordance with the number of clock pulses counted from the time when, for example, the exposure completion signal is generated. 
     According to the present invention, timing pulses for driving the light recording head 20 are basically determined from the counts of ENC pulses and clock pulses, as illustrated in the timing chart of FIG. 4 and the flow chart of FIG. 5. When the exposure completion signal is supplied to the microcomputer 5, a B flag representing an enable state of data recording is set to 1, a counter for counting the number of ENC pulses is initialized to 0 (ENC count M →0), and a data recording bit position is initialized to 1 (bit position N→1). 
     Each time the film 8 is advanced by a predetermined length, an ENC pulse is generated. The number of ENC pulses is accumulated as an ENC count M. Data recording is not effected until the number of ENC pulses reaches MO (in this embodiment, MO=4) because the pulse period is not constant during the initial film winding period during which the rotation of the motor 3 is unstable. Of course, the actual value of Mo will vary depending on the specific structure of the camera. However, this value can be easily determined by preliminarily counting the number of ENC pulses before advancement speed becomes constant. Each time an ENC pulse is detected, the pulse period D between the detected ENC pulse and the previous ENC pulse is measured, and the new pulse period replaces the previous pulse period. As the number of ENC pulses increases, the pulse period D generally becomes shorter. The motor 3 of the preferred embodiments has been found to run substantially at a constant speed when the ENC count M reaches 4. 
     When the ENC count M reaches 4, the microcomputer 5 calculates a predicted pulse period PRE.D between the presently detected ENC pulse and the next ENC pulse to be detected. This prediction calculation is carried out by multiplying 0.9 by the pulse period D between the previously detected (third) ENC pulse and the presently detected (fourth) ENC pulse. The multiplication by 0.9 is determined on the assumption that the rotation speed of the motor 3 increases to the steady state of constant speed rotation, and that the film advance speed increases as the film wound diameter at the take-up spool 2 increases. If these affects are negligibly small, the previous pulse period D may be used as the current predicted pulse period PRE.D. Also, any other appropriate algorithm may be used to calculate PRE.D. 
     The predicted pulse period PRE.D is divided by the number of bits (in this embodiment, NO=5) to be recorded during the predicted pulse period, to obtain a unit bit record time ΔD. If 10 bits are to be recorded during one ENC pulse period, the predicted pulse period PRE.D is divided by 10, to obtain the unit bit record time ΔD, i.e., the time during which the LED&#39;s 31 and 32 are driven. The remainder of the division may be rounded down, rounded up, or handled as desired. The number of clock pulses corresponding to the predicted pulse period PRE.D is significantly larger than the number of bits to be recorded, because the frequency of clock pulses is high, generally in the order of several MHz. Therefore, the remainder of the division for these clock pulses can be neglected when ΔD is divided by the period of the clock pulses in order to obtain the proper data recording timing with respect to the clock pulses. 
     With the unit bit record time ΔD thus obtained, data recording starts from the start bit and is performed sequentially at following bit positions each time the unit bit record time ΔD lapses based on the clock pulses. For example, as shown in FIG. 6, during an ENC pulse period, data 11010 is recorded by LED 31 and data 01001 is recorded by LED 32. The microcomputer 5 reads data from the data ROM 22 and supplies each binary data bit to the LED driver 21 each time the unit bit record time ΔD lapses. The LED driver 21 turns on LED 31 for the binary data bit 1, and turns off LED 32 for the binary data bit 0. In this manner, LEDs 31 and 32 are appropriately driven during the unit bit time ΔD in accordance with their corresponding binary data patterns stored in ROM 22, to record the data patterns as latent photographic images as shown in FIG. 6 in the areas 36 and 37 on the film 8 (see FIG. 3). 
     After the five bits of data have been recorded during the predicted pulse period PRE.D, a check is conducted to determine whether data is to be further recorded. For example, if 16 bits of data are to be recorded during one frame advance, after the generation of the fifth ENC pulse, similar operations are performed for the data write of the sixth to tenth bits. The predicted pulse period PRE.D and unit bit record time ΔD for this case are obtained based upon the detected pulse period D between the fourth and fifth ENC pulses. Similarly, for the data of the eleventh to fifteenth bits, the detected pulse period D between the fifth and sixth ENC pulses is used to estimate a PRE.D. Immediately after the detection of the seventh ENC pulse, the data of the sixteenth bit is recorded during the first unit bit record time ΔD. After all the data corresponding to one frame is recorded, the B flag is reset to 0. Thereafter, although counting of ENC pulses continues, the data recording is not effected while the film is wound. When the PF pulse is detected while winding the film, the motor 3 is stopped to complete the winding of one frame. The number of ENC pulses generated during one frame winding is accumulatively counted irrespective of whether data is recorded or not. In the preferred embodiment, 10 slits in the encoded disk 15 correspond to one frame on the film 8 and thus the count reaches a constant value 10 irrespective of the film advance speed and film roll diameter at the take-up spool 2. Therefore, the ENC pulse count may be used for the film advance control. For example, when the tenth ENC pulse is detected, the motor 3 is decelerated, and thereafter upon detection of the PF pulse, the motor 3 can be instantly stopped. 
     The similar operations are repeated each time the exposure completion signal is inputted to the microcomputer 5, to thereby record various data corresponding to each of the frames in the form of latent photographic images. In the above embodiment, the film advance amount is determined based on the number of generated ENC pulses and the film advance speed is monitored from each pulse period between two ENC pulses. Using this film advance information, the timing for data recording is obtained. It is therefore possible to record data even if the data has a number of bits which is far greater than the number of ENC pulses generated during advancement of one frame, irrespective of the characteristics of the motor and the film roll diameter at the take-up spool 2. If a film having a plurality of perforations per frame is used, passages of perforations photoelectrically or mechanically detected can be used in place of the ENC pulses. 
     In the above embodiment, ten ENC pulses are generated during one frame advance for simplicity of description. However, more ENC pulses can be generated during one frame advance, without using expensive parts for the encoded disk 15 and photo-interrupter 16. Also, in place of the prediction calculation &#34;PRE.D=D×0.9&#34; shown in the flow chart of FIG. 5, the following operation can be performed to calculate the predicted pulse period PRE.D more precisely, by a construction which generates several tens of ENC pulses during advancement of one frame. 
     In the first embodiment, the predicted pulse period PRE.D is calculated based upon only the most recently detected pulse period D3 for example. However, in a second embodiment, a plurality of pulse periods D detected previously are used for calculating the predicted pulse period PRE.D more precisely. In this case, the plurality of pulse periods D detected previously are weighted by weighting coefficients so as to lessen the influence of the earlier pulse periods to the predicted pulse period PRE.D, because it is assumed that, the older the detected pulse periods, the less the influence thereof on the future pulse period. To this end, the weighting coefficients K i  satisfying the following expressions (1) and (2) are utilized, where i is a positive integer, and M is the number of ENC pulses generated previously: ##EQU1## 
     The predicted pulse period PRE.D can be calculated by the following expression (3), where D i  is an i-th pulse period between ENC pulses, and D M-1  is the latest pulse period. As the weighting coefficients K i , a geometrical series given by the expression (4) may be used. ##EQU2## 
     If Q=0.5 and M approaches infinity, the denominator of the expression (4) becomes &#34;1&#34; and so K i  =Q M-i . Therefore, the predicted pulse period PRE.D is given by the following expression (5). Using f=M-1, the expression (5) is rewritten to the expression (6). ##EQU3## 
     The expression (6) indicates that a new predicted pulse period PRE.D can be calculated by multiplying a factor Q (=0.5) by a sum of the present pulse period D and the previous predicted pulse period PRE.D. Namely, in obtaining a new predicted pulse period PRE.D from a plurality of pulse periods D previously measured, the previous predicted pulse period PRE.D can be used. With this calculation, it is not necessary to calculate a product sum of a plurality of past pulse periods, and thus it is possible to calculate the predicted pulse period PRE.D in a short time. This is very advantageous in a real time control system as in the case of the present invention. 
     The predicted pulse period PRE.D obtained in this manner may be multiplied by 0.9 for the same reasons as described above with respect to the first embodiment, to obtain the final predicted pulse period. Note that the value M does not actually approach infinity. However, the denominator of the expression (4) can be assumed to be substantially equal to 1, assuming that the number of ENC pulses to be detected during one frame of advancement is relatively high and the above calculation is performed after M&gt;32, for MO-33 in the flow chart of FIG. 5 after the initial advance period. 
     Instead of the calculation using the weighting coefficients, an average value of a plurality of pulse periods D obtained in the past can be used for obtaining the predicted pulse period PRE.D. FIG. 7 illustrates the calculation of obtaining the predicted pulse period PRE.D by using an average value of eight pulse periods D measured in the past according to a third embodiment. For the execution of this calculation, a ring buffer memory (RBM) and an address pointer are provided in operative association with the microcomputer. The ring buffer memory stores the eight previously detected pulse periods D. The address pointer sequentially points to the start address of the memory area of the ring buffer memory storing the eight words of pulse period data (in the Oth memory area to 7th memory area), each time the ENC pulse is detected. After the 7th memory area, the Oth memory area is pointed. 
     In FIG. 7, &#34;SUM&#34; represents a sum of the eight words of data stored in the ring buffer memory, and &#34;RBM(P)&#34; represents the oldest word of data stored in the memory area within the ring buffer memory indicated by the address pointer. When the ENC pulse is detected, the oldest data is subtracted from the value &#34;SUM&#34;, and the latest measured pulse period D is added to the subtracted result. The latest measured pulse period D is overwritten in the memory area indicated by the address pointer, i.e., in the memory area for storing the oldest data. The value &#34;SUM&#34; is divided by the number of data words 8 to obtain the predicted pulse period PRE.D. 
     The predicted pulse period PRE.D as obtained is multiplied by 0.9, for the same reasons described above with respect to the first embodiment, to obtain the final predicted pulse period. This multiplication by 0.9 may be omitted if the change in the film advance speed is small enough to be neglected. Thereafter, the address pointer is incremented to change the position of the memory area to be pointed, to the area where the oldest data word was stored in the ring buffer memory. If the address increment is performed when the address pointer indicates the highest start address &#34;7&#34; the value of the address pointer automatically resumes the lowest start address 0. This embodiment utilizes eight data words at a minimum when starting the calculation. However, the calculation of the predicted pulse period starts, after 32 ENC pulses are detected after the advance start period, and thus this does not present a problem. 
     In the embodiments described above, the data recording is adapted to start after the number of ENC pulses generated after the exposure completion reaches a predetermined number. Accordingly, the data recording can be effected substantially, at the same position within a length of a frame. However, it is actually not necessary to maintain a position within a frame length for effecting all of the data recording within the frame length, because the initial several bits of the recorded data are used as start bits, which are easily detected. 
     Even if a predetermined number of ENC pulses are detected indicating the end of the initial advance period, the film advance speed may not always be stable. In consideration of such a situation, a fourth embodiment, which will be described below, is provided which has an additional process of statistically monitoring the film advance speed. 
     In the fourth embodiment whose specific process is illustrated in the flow chart of FIG. 8, the predicted pulse period PRE.D is determined after it is judged that the film advance speed has become constant. For such a judgement, the &#34;SUM&#34; of eight previously measured pulse periods D and the square sum &#34;SUMS&#34; of these eight pulse periods are used. Similar to the embodiments described above, an average value of eight pulse periods D measured in the past is obtained as the predict pulse period PRE.D, and the square of it is calculated. A variance VA is calculated from the following expression. 
     
         VA-(SUMS/8)-PRE.D.sup.2 
    
     If the variance VA becomes smaller than a predetermined value X it is determined that the film advance speed has become stable. When this judgement is obtained, it is checked whether the number of ENC pulses detected so far is equal to or larger than the initial setting value MO (e.g., 32) and whether the initial advance period with possible unstable rotation of the motor has passed. If these conditions are met, the predicted pulse period PRE.D is multiplied by 0.9 to obtain the final predicted pulse period PRE.D. A Bw flag is a flag which is reset to 0 at the initialization at the start of the flow chart shown in FIG. 5, and set to 1, when PRE.D is determined. Even if B the flag is set to 1, data recording is inhibited if the Bw flag is 0. The succeeding processes are the same as described previously with respect to the other embodiments. 
     In this embodiment, if the film advance speed does not become stable for some reason, the data recording procedure will not begin. If the start timing of the data recording is delayed extremely, data might be incompletely recorded during advancement of one frame. Even if all data can be recorded, it might be recorded on an area outside of the normal data read area. In order to solve this problem, as shown in FIG. 9, if it is judged during the one frame advance with the Bw flag=0 that the film has been advanced to the extent that the ENC count M becomes Mx (e.g., Mx=48) and normal data recording is impossible, then the B flag, which was set to 1 at the initialization of the main routine shown in the flow chart of FIG. 5, is reset to 0 to first inhibit the execution of the data recording. 
     Then, the microcomputer 5 sends a switching signal to the transmission mechanism 7 to drive the drive shaft 27 in the rewinding direction and rewind the film by one frame into the cassette. When the PF pulse is detected, i.e., when the film has been rewound to assume the state immediately before the start of one frame advance, the rewinding operation is stopped. The microcomputer 5 causes the transmission mechanism 7 to take the film winding direction to once again start the film advance operation for the same frame. Thereafter, the control returns to the processes immediately after the generation of the exposure completion signal as shown in FIG. 5. 
     If the film advance speed is unstable even after a one frame advance operation progresses to some extent, the calculated predicted pulse period PRE.D is not reliable. In this embodiment, it is possible in such a case, to stop the film advance automatically, rewind the film to the initial position, and once again begin the data recording process. If the processes shown in FIG. 9 are executed a plurality of times and the film advance speed does not become stable, the film is rewound further by an amount in a range of 0.5 to 1 full frame from the initial one frame advance position, and then the film is continuously wound. In this case, when the frame returns to the data recording position, the film advance speed will most probably have a constant speed. In such a manner, all data can be recorded within the length of the frame at the proper recording position. If the film advance speed does not become constant even with this process, the rewinding amount may be increased and a similar operation is carried out. 
     The present invention has been described in connection with preferred embodiments. The number of ENC pulses to be generated during one frame advance, and the number of data bits to be recorded during the pulse period between two consecutive ENC pulses, among other values, can be set as needed. Means for generating ENC pulses is not limited only to the combinations of encoded disk and photo-interrupter, and film perforations and photo-interrupter. For example, ENC pulses may be generated by reading a magnetically recorded stripe with magnetic areas and non-magnetic areas disposed alternately at a constant pitch on the edge portion of a film, by using a magnetic head. Furthermore, as described previously, a magnetic layer may be formed on one side of a photographic film in the shape of stripe, or on the whole area of the base layer, to record data on this magnetic layer by using a magnetic recording head connected via a driver to the microcomputer 5. 
     Although the present invention has been described with reference to the preferred embodiments shown in the drawings, the invention should not be limited by the embodiments but, on the contrary, various modifications, changes, combinations and the like of the present invention can be effected without departing from the spirit and scope of the invention as defined by the appended claims.