Method of controlling a paper feeding device in a printer

Abstract: Disclosed are a control device and a control method for a printer of the type including means (21, 31) for performing printing, means (9, 11, 15, 19, 27) for performing paper feeding and a paper detector (13) and being configured so that a paper still has a given printable amount when the output of the paper detector (13) changes from a paper pre­ sence indicating state to a paper absence indicating state. The control device comprises means (9) for judging whether additional printing is possible or not, on the basis of the given printable amount and the amount of paper feed that has been actually performed after the output of the paper detector (13) once changed to the paper absence indicating state, and means for permitting the operations of the prin­ ting performing means and the paper feeding performing means irrespective of the output of the paper detector while printing is being judged to be possible.

Description: This invention relates to a method of controlling a paper feeding device in a printer. Printers generally include a paper detector for detecting whether a paper has been set in a printable state. This paper detector is generally disposed in front of a print head with respect to the feed direction of the paper. Accordingly, when the output of the paper detector changes from a paper present signal to a paper absent signal, there still remains a portion of the paper corresponding to the distance between the print head and the paper detector (this portion of the paper will be referred to as the override amount in the following). To permit printing on the portion of the paper corresponding to the override amount after the output of the paper detector has changed to a paper absent signal, a conventional printer continuously monitors the output of the paper detector and, while it indicates paper absence, continues printing on the paper until a maximum printable line count within the override amount has been reached. When the output of the paper detector changes to a paper present signal, the printer, considering that new paper has been set, terminates the print control action with respect to the paper just printed and starts to eject it. However, since the paper detector generally comprises a microswitch which is actuated by the weight of the paper or a photo transistor unit which is actuated when light is interrupted, the output level of the paper detector tends to include chattering caused by a vibration of the paper, printer, etc. Accordingly, if such chattering arises in the course of execution of a print control for the remaining override amount after the output of the paper detector has changed to a paper absent signal, a paper present signal may be erroneously recognized so that a paper print action is performed despite of a non-printable state. From that, the defect results that the remaining printable space after paper absence has been detected varies from paper to paper. The document US-A-4,671,683 discloses a control device of a printer including a printing device, a paper feeding device and a microswitch for detecting presence or absence of paper, where the printer is configured so that the paper still has a given printable amount when the output of the microswitch changes from a state indicating paper presence to a state indicating paper absence. In this prior art, when the microswitch indicates paper absence, a calculation is performed on whether the rest of the text still to be printed completely fits into the given printable amount. If this is the case, printing is performed whereas otherwise printing is interrupted. The document EP-A-0 072 709 discloses a method and a control device of a printer including a printing device, a paper feeding device and an optical photosensor for detecting the presence or absence of a paper, where the printer is configured so that the paper still has a given printable amount when the output of the paper detecting means changes from a state indicating paper presence to a state indicating paper absence. Each time the photosensor delivers a signal indicating paper absence, a subtraction counter is set to the given printable amount still remaining on the paper at the moment of paper end detection. Each time the paper is fed by a unit amount, the count value of the subtraction counter is reduced by one, and an arithmetic circuit judges whether additional printing is possible or not on the basis of the given printable amount originally set in the subtraction counter and the amount of paper feed actually performed, their difference being compared to the sum of the height of the next line to be printed and the distance between the current line and the next line. The document JP-A-59 52 685 discloses a printer comprising a detector for detecting presence or absence of the paper. When absence of paper is detected after an N-th line has been printed and prior to printing an (N+1)th line a residual paper feed amount is calculated to be compared with a paper residual amount. The previous paper feed amount is calculated by counting a drive pulse applied to a motor. Thereby absence of paper is displayed only when a final line actually can not be printed. It is an object of the present invention to provide a method of controlling a paper feeding device in a printer which allows to make certain a remaining printable space after paper absence has been detected. This object is achieved with a method as claimed. The invention will be explained in detail below with reference to the drawings which show a specific embodiment only and in which: Fig. 1 is a general block diagram showing an embodiment of the control device, Figs. 2(A) and (B) are a perspective view and a side view, respectively, showing the relationship in the arrangement between a print head and a paper detector, Fig. 3 is a circuit diagram showing the electrical connection between the paper detector and a CPU, and Fig. 4 is a flowchart for explaining the operation process of the CPU used in the embodiment of Fig. 1. Fig. 1 shows the general structure of a device suitabe for executing the method according to a preferred embodiment of the present invention. A printer control device 1 is connected via an interface (I/F) section 3 with an external host computer 5. Supplied from the host computer 5 are print data, print control commands (e.g. paper feed control commands), etc. Such data are temporarily stored in the I/F section 3 or in a RAM 15. The I/F section 3 is connected via an address/data bus 7 with a CPU 9. The CPU 9 is connected via the bus 7 with a ROM 11, so that the print action is controlled in accordance with a control program stored in the ROM 11. In control operation, the CPU 9 reads and interprets the data stored in the I/F section 3 and, if necessary, refers to the signal from a paper detector 13, a variety of print control data previously stored in the ROM 11 or RAM 15, etc. Then, the CPU 9 performs a calculation on such data in accordance with the control program. The CPU 9 sends various control commands through the bus 7 to a CR motor drive circuit 17, a PF motor drive circuit 19, and a head drive circuit 21. The CR motor drive circuit 17 drives a CR motor 23 in accordance with the command from the CPU 9, resulting in a carriage 25 being shifted. The PF motor drive circuit 19 drives a PF motor 27 resulting in paper 29 being fed. Generally, both the CR motor 23 and the PF motor 27 are comprised of a step motor. In this case the number of steps of the step motor determines the amount of shift of the carriage and the amount of feed of the paper, respectively. The head drive circuit 21 drives a print head 31 attached to the carriage 25, to perform printing. Printing is performed while the carriage 25 is shifted whereas paper feeding is performed while the carriage 25 is at a stop. The RAM 15 includes memory areas for holding a non-executed paper feed amount A, a remaining printable amount LL and a no-paper flag PE. Further, the RAM 15 has memory areas for holding format data, such as a line pitch, a character magnifying factor and a paper rear edge marginal length. It should be noted that the line pitch and the rear edge marginal length are given in the form of a step count to the PF motor 27. The non-executed paper feed amount A and the remaining printable amount LL are given in the form of a line pitch count. As illustrated in Figs. 2 (A) and (B) the paper fed from a paper supply guide 33 is inserted between a platen 35 and a paper feed roller 37. The paper 29 is fed upward along the surface of the platen 35 in front of the print head 31 in response to a rotation of the platen 35 driven by the PF motor 27. The feeding of the paper is performed in units of the line pitch that has been previously stored in the RAM 15 in the form of a step count for the PF motor 27 as mentioned before. When the paper feeding is completed, the carriage 25 is shifted along guide rods 39 and the print head 31 is controlled to perform the printing of one line. Generally, the line printing and the paper feeding are repeated alternately. In the present embodiment, the paper detector 13 is made of a microswitch which is attached to the back side of the paper supply guide 33 and has a detecting pin 13a projecting from the surface of the paper supply guide 33. Thus, when paper 29 is set onto the paper supply guide 33 the switch is turned on due to the weight of the paper 29, and it is turned off when the rear edge of the paper passes over the detecting pin 13a in the course of the paper feeding. A detecting element other than a microswitch, for instance an optical detecting element such as a photo transistor may be used as the paper detector 13 instead of the microswitch. As illustrated in Fig. 3 the paper detector 13 is connected between a DC power source terminal +V and ground and supplies a low-level signal when it is ON (paper present signal) and a high-level signal when it is OFF (paper absent signal) to an input port 41 of the CPU 9. Referring to Fig. 2 (B) again, when the rear edge of the paper 29 passes over the detecting pin 13a, the output of the paper detector 13 changes from the paper present signal to the paper absent signal. At this time, a paper portion whose length corresponds to an override amount L still remains to be printed upon on the upstream side of a paper retaining plate 40 disposed immediately before the print head 31. The override amount L is a fixed value depending on the relative position between the print head 31 (or the retaining plate 40) and the paper detector 13. The override amount L is previously stored in the ROM 11 or RAM 15 after having been converted into the form of a step count of the PF motor 27. The number of lines (the printable line count) actually printable with in the override amount L varies depending on the line pitch count, the character magnifying factor and the paper rear edge marginal length. Such format data are supplied from the host computer 5 in advance of the print data and print control data and are previously stored in a dedicated memory area of the RAM 15. The operation of the embodiment explained thus far will be described with reference to the operation processing routine of the CPU 9 shown in Fig. 4. This routine is executed each time a control command instructing a paper feeding is applied to the CPU 9. First, the paper feed amount indicated by the control command is stored in the RAM 15 as the non-executed paper feed amount A (step S1). By checking the no-paper flag PE held in the RAM 15 it is then judged whether paper was absent or present at time of the last paper feeding (step S2). As will be described hereinafter, the no-paper flag PE is set when the output of the paper detector 13 changes from the paper present to the paper absent signal and is kept in the set state until the amount of paper feeding from the time when the no-paper flag PE was set exceeds the maximum printable line count within the override amount L. When in step S2 the no-paper flag PE is found to be in set state, the control goes to step S10 hereinafter described in order to perform the paper feeding in a range not exceeding the printable line count (remaining printable amount) LL within the override amount L. On the other hand, when the no-paper flag PE is in a reset state, control advances to step S3. In step S3 the PF motor 27 is driven by one unit paper feed amount (one line pitch), and then "1" (the just executed paper feed line count) is subtracted from the non-executed paper feed amount A in step S4. Then the output of the paper detector 13 is checked in step S5. When its output indicates that paper is still present, the non-executed paper feed amount A is checked to see if it is "0" (step S6). When it is not "0", control returns to step S3 and one unit paper feeding is performed again. While the output of the paper detector 13 indicates paper presence, this processing sequence is repeated to perform the paper feeding. Finally, when step S6 reveals that the non-executed paper feed amount A has reached "0", the paper feeding ends. When paper absence is detected in step S5, that is when the output of the paper detector 13 changes to the paper absent signal upon the one line feeding of the paper in step S3, the maximum printable line count within the override amount L is set (for initialization) as the remaining printable amount LL (step S7). It should be noted that the maximum printable line count is the maximum number of lines that can be printed within a portion of the paper corresponding to the override amount L minus the paper rear edge marginal length (here it is assumed that the paper rear edge margin is smaller than the override amount L). Concurrently with the initiative setting of the remaining printable amount LL, the no-paper flag PE is changed from the reset state to the set state (step S8). Following this initiative processing, the non-executed paper feed amount A is checked in step S9. When the non-executed paper feed amount A is "0", the processing routine comes to an end since the paper has actually been fed to the amount instructed by the control command. On the other hand, when it is detected in step S9 that the non-executed paper feed amount A is still not "0", control goes to step S10. As a result, the paper feeding is successively performed while monitoring the remaining printable amount LL. Specifically, first the PF motor 27 is driven by one unit paper feed amount (step S10). Then, "1" (the just executed paper feed line count) is subtracted from the non-executed paper feed amount A (step S11) and from the remaining printable amount LL (step S12). Then, it is checked whether the non-executed paper feed amount A has become "0" (step S13). When the non-executed paper feed amount A is still not "0", the remaining printable amount LL is checked in step S14. When the amount LL is not "0", this meaning that there still remains a printable space within the override amount L, control returns to step S10 to perform the next one line paper feeding. In this way, the paper feeding is repeated until either the non-executed paper feed amount A or the remaining printable amount LL becomes "0". When it is detected in step S13 that the non-executed paper feed amount A has reached "0", the following processing is performed to terminate the paper feeding. First, the remaining printable amount LL is checked in step S15. When the remaining printable amount LL is "0", i.e. when the bottommost line of the paper 29 has been reached, the no-paper flag PE is reset (step S16). After printing on the bottommost line has been performed (step S17) the PF motor 27 is driven to eject the paper 29 (step S18), and the print control processing is stopped (step S19). If desired, step S18 may be omitted and the processing stopped immediately after printing the bottommost line. After the processing has come to a stop a new paper 29 is set in the printer. With the next print control command from the host computer 5 the print control is restarted. When it is detected in step S15 that the remaining printable amount LL is not "0", that is when the bottommost line of the paper 29 has not been reached yet, the paper feeding is terminated and the no-paper flag PE kept in the set state in preparation for the successive execution of the print control in accordance with the next control command. When it is detected in step S14 that the remaining printable amount LL is "0", that is when the bottommost line of the paper 29 has been reached before the instructed amount of paper feeding is completed, the no-paper flag PE is reset (step S20), the PF motor 27 is driven to eject the paper 29 (step S21), a condition is set (step S22) such that the paper feeding corresponding to the non-executed paper feed amount A will be performed before restarting of the print control with respect to a new paper 29, and then, the processing comes to a stop (step S19). If desired, steps S21 and S22 may be omitted such that the processing comes to a stop immediately after step S20. As described above, when the output of the paper detector 13 once changes to the paper absent signal, the no-paper flag PE is set (steps S5 and S7), and then it is only the no-paper flag PE which is checked in step S2 and no longer the paper detector 13. Accordingly, while the no-paper flag PE is in the set state the paper feeding is performed (step S10) until either the instructed paper feed amount has been performed (step S13) or the bottommost line of the paper is reached (step S14 or S15). Accordingly, if chattering occurs after the paper detector 13 once output the paper absent signal any erroneous recognition with respect to the presence of absence of paper will not result so that the remaining printable space will be the same for each paper without variation. As a modification of the explained embodiment, a total executed paper feed amount M accumulated after paper absence has been detected, may be introduced. In this case, the total paper feed amount M is reset to "0" when the output of the paper detector 13 changes to the paper absent signal. Thereafter, "1" is added to the total paper feed amount M without performing the detecting of the paper each time one unit paper feeding has been performed, the no-paper flag PE is reset when the total paper feed amount M reaches the maximum printable line count within the override amount L, and at this moment, the paper is ejected and the print control stopped. Although a preferred embodiment of the present invention has been described above, various modifications may be made thereto. For example, although in the explained embodiment the non-executed paper feed amount A, the remaining printable amount LL and a total executed paper feed amount M are stored in the RAM 12 and the increasing/decreasing of these values is performed by means of the CPU 9 in accordance with software, counters may be used for storing and processing such values. In this case, the volume of processing dependent on the software decreases, so that the speed of control processing can be enhanced. Although in the explained embodiment the values A, LL and M are converted into the form of a line pitch count, these values may be converted into the form of a step count of the PF motor 27. Further, although in the explained embodiment the maximum printable line count within the override amount L is calculated when paper absence is detected, on the basis of the override amount L, the paper rear edge marginal length and the line pitch (step S7 in Fig. 4), where the paper rear edge marginal length and the line pitch are fixed, the maximum printable line count is also a fixed value so that the foregoing calculation processing can be omitted by previously setting these fixed values in the ROM 11 or RAM 15. Further, where the host computer is managing the paper rear edge marginal length and/or the line pitch so that the printer needs not to consider such values, the override amount L can be used in place of the maximum printable line count without modification.

Claims: A method of controlling a paper feeding device in a printer for printing on a remaining portion of paper still to be advanced beyond a printing device when the absence of paper is detected by a paper detecting device (13), said method comprising the steps of: (a) setting a paper end flag (PE) when an output of said paper detecting device (13) changes from a state indicating paper presence to a state indicating paper absence, said paper end flag once set being independent of the output of the paper detecting device (13), and storing a given printable amount (L) within said remaining portion as a first value, (b) storing in response to a paper feed command the amount of paper feed instructed by said command as a second value (A), (c) checking in response to a paper feed command whether said paper end flag is set, and if so, (d) controlling said paper feeding device to advance the paper by a unit amount, and comparing an accumulated value of such unit amounts with both the first and the second value, (e) judging whether either a first difference (LL) between said first value and said accumulated value or a second difference between said second value (A) and said accumulated value equals zero, and (f) repeating steps (d) and (e) if step (e) reveals that neither the first nor the second difference equals zero, while (g) repeating steps (c) to (e) in response to another paper feed command when step (e) reveals that the second difference equals zero while the first difference does not, (h) resetting the paper end flag if step (e) reveals that the first difference (LL) equals zero, and (i) if both the first and the second difference equal zero, controlling the printing device for printing a last line and then controlling the paper feeding device for ejecting the paper, while (j) if the second difference does not equal zero, controlling the paper feeding device for ejecting the paper and storing the second difference for controlling the paper feeding device after a new paper has been set.

Inventors: KITABATA KAZUO, KITABATA, KAZUO
Applicants: SEIKO EPSON CORP, SEIKO EPSON CORPORATION
Application year: 1990
Main classification: B41J11
IPC codes: B41J29, B41J11, B41J19