Printing method of thermal printer, printer, printing system and storage medium
By designing a speed reducer in a thermal printer and adjusting the stepping time of the stepper motor, the problem of excessive change in printing speed from fast to slow is solved, the occurrence of paper jams is avoided, and the paper is stable and tensile force is ensured. Print stability.
Patent Information
- Application Number
- CN202211233834.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-10
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2042-10-10
AI Technical Summary
The speed change of existing thermal printers is too large when the printing speed is fast to slow, resulting in the stepper motor being unable to pull the paper in time, resulting in paper jam problems.
Design a stepper motor deceleration table, arrange the step time according to the step time in the accelerator, calculate the theoretical step time of the currently printed point line, and determine whether there is a step time less than the theoretical step time in the deceleration table. Adjust the step time to ensure that the step time is greater than the value in the deceleration table, thereby avoiding the problem of excessive variation when the printing speed is reduced.
It effectively avoids the problem of excessive change in thermal printers when the printing speed decreases, ensures the paper pulling force, reduces the chance of paper jams, and improves printing stability.
Smart Images

Figure CN115534544B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of thermal printers, and in particular, relates to a printing method, a printer, a printing system and a storage medium of a thermal printer. Background Art
[0002] Thermal printers are often used in supermarkets, convenience stores, hospitals and other places, which have certain requirements for printing effect and printing speed. In order to provide a better user experience, the printing speed of thermal printers is currently adjusted to the expected theoretical value using printer drivers. However, during the development and actual application process, it was found that when using the existing printer driver, paper jams will occur when printing. The root cause is that the printer speed changes too much, causing the printer to be unable to pull the paper.
[0003] In order to solve the problem that the printing speed changes too much and the thermal printer cannot maintain a certain pulling force on the paper, in the prior art, printer manufacturers provide an accelerometer to ensure that the printing speed of the thermal printer does not change too much when changing from slow to fast. However, it still cannot solve the problem that the printing speed changes too much when changing from fast to slow. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a printing method, a printer, a printing system and a storage medium of a thermal printer to solve the problem in the prior art that the printing speed varies too much from fast to slow.
[0005] The first aspect of the embodiment of the present application provides a printing method of a thermal printer, comprising: obtaining N step times in an acceleration table of a stepper motor according to a preset step interval, arranging the N step times from small to large to form a deceleration table Gd of the stepper motor, wherein N is the number of print dot rows; calculating the theoretical step time T of the current dot row m to be printed m , where m = 1, 2, ..., N; based on whether there is a time in the deceleration table Gd that is less than the theoretical step time T m One or more of the stepping times are used to determine the stepping time of the current row m of dots to be printed.
[0006] In one embodiment, the step time T is less than the theoretical step time T in the deceleration table Gd. m One or more of the stepping times, determining the stepping time of the current to-be-printed dot row m, comprising: when there is no stepping time less than the theoretical stepping time T in the deceleration table Gd m When one or more of the stepping times are equal, the stepping time of the current to-be-printed dot row m is determined to be the theoretical stepping time T m ; When the deceleration table Gd contains a time less than the theoretical step time T mWhen one or more of the step times are reached, the maximum step time Gd among the one or more step times is obtained. i , where i is the i-th value in the deceleration table Gd, i=1, 2, ..., N; based on whether Ni is greater than or equal to M, determine the step time of the current row of dots to be printed m, where M is the number of rows of dots to be printed, M=N, N-1, ..., 0.
[0007] In one embodiment, determining the stepping time of the current to-be-printed dot row m according to whether Ni is greater than or equal to M includes: obtaining the heating time Gh of the current to-be-printed dot row m m When Ni is greater than or equal to M, the step time of the current row of dots to be printed m is determined to be the maximum step time Gd i ; When Ni is less than M, obtain the deceleration table Gd that is greater than or equal to the maximum step time Gd i Step time Gd n , determine each step time Gd n Is it greater than or equal to the heating time Gh m , where n=i, i+1, ..., N; if each of the step time Gd n Greater than or equal to the heating time Gh m , then the step time of the current to-be-printed dot row m is determined to be the theoretical step time T m Otherwise, the step time of the current row of dots to be printed m is determined to be Gd i+k , where k=m-1.
[0008] In one embodiment, the theoretical stepping time T of the current row of dots to be printed is calculated. m , including: obtaining the heating time Gh of the current to-be-printed dot row m m ; Obtain the acceleration step time T of the current to-be-printed dot row m in the acceleration table; Determine whether the acceleration step time T of the current to-be-printed dot row m is greater than or equal to the heating time Gh of the current to-be-printed dot row m m If yes, then determine the theoretical step time T of the current line m of dots to be printed m is the acceleration step time T; if not, then determine the theoretical step time T of the current line of dots to be printed m m is the heating time Gh m .
[0009] In one of the embodiments, obtaining the acceleration step time T of the current row of dots to be printed m in the acceleration table includes: finding the position of the current row of dots to be printed m-1 in the acceleration table, and finding the position of the current row of dots to be printed m according to the position of the current row of dots to be printed m-1; and obtaining the acceleration step time T according to the position of the current row of dots to be printed m.
[0010] The second aspect of the embodiment of the present application provides a printer, comprising: a forming module, used to obtain N stepping times in the acceleration table of the stepping motor according to a preset step interval, and arrange the N stepping times from small to large to form a deceleration table Gd of the stepping motor, wherein N is the number of printing dot rows; a calculating module, used to calculate the theoretical stepping time T of the current dot row m to be printed m , where m is the current dot row to be printed, m=1, 2, ..., N; a determination module for determining whether there is a time less than the theoretical step time T in the deceleration table Gd m One or more of the stepping times are used to determine the stepping time of the current row m of dots to be printed.
[0011] In one embodiment, the determination module is specifically configured to determine the deceleration time when there is no step time less than the theoretical step time T in the deceleration table Gd. m When one or more of the stepping times are equal, the stepping time of the current to-be-printed dot row m is determined to be the theoretical stepping time T m ; When the deceleration table Gd contains a time less than the theoretical step time T m When one or more of the step times are reached, the maximum step time Gd among the one or more step times is obtained. i , where i is the i-th value in the deceleration table Gd, i=1, 2, ..., N; based on whether Ni is greater than or equal to M, determine the step time of the current row of dots to be printed m, where M is the number of rows of dots to be printed, M=N, N-1, ..., 0.
[0012] In one embodiment, the stepping time of the current row of dots to be printed is determined according to whether Ni is greater than or equal to M, including: obtaining the heating time Gh of the current row of dots to be printed m m When Ni is greater than or equal to M, the step time of the current row of dots to be printed m is determined to be the maximum step time Gd i ; When Ni is less than M, obtain the maximum step time Gd in the deceleration table that is greater than or equal to the maximum step time i Step time Gd n , determine each step time Gd n Is it greater than or equal to the heating time Gh m , where n=i, i+1, ..., N; if each of the step time Gdn Greater than or equal to the heating time Gh m , then the step time of the current to-be-printed dot row m is determined to be the theoretical step time T m Otherwise, the step time of the current row of dots to be printed m is determined to be Gd i+k , where k=m-1.
[0013] A third aspect of an embodiment of the present application provides a printing system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any method described in the first aspect when executing the computer program.
[0014] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in any one of the first aspects are implemented.
[0015] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the embodiments of the present application provide a printing method, a printer, a printing system and a storage medium for a thermal printer, and a corresponding deceleration table is designed for an existing acceleration table. The deceleration table can be used to adjust the stepping time of the current row of dots to be printed calculated by the existing acceleration table to ensure that the stepping time of the current row of dots to be printed is greater than the stepping time in the deceleration table, thereby ensuring that whether to reduce the current speed and how much to reduce it can be predicted in advance, thereby avoiding the problem of excessive change from fast to slow when the printing speed of the thermal printer is reduced, ensuring that the thermal printer always maintains a certain pulling force on the paper, and reducing the chance of paper jams in the thermal printer. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0017] Figure 1 is a schematic diagram of a semiconductor heating element in a thermal printer provided in an embodiment of the present application;
[0018] Figure 2 It is a schematic diagram of the implementation flow of a printing method of a thermal printer provided in an embodiment of the present application;
[0019] Figure 3 It is a complete implementation flow diagram of a printing method of a thermal printer provided in an embodiment of the present application;
[0020] Figure 4 is a schematic diagram of an accelerometer of a stepper motor provided in an embodiment of the present application;
[0021] Figure 5 is a schematic diagram of a speed reduction table of a stepper motor provided in an embodiment of the present application;
[0022] Figure 6 is a schematic diagram of a heating schedule provided in an embodiment of the present application;
[0023] Figure 7 It is a schematic diagram of the structure of the printer provided in the embodiment of the present application.
[0024] Figure 8 It is a schematic diagram of the structure of the printing system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0026] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.
[0027] Description of technical terms related to thermal printers:
[0028] 1. Print dot line:
[0029] Thermal printers have semiconductor heating elements, such as Figure 1 As shown, there is a row of several equally spaced heating metals. For example, each heating metal has a specification of 0.125mm×0.125mm, and the spacing between the heating metals can be 0.125mm. The length of the semiconductor heating element formed by all the heating metals is 54mm. During the printing process, after the corresponding heating metal is heated, the heating metal contacts the thermal printing paper, and the thermal printing paper turns black after a chemical reaction, and then the text and pattern can be printed. Among them, the dot row formed by the heating metal contacting the thermal printing paper each time is called the printing dot row in the embodiment of the present application.
[0030] 2. Stepper motor:
[0031] The thermal printer has a stepper motor, which works with the semiconductor heating element. When the semiconductor heating element turns black when in contact with the thermal printing paper, the stepper motor pulls the thermal printing paper forward to print out text and patterns. It is understandable that in order to ensure the smooth printing of each printing dot line, the stepping time of the stepper motor must be greater than or equal to the heating time of the heated metal.
[0032] In the prior art, in order to increase the printing speed of thermal printers, people have designed printer drivers to adjust the heating time of the heated metal and the stepping time of the stepper motor, thereby adjusting the printing speed to the expected value. However, when using the printer driver to control the thermal printer to print, paper jams often occur. Research has found that this is because the printing speed changes too quickly and the stepper motor cannot pull the paper forward in time. Therefore, in response to this problem, many printer manufacturers provide stepper motor acceleration tables for printer products. When the printing speed changes from low speed to high speed, the stepper motor will accelerate according to the acceleration curve on the acceleration table, thereby avoiding excessive speed changes. However, the acceleration table still cannot solve the problem of excessive speed changes when the printing speed of the stepper motor changes from high speed to low speed. Thermal printers still have paper jams during printing, affecting daily use.
[0033] Based on the problems existing in the prior art, the embodiments of the present application provide a printing method, a printer, a printing system and a storage medium for a thermal printer. A deceleration table for a stepper motor is designed corresponding to the existing acceleration table. When the printing speed changes from fast to slow, the deceleration table is used to adjust the stepping time of the current row of dots to be printed calculated by the existing acceleration table to ensure that the stepping time of the current row of dots to be printed is greater than the stepping time in the deceleration table. This ensures that whether the current speed needs to be reduced and how much to reduce can be predicted in advance, and the problem of excessive change from fast to slow when the printing speed of the stepper motor is reduced can be avoided. This ensures that the stepper motor always maintains a certain pulling force on the paper, thereby reducing the chance of paper jams in the thermal printer.
[0034] See also Figure 2 and Figure 3 The present application provides a printing method of a thermal printer, comprising the following steps:
[0035] Step S21, obtaining N stepping times from the acceleration table of the stepping motor according to a preset step number interval, and arranging the N stepping times from small to large to form a deceleration table Gd of the stepping motor, wherein N is the number of printing dot rows;
[0036] The accelerometer of the stepper motor is provided by the printer manufacturer for the thermal printer. The thermal printer will work according to the rules of the accelerometer. For example, Figure 4As shown, the embodiment of the present application provides an acceleration table of one of the stepper motors, and the step time unit is microseconds. It can be seen from the acceleration table that when the printing speed of the stepper motor changes from slow to fast during the printing process, it will accelerate according to the acceleration curve of the acceleration table to achieve a slow increase in the printing speed, and the problem of excessive change in the printing speed will not occur. Therefore, based on the existing acceleration table, the embodiment of the present application creatively proposes a deceleration table, which uses the deceleration table to determine the step time of the stepper motor, ensuring that the printing speed will not change too much during the process of changing from fast to slow.
[0037] Specifically, the process of obtaining the deceleration table from the acceleration table is: obtain N step times in the acceleration table of the stepper motor according to the preset step interval, and arrange the N step times from small to large to form a deceleration table Gd. Among them, N is the number of printed dot rows, that is, the total number of dot rows that need to be printed when completing a printing job, and each printed dot row corresponds to a step time. It takes N step times to complete a printing job. The change order of the N step times in the acceleration table is from large to small, and the change order of the N step times in the deceleration table is from small to large. It is worth noting that the deceleration table designed in the embodiment of the present application can select different preset step intervals according to printers of different speeds and actual application needs, formulate different deceleration processes, and meet various deceleration requirements.
[0038] In order to more clearly illustrate the process of obtaining the deceleration table, the embodiment of the present application combines Figure 4 The acceleration table is used as an example. For example, if 7 printing dot rows are required in a printing job, then 7 step times can be obtained in the acceleration table at intervals of 5 steps, that is, 7 corresponding step times a1, a2, a3, a4, a5, a6, a7 are obtained at positions with step numbers of 1, 5, 10, 15, 20, 25, and 30 in the acceleration table, and a1, a2, a3, a4, a5, a6, and a7 are arranged from small to large to form a deceleration table Gd. The arrangement order of the 7 step times in the deceleration table Gd is a7, a6, a5, a4, a3, a2, and a1, as shown in FIG. Figure 5 shown.
[0039] Step S22: Calculate the theoretical stepping time T of the current dot row m to be printed. m , where m = 1, 2, ..., N;
[0040] In some embodiments, step S22 specifically includes: obtaining the heating time Gh of the current to-be-printed dot row m m ;
[0041] Obtaining the acceleration step time T of the current to-be-printed dot row m in the acceleration table;
[0042] Determine whether the acceleration step time T of the current to-be-printed dot row m is greater than or equal to the heating time Gh of the current to-be-printed dot row m m ;
[0043] If so, determine the theoretical step time T of the current line of dots to be printed m m is the acceleration step time T; if not, then determine the theoretical step time T of the current line of dots to be printed m m is the heating time Gh m .
[0044] In step S22, the theoretical stepping time T of the current to-be-printed dot row m is m It refers to the stepping time of the stepper motor entering the next printing dot row after the stepping time of the currently printed printing dot row. In the embodiment of the present application, the next printing dot row is referred to as the current to-be-printed dot row m, where m=1, 2, ..., N; the stepping time of the next printing dot row is referred to as the theoretical stepping time T m , one printing job includes N theoretical step times T m .
[0045] Since the stepper motor prints based on the accelerometer, the stepping time of the stepper motor can be calculated based on the accelerometer regardless of whether the stepper motor is performing acceleration or deceleration motion. The embodiment of the present application finds the position of the stepping time of the currently completed printing dot row in the accelerometer according to the stepping time of the currently completed printing dot row, and obtains the stepping time of the next printing dot row in the accelerometer. This stepping time is called the acceleration stepping time T of the current dot row m to be printed.
[0046] One printing job includes N heating times Gh m ,like Figure 6 The heating time Gh is shown in the figure. m is random, where the heating time Gh of the current line m to be printed m The calculation adopts the heating algorithm of the existing printer, and the embodiment of the present application does not limit this.
[0047] In the embodiment of the present application, the acceleration step time T of the current row of dots to be printed m is compared with the heating time Gh m To determine the theoretical step time T of the current line m of dots to be printed m Specifically, in order to ensure that printing is completed smoothly, the step time must be greater than or equal to the heating time. Therefore, when the comparison shows that the acceleration step time T is greater than or equal to the heating time Gh m When the theoretical step time T of the current dot row m to be printed is determined m is the acceleration step time T; when the acceleration step time T is less than the heating time Gh mWhen the theoretical step time T of the current dot row m to be printed is determined m is the heating time Gh m .
[0048] Step S23: Check whether there is a time less than the theoretical step time T in the deceleration table Gd. m One or more of the stepping times are used to determine the stepping time of the current row m of dots to be printed.
[0049] In some implementations, step S23 includes the following steps:
[0050] S231: When there is no step time less than the theoretical step time T in the deceleration table Gd, m When one or more of the stepping times are equal, the stepping time of the current to-be-printed dot row m is determined to be the theoretical stepping time T m ;
[0051] S232: When there is a time in the deceleration table Gd that is less than the theoretical step time T m When one or more of the step times are reached, the maximum step time Gd among the one or more step times is obtained. i , where i is the i-th value in the deceleration table Gd, i=1, 2, ..., N;
[0052] S233. Determine the stepping time of the current dot row m to be printed according to whether Ni is greater than or equal to M, where M is the number of dot rows to be printed, M=N, N-1, ..., 0.
[0053] In the embodiment of the present application, the theoretical step time T of the current line of dots to be printed m is calculated according to the above step S22. m Then, by judging whether there is a time less than the theoretical step time T in the deceleration table Gd, m One or more step times can be used to determine whether to adjust the theoretical step time T m , and the theoretical step time T m The algorithm time complexity of this step is O(N). One or more means that there is one or more step times. When there is no step time less than the theoretical step time T in the deceleration table Gd, m If one or more step times of , it means that the current speed is very slow and no longer needs to be slowed down. The step time of the current line of dots to be printed m can be determined to be the theoretical step time T m ; When there is a time in the deceleration table Gd that is less than the theoretical step time T m When one or more step times are set, it is necessary to determine whether to adjust the theoretical step time T according to whether Ni is greater than or equal to M. mIt can be understood that M in the embodiment of the present application is the number of dot rows to be printed in one printing operation, M=N, N-1, ... 0, and the value of M will gradually decrease until the end of printing, when there is no new dot row to be printed and M becomes 0.
[0054] The embodiment of the present application exemplarily provides a deceleration table Gd in which there is a step time less than the theoretical step time T m The step time is as follows: Figure 5 As shown, the left side is the deceleration table Gd of the stepper motor, and the right side is the theoretical step time T of the current dot row m to be printed m , then there are four steps in the deceleration table Gd that are less than the theoretical step time T m The stepping time is a7, a6, a5, a4, and the maximum value among the four stepping times is a4, which is recorded as the maximum stepping time Gd i , a4 is the 4th value in the deceleration table, i=4; continue to determine the step time of the current dot row m to be printed based on whether Ni is greater than or equal to M.
[0055] In some implementations, step S233 includes the following steps:
[0056] S2331, obtaining the heating time Gh of the current dot row m to be printed m ;
[0057] S2332: When Ni is greater than or equal to M, determine that the step time of the current to-be-printed dot row m is the maximum step time Gd i ;
[0058] S2333: When Ni is less than M, obtain the time Gd greater than or equal to the maximum step time Gd in the deceleration table Gd. i Step time Gd n , determine each step time Gd n Is it greater than or equal to the heating time Gh m , where n=i, i+1,...,N;
[0059] S2334, if each step time Gd n Greater than or equal to the heating time Gh m , then the step time of the current to-be-printed dot row m is determined to be the theoretical step time T m ;
[0060] S2335, otherwise, determine that the step time of the current to-be-printed dot row m is Gd i+k , where k=m-1.
[0061] In step S233, when the deceleration table Gd has a time less than the theoretical step time T mWhen the stepping time of the current row of dots to be printed is determined by judging whether Ni is greater than or equal to M, the stepping time of the current row of dots to be printed m is determined. The time complexity of the algorithm of this step is O(N). When Ni is greater than or equal to M, it means that the printing is about to end, and the deceleration operation can be directly performed. The stepping time of the current row of dots to be printed m is determined to be the maximum stepping time Gd i ;
[0062] When Ni is less than M, the step times i to N in the deceleration table Gd are compared with the heating time Gh of the current row of dots to be printed. m For comparison, the step time from i to N is recorded as Gd n , n=i,i+1,……,N;if each step time Gd n Greater than or equal to heating time Gh m , it means that the current printing speed is appropriate and does not need to be slowed down. The step time of the current line of dots to be printed m is determined to be the theoretical step time T m ; Otherwise, determine the step time of the current line of dots to be printed m as Gd i+k , where k = m-1, m = 1~(Ni). Further, in the actual printer driver, when judging each step time Gd n Greater than or equal to heating time Gh m When the deceleration flag is set to 0, otherwise the deceleration flag is set to 1. The printer driver can adjust the stepping time of the stepper motor by judging the deceleration flag.
[0063] In combination with the above example, when N=7 and i=4, if Ni is less than M, the step times i to N in the deceleration table Gd are compared with the heating time Gh of the current row of dots to be printed. m Compare, that is, compare a4, a3, a2, a1 and Gh m For comparison, if a4, a3, a2, and a1 are all greater than Gh m , it means that there is no need to decelerate, and the step time is determined to be the theoretical step time T m ; Otherwise, determine the step time of the current line of dots to be printed m as Gd i+k .
[0064] It can be understood that after the step time of the current to-be-printed dot row m is determined in the above steps S231, S2332, S2334, and S2335, no matter whether the conclusion is that adjustment is required, the process of determining the step time of the next printing dot row is looped, the printing algorithm of the embodiment of the present application is re-executed, and the theoretical step time T is recalculated and updated. m and heating time Gh m .
[0065] It is worth mentioning that the time complexity of the algorithm of the embodiment of the present application is O(2N), which proves that the use of the method of the embodiment of the present application can not only avoid the problem of printer paper jam, but also the method is simple to calculate and has a fast calculation speed.
[0066] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0067] See also Figure 7 The second aspect of the embodiment of the present application further provides a printer, comprising:
[0068] A forming module 71 is used to obtain N step times in the acceleration table of the stepping motor according to a preset step number interval, and arrange the N step times from small to large to form a deceleration table Gd of the stepping motor, where N is the number of printing dot rows;
[0069] The calculation module 72 is used to calculate the theoretical step time T of the current dot row m to be printed. m , where m is the current dot row to be printed, m=1, 2, ..., N;
[0070] The determination module 73 is used to determine whether there is a time less than the theoretical step time T in the deceleration table Gd. m One or more of the stepping times are used to determine the stepping time of the current row m of dots to be printed.
[0071] In some implementations, the calculation module 72 is specifically configured to:
[0072] Get the heating time Gh of the current line of dots to be printed m ;
[0073] Obtaining the acceleration step time T of the current to-be-printed dot row m in the acceleration table;
[0074] Determine whether the acceleration step time T of the current to-be-printed dot row m is greater than or equal to the heating time Gh of the current to-be-printed dot row m m ;
[0075] If so, determine the theoretical step time T of the current line of dots to be printed m m is the acceleration step time T;
[0076] If not, determine the theoretical step time T of the current line of dots to be printed m m is the heating time Gh m .
[0077] In some implementations, the determining module 73 is specifically configured to:
[0078] When there is no step time less than the theoretical step time T in the deceleration table Gd m When one or more of the stepping times are equal, the stepping time of the current to-be-printed dot row m is determined to be the theoretical stepping time T m ;
[0079] When there is a time in the deceleration table Gd that is less than the theoretical step time T m When one or more of the step times are reached, the maximum step time Gd among the one or more step times is obtained. i , where i is the i-th value in the deceleration table Gd, i=1, 2, ..., N;
[0080] The step time of the current to-be-printed dot row m is determined according to whether Ni is greater than or equal to M, where M is the number of to-be-printed dot rows, M=N, N-1, ..., 0.
[0081] In some implementations, determining the stepping time of the current row of dots to be printed according to whether Ni is greater than or equal to M includes:
[0082] Get the heating time Gh of the current line of dots to be printed m ;
[0083] When Ni is greater than or equal to M, the step time of the current to-be-printed dot row m is determined to be the maximum step time Gd i ;
[0084] When Ni is less than M, obtain the maximum step time Gd in the deceleration table. i Step time Gd n , determine each step time Gd n Is it greater than or equal to the heating time Gh m , where n=i, i+1,...,N;
[0085] If each of the step time Gd n Greater than or equal to the heating time Gh m , then the step time of the current to-be-printed dot row m is determined to be the theoretical step time T m ;
[0086] Otherwise, the step time of the current to-be-printed dot row m is determined to be Gd i+k , where k=m-1.
[0087] A thermal printer in an embodiment of the present application is a modular device corresponding to the printing method of a thermal printer in the above embodiment. Its principle and implementation process are the same as those in the above embodiment. For details, please refer to the description of the method, which will not be described in detail here.
[0088] See also Figure 8 The third aspect of the embodiment of the present application provides a printing system, including: a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and executable on the processor 80. When the processor 80 executes the computer program 82, the steps of the printing method embodiment of the thermal printer are implemented. Alternatively, when the processor 80 executes the computer program 82, the functions of each module / unit in the thermal printer embodiment are implemented.
[0089] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the printing method of the thermal printer are implemented.
[0090] Exemplarily, the computer program 82 may be divided into one or more modules / units, which are stored in the memory 81 and executed by the processor 80 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 82 in the thermal printer.
[0091] The processor 80 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0092] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0093] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0094] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0095] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0096] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0097] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0098] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by hardware related to computer program instructions. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0099] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A printing method for a thermal printer, characterized in that: include: Obtain N step times from the acceleration table of the stepper motor according to the preset step interval, and arrange the N step times from small to large to form a deceleration table Gd of the stepper motor, where N is the number of printing dot rows; Calculate the theoretical step time T of the current line of dots to be printed m m , where m = 1, 2, ..., N; According to whether there is a time in the deceleration table Gd that is less than the theoretical step time T m One or more of the stepping times to determine the stepping time of the current row m of dots to be printed; The step time T is less than the theoretical step time T in the deceleration table Gd. m The one or more step times of the step time are used to determine the step time of the current to-be-printed dot row m, including: When there is no step time less than the theoretical step time T in the deceleration table Gd m When one or more of the stepping times are equal, the stepping time of the current to-be-printed dot row m is determined to be the theoretical stepping time T m ; When there is a time in the deceleration table Gd that is less than the theoretical step time T m When one or more of the step times are reached, the maximum step time Gd among the one or more step times is obtained. i , where i is the i-th value in the deceleration table Gd, i=1, 2, ..., N; The step time of the current to-be-printed dot row m is determined according to whether Ni is greater than or equal to M, where M is the number of to-be-printed dot rows, M=N, N-1, ..., 0.
2. The printing method of a thermal printer according to claim 1, characterized in that: The stepping time of the current row of dots to be printed is determined according to whether Ni is greater than or equal to M, including: Get the heating time Gh of the current line of dots to be printed m ; When Ni is greater than or equal to M, the step time of the current to-be-printed dot row m is determined to be the maximum step time Gd i ; When Ni is less than M, obtain the deceleration table Gd greater than or equal to the maximum step time Gd i Step time Gd n , determine each step time Gd n Is it greater than or equal to the heating time Gh m , where n=i, i+1,...,N; If each of the step time Gd n Greater than or equal to the heating time Gh m , then the step time of the current to-be-printed dot row m is determined to be the theoretical step time T m ; Otherwise, the step time of the current to-be-printed dot row m is determined to be Gd i+k , where k=m-1.
3. The printing method of a thermal printer according to claim 1, characterized in that: The theoretical step time T of calculating the current line of dots to be printed is m ,include: Get the heating time Gh of the current line of dots to be printed m ; Obtaining the acceleration step time T of the current to-be-printed dot row m in the acceleration table; Determine whether the acceleration step time T of the current to-be-printed dot row m is greater than or equal to the heating time Gh of the current to-be-printed dot row m m ; If so, determine the theoretical step time T of the current line of dots to be printed m m is the acceleration step time T; If not, determine the theoretical step time T of the current line of dots to be printed m m is the heating time Gh m .
4. The printing method of a thermal printer according to claim 3, characterized in that: The step of obtaining the acceleration step time T of the current to-be-printed dot row m in the acceleration table includes: Find the position of the current printing dot row m-1 in the acceleration table, and find the position of the current to-be-printed dot row m according to the position of the current printing dot row m-1; The acceleration step time T is obtained according to the position of the current to-be-printed dot row m.
5. A printer, characterized in that: include: A forming module is used to obtain N step times in the acceleration table of the stepping motor according to a preset step number interval, and arrange the N step times from small to large to form a deceleration table Gd of the stepping motor, where N is the number of printing dot rows; Calculation module, used to calculate the theoretical step time T of the current line m of dots to be printed m , where m is the current dot row to be printed, m=1, 2, ..., N; A determination module is used to determine whether there is a time less than the theoretical step time T in the deceleration table Gd. m One or more of the stepping times to determine the stepping time of the current row m of dots to be printed; The determination module is specifically used for: When there is no step time less than the theoretical step time T in the deceleration table Gd m When one or more of the stepping times are equal, the stepping time of the current to-be-printed dot row m is determined to be the theoretical stepping time T m ; When there is a time in the deceleration table Gd that is less than the theoretical step time T m When one or more of the step times are reached, the maximum step time Gd among the one or more step times is obtained. i , where i is the i-th value in the deceleration table Gd, i=1, 2, ..., N; The step time of the current to-be-printed dot row m is determined according to whether Ni is greater than or equal to M, where M is the number of to-be-printed dot rows, M=N, N-1, ..., 0.
6. A printer according to claim 5, characterized in that: The stepping time of the current row of dots to be printed is determined according to whether Ni is greater than or equal to M, including: Get the heating time Gh of the current line of dots to be printed m ; When Ni is greater than or equal to M, the step time of the current to-be-printed dot row m is determined to be the maximum step time Gd i ; When Ni is less than M, obtain the deceleration table Gd greater than or equal to the maximum step time Gd i Step time Gd n , determine each step time Gd n Is it greater than or equal to the heating time Gh m , where n=i, i+1,...,N; If each of the step time Gd n Greater than or equal to the heating time Gh m , then the step time of the current to-be-printed dot row m is determined to be the theoretical step time T m ; Otherwise, the step time of the current to-be-printed dot row m is determined to be Gd i+k , where k=m-1.
7. A printing system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
