Disclosure of Invention
The embodiment of the invention provides a method and a device for configuring the brightness of a light emitting unit in a printer and the printer, which can enable the voltage value output by a light receiving unit to be suitable for detecting the current printing medium by adjusting the voltage output by the light emitting unit.
In a first aspect, an embodiment of the present invention provides a printer, including a controller, a light emitting unit, a light receiving unit, and a control motor, where the light emitting unit and the light receiving unit are disposed on two sides of a paper feeding path; the controller comprises a memory and a processor, the memory, the light emitting unit, the light receiving unit and the control motor are all connected with the processor, a computer program is stored in the memory, and the computer program can be executed by the processor to realize the following steps:
s1, sending a first rotation instruction to the control motor, so that the control motor drives the printing medium to move forwards;
s2, detecting the voltage value output by the light receiving unit;
s3, adjusting the voltage output to the light emitting unit according to the magnitude relation between the voltage value and at least two voltage reference values, so that the voltage value is between a first voltage reference value and a second voltage reference value;
s4, recording the moving distance of the printing medium;
s5, judging whether the moving distance is larger than a preset length;
if yes, configuring the adjusted voltage as the voltage of the light emitting unit;
if not, the voltage of the light emitting unit is updated according to the adjusted voltage, and the process returns to step S1.
Preferably, the adjusting the voltage output to the light emitting unit according to the magnitude relationship between the voltage value and at least two voltage reference values makes the voltage value between a first voltage reference value and a second voltage reference value, specifically:
when the voltage value is judged to be larger than a preset first voltage reference value, adjusting the voltage output to the light emitting unit to enable the voltage value not to be larger than the first voltage reference value;
and when the voltage value is judged to be smaller than a preset second voltage reference value, adjusting the voltage output to the light emitting unit so that the voltage value is not smaller than the second voltage reference value.
Preferably, the first voltage reference value is a saturation voltage of the light receiving unit; the second voltage reference value is a cut-off voltage of the light receiving unit.
Preferably, the method further comprises the following steps:
acquiring the length of a printing medium; the preset length is equal to the length of the printing medium.
In a second aspect, an embodiment of the present invention provides a method for configuring brightness of a light emitting unit in a printer, including:
s1, sending a first rotation instruction to the control motor to enable the control motor to drive the printing medium to advance;
s2, detecting the voltage value output by the light receiving unit;
s3, adjusting the voltage output to the light emitting unit according to the magnitude relation between the voltage value and at least two voltage reference values, so that the voltage value is between a first voltage reference value and a second voltage reference value;
s4, recording the moving distance of the printing medium;
s5, judging whether the moving distance is larger than a preset length;
if yes, configuring the adjusted voltage as the voltage of the light emitting unit;
if not, the voltage of the light emitting unit is updated according to the adjusted voltage, and the process returns to step S1.
Preferably, the voltage output to the light emitting unit is adjusted according to the magnitude relationship between the voltage value and at least two voltage reference values, so that the voltage of the light emitting unit tends to the first voltage reference value or the second voltage reference value, specifically:
when the voltage value is judged to be larger than a preset first voltage reference value, adjusting the voltage output to the light emitting unit to enable the voltage value not to be larger than the first voltage reference value;
and when the voltage value is judged to be smaller than a preset second voltage reference value, adjusting the voltage output to the light emitting unit so that the voltage value is not smaller than the second voltage reference value.
Preferably, the first voltage reference value is a saturation voltage; the second voltage reference value is a cutoff voltage.
Preferably, the method further comprises the following steps:
acquiring the length of a printing medium; the preset length is equal to the length of the printing medium
In a third aspect, an embodiment of the present invention provides a device for configuring brightness of a light emitting unit in a printer, including:
a rotation instruction issuing unit for issuing a rotation instruction to the control motor so that the control motor drives the printing medium to advance;
a detection unit for detecting a voltage value output by the light receiving unit;
the adjusting unit is used for adjusting the voltage output to the light emitting unit according to the magnitude relation between the voltage value and at least two voltage reference values, so that the voltage value is between a first voltage reference value and a second voltage reference value;
a recording unit for recording a moving distance of the printing medium;
the judging unit is used for judging whether the moving distance is larger than a preset length; if yes, calling a configuration unit, and if not, calling an updating unit; wherein,
the configuration unit is used for configuring the adjusted voltage as the voltage of the light emitting unit;
and the updating unit is used for updating the voltage of the light emitting unit according to the adjusted voltage and returning to the rotating instruction sending unit.
Preferably, the adjusting unit is specifically configured to:
the first voltage reference value judging module is used for adjusting the voltage output to the light emitting unit when the voltage value is judged to be larger than a preset first voltage reference value, so that the voltage value is not larger than the first voltage reference value;
and the second voltage reference value judging module is used for adjusting the voltage output to the light emitting unit when the voltage value is judged to be smaller than a preset second voltage reference value, so that the voltage value is not smaller than the second voltage reference value.
Preferably, the first voltage reference value is a saturation voltage of the light receiving unit; the second voltage reference value is a cut-off voltage of the light receiving unit.
Preferably, the method further comprises the following steps:
an acquisition unit configured to acquire a length of a printing medium; the preset length is equal to the length of the printing medium.
In a fourth aspect, the present invention provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program runs, an apparatus in which the computer-readable storage medium is located is controlled to execute the method for configuring brightness of light emitting units in a printer according to the second aspect.
In the above one embodiment, the voltage value output by the light receiving unit is detected in real time, the voltage output to the light emitting unit is adjusted according to the magnitude relationship between the voltage value and at least two voltage reference values, so that the voltage value is between a first voltage reference value and a second voltage reference value, and the voltage of the light emitting unit is changed by judging the moving distance of the printing medium and the preset length. The printer can be adapted to all specifications of printing media by adjusting the voltage output from the light emitting unit.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment of the present invention:
referring to fig. 1 to 3, a first embodiment of the present invention provides a printer including a controller, a light emitting unit 11, a light receiving unit 12, and a control motor 14, wherein the light emitting unit 11 and the light receiving unit 12 are disposed at both sides of a paper path. The controller includes a memory 13 and a processor 15, and the memory 13, the light emitting unit 11, the light receiving unit 12, and the control motor 14 are all connected to the processor 15.
In this embodiment, the processor 15 adjusts the voltage output to the light emitting unit 11 to change the brightness of the light emitting unit 11, and the light receiving unit 12 receives the light from the light emitting unit 11, converts the light signal into an electrical signal and feeds the electrical signal back to the processor 15 (i.e. converts the intensity of the light into the magnitude of the voltage), so that the processor 15 adjusts the voltage output from the light emitting unit 11 according to the detected voltage change output from the light receiving unit 12 to change the intensity of the light from the light emitting unit 11.
When the existing printer is used, after a new printing medium is replaced, due to different light transmittances of different specifications, the voltage of the existing light emitting unit 11 is found to be not suitable for the replaced printing medium, and the problem that the actual printing position is different from the preset printing position greatly, so that the printing deviation occurs on the replaced printing medium may occur. During the debugging, the inventors found that since the new printing medium is different in thickness or specification from the old printing medium, so that the intensity of light received by the light receiving unit 12 largely varies from the intensity of light received by the old printing medium, when the light emitting unit 11 and the light receiving unit 12 correspond to voltage values output in the region of the enlarged region when the region of the printing medium and/or the slit width region, the voltage value change is made sensitive so that a large change in voltage value occurs in the area of the printing medium or the slit width alone, further, the judgment is wrong, and the boundary position between the printing medium and the slit width is mistaken when the voltage value is greatly changed, the voltage value of the new printing medium may be adjusted such that the voltage value approaches a critical value of a saturation region or a cutoff region to be adapted to the new specification and thickness of the printing medium.
Specifically, the controller includes a memory 13 and a processor 15, and the memory 13, the light emitting unit 11, the light receiving unit 12, and the control motor 14 are all connected to the processor 15. Stored in the memory 13 is a computer program that can be executed by the processor 15 to implement the following steps, see in particular fig. 2:
s1, a first rotation command is sent to the control motor 14, so that the control motor 14 drives the printing medium 3 to move forward.
S2, the voltage value output by the light receiving unit 12 is detected.
S3, the voltage outputted to the light emitting unit 11 is adjusted according to the magnitude relationship between the voltage value and at least two voltage reference values so that the voltage value is between the first voltage reference value and the second voltage reference value.
In this embodiment, the voltage value output by the light receiving unit 12 is different according to the intensity of the light emitting unit 11, so that the processor 15 has different sensitivities to the voltage value change. Specifically, referring to fig. 3, it is assumed that the light receiving unit 12 is divided into a saturation region (2.7V or more), an amplification region (0.6V-2.7V), and a cut-off region (0V-0.6V) according to a light intensity variation, according to photoelectric characteristics (when received light is stronger, converted voltage is smaller). When the voltage output by the light receiving unit 12 approaches the critical value of the saturation region or the cut-off region, the voltage is stable, and when the voltage changes between the saturation region and the cut-off region, the voltage passes through the amplification region, and the boundary between the printing medium and the slit width can be sensitively sensed. Therefore, the first voltage reference value is set as the saturation voltage of the light receiving unit 12, specifically, the critical value of the saturation region voltage and the amplification region (2.7V in fig. 3), so that the voltage output by the light receiving unit 12 is stabilized when it is aligned with the print surface area of the printing medium. The second voltage reference value is set to the cut-off voltage of the light receiving unit 12, specifically to the cut-off voltage and the critical value of the amplification region (e.g., 0.6V in fig. 4), so that the voltage output by the light receiving unit 12 is stabilized when it is aligned with the print medium slit width region. Specifically, the voltage value of the light receiving unit 12 may be adjusted by:
when the voltage value is determined to be greater than a preset first voltage reference value, the voltage output to the light emitting unit 11 is adjusted so that the voltage value is not greater than the first voltage reference value.
When it is determined that the voltage value is smaller than a preset second voltage reference value, the voltage output to the light emitting unit 11 is adjusted so that the voltage value is not smaller than the second voltage reference value.
S4, the moving distance of the printing medium 3 is recorded.
In this embodiment, the moving distance of the printing medium is the sum of the moving distance recorded when the voltage value is made not greater than the first voltage reference value and the moving distance when the voltage value is made not less than the second voltage reference value, so that when it is determined that the voltage value is not greater than the first voltage reference value, the printing medium is completely run, not from the middle.
And S5, judging whether the moving distance is larger than the preset length.
If so, configuring the adjusted voltage as the voltage of the light emitting unit 11;
if not, the voltage of the light emitting unit 11 is updated according to the adjusted voltage, and the process returns to step S1.
In this embodiment, the actual position of the printing head relative to the edge of the printing medium is determined by determining the position of the print surface of the printing medium, the position of the seam width, and the voltage value corresponding thereto by determining that the moving distance of the first voltage reference value and the second voltage reference value is greater than the preset length in one cycle of the conversion between the first voltage reference value and the second voltage reference value, and determining the critical positions of the print surface and the seam surface of the printing medium.
However, it should be noted that the actual edge position of the printing medium can be confirmed only in the case where the first voltage reference value and the second voltage reference value are sequentially shifted not less than three times. It will be appreciated that the printer will not be able to recognize that it has gone through a complete cycle when it detects three edge positions, for example, assuming that the first change in detected voltage value corresponds to a change from the first voltage reference value to the second voltage reference value, which is a change from the print side position to the slot width position of the print medium, which is the first edge. The second change of the voltage value is detected to correspond to the second voltage reference value change to the first voltage reference value, which is a change from the slot width position of the printing medium to the printing surface position, which is the second edge, i.e. the slot width position is between the first edge and the second edge, the third change of the voltage value is detected to correspond to the first voltage reference value change to the second voltage reference value, which is a change from the printing surface position of the printing medium to the slot width position, which is the third edge, i.e. the printing surface position of the printing medium is complete between the second edge and the third edge, i.e. when the moving distance of the printing medium is judged to be greater than the preset length, the adjusted voltage is configured as the voltage of the light emitting unit 11, i.e. the adjustment is confirmed to be completed.
To sum up, the voltage value output by the light receiving unit 12 is detected in real time, the voltage output to the light emitting unit 11 is adjusted according to the magnitude relationship between the voltage value and at least two voltage reference values, so that the voltage value is between a first voltage reference value and a second voltage reference value, and the voltage of the light emitting unit 11 is changed by judging the moving distance and the preset length of the printing medium. The voltage value output by the light receiving unit 12 can be adapted to be used to detect the current printing medium by adjusting the voltage output by the light emitting unit 11.
Referring to fig. 4, on the basis of the above embodiment, in a preferred embodiment of the present invention, the light emitting unit 11 may be, but is not limited to, a light emitting diode, as long as the light emitting unit 11 includes, for example, the structure shown in fig. 4, and the light emitting unit 11 includes a light emitting unit light emitting tube 1 (light source), a light emitting unit collimating mirror 2 (mirror for converting a divergent light beam into a parallel light beam), and the like, and the present invention is not described herein again.
The light receiving unit 12 may be, but not limited to, a photodiode, as long as the structure includes, for example, as shown in fig. 4, the structure of the light receiving unit 12 includes a light receiving unit condenser 4 (a light receiving channel, a convex lens for converging light), a light receiving unit converter 5 (for converting an optical signal into an electrical signal), and the like, and it is understood that the light receiving unit converter 5 may be, for example, a triode, and the description of the present invention is omitted.
On the basis of the above embodiments, in a preferred embodiment of the present invention, the method further includes:
acquiring the length of the printing medium 3; the preset length is equal to the length of the printing medium 3
Second embodiment of the invention:
referring to fig. 2, a second embodiment of the present invention provides a method for configuring brightness of a light emitting unit in a printer, including:
s1, sending a first rotation instruction to the control motor to enable the control motor to drive the printing medium to advance;
s2, detecting the voltage value output by the light receiving unit;
s3, adjusting the voltage output to the light emitting unit according to the magnitude relation between the voltage value and at least two voltage reference values, so that the voltage value is between a first voltage reference value and a second voltage reference value;
s4, recording the moving distance of the printing medium;
s5, judging whether the moving distance is larger than a preset length;
if yes, configuring the adjusted voltage as the voltage of the light emitting unit;
if not, the voltage of the light emitting unit is updated according to the adjusted voltage, and the process returns to step S1.
On the basis of the foregoing embodiments, in a preferred embodiment of the present invention, the adjusting the voltage output to the light emitting unit according to the magnitude relationship between the voltage value and at least two voltage reference values so that the voltage value is between a first voltage reference value and a second voltage reference value specifically includes:
when the voltage value is judged to be larger than a preset first voltage reference value, adjusting the voltage output to the light emitting unit to enable the voltage value not to be larger than the first voltage reference value;
and when the voltage value is judged to be smaller than a preset second voltage reference value, adjusting the voltage output to the light emitting unit so that the voltage value is not smaller than the second voltage reference value.
On the basis of the above embodiments, in a preferred embodiment of the present invention, the first voltage reference value is a saturation voltage; the second voltage reference value is a cutoff voltage.
On the basis of the above embodiments, in a preferred embodiment of the present invention, the method further includes:
acquiring the length of a printing medium; the preset length is equal to the length of the printing medium
Third embodiment of the invention:
referring to fig. 5, a third embodiment of the present invention provides a light emitting unit luminance configuring apparatus in a printer, including:
a rotation instruction issuing unit 100 configured to issue a rotation instruction to the control motor so that the control motor drives the printing medium to advance;
a detection unit 200 for detecting a voltage value output from the light receiving unit;
an adjusting unit 300, configured to adjust the voltage output to the light emitting unit according to a magnitude relationship between the voltage value and at least two voltage reference values, so that the voltage value is between a first voltage reference value and a second voltage reference value;
a recording unit 400 for recording a moving distance of the printing medium;
a judging unit 500, configured to judge whether the moving distance is greater than a preset length; if yes, the configuration unit 600 is called, and if not, the update unit 700 is called; wherein,
the configuration unit 600 is configured to configure the adjusted voltage as the voltage of the light emitting unit;
the updating unit 700 is configured to update the voltage of the light emitting unit according to the adjusted voltage, and return to the rotation instruction issuing unit.
On the basis of the above embodiments, in a preferred embodiment of the present invention, the adjusting unit 300 specifically includes:
the first voltage reference value judging module is used for adjusting the voltage output to the light emitting unit when the voltage value is judged to be larger than a preset first voltage reference value, so that the voltage value is not larger than the first voltage reference value;
and the second voltage reference value judging module is used for adjusting the voltage output to the light emitting unit when the voltage value is judged to be smaller than a preset second voltage reference value, so that the voltage value is not smaller than the second voltage reference value.
On the basis of the above embodiments, in a preferred embodiment of the present invention, the first voltage reference value is a saturation voltage of the light receiving unit; the second voltage reference value is a cut-off voltage of the light receiving unit.
On the basis of the above embodiments, in a preferred embodiment of the present invention, the method further includes:
an acquisition unit configured to acquire a length of a printing medium; the preset length is equal to the length of the printing medium.
The fourth embodiment of the present invention:
a fourth embodiment of the present invention provides a computer-readable storage medium, which is characterized in that the computer-readable storage medium includes a stored computer program, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the method for configuring the brightness of the light emitting unit in the printer according to the above embodiment.
Illustratively, the computer programs described herein can be partitioned into one or more modules that are stored in the memory and executed by the processor to implement the invention. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, the instruction segments describing the execution process of the computer program in the implementation server device. For example, the device described in the third embodiment of the present invention.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an APPlication Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor is a control center of the light emitting unit brightness configuration method in the printer, and various interfaces and lines are used to connect the whole to realize the various parts of the light emitting unit brightness configuration method in the printer.
The memory may be used to store the computer programs and/or modules, and the processor may implement the various functions of the light emitting unit brightness configuration method in the printer by running or executing the computer programs and/or modules stored in the memory and calling the data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, a text conversion function, etc.), and the like; the storage data area may store data (such as audio data, text message data, etc.) created according to the use of the user terminal, etc. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
Wherein, the module for realizing the service device can be stored in a computer readable storage medium if it is realized in the form of software functional unit and sold or used as a stand-alone product. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that the above-described device embodiments are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.