Printer motor variable speed control method, printing device, medium, and program product
By acquiring and smoothing the motor speed adjustment parameter set in advance, combined with updating the buffer area, the problem of sudden speed changes in the motor speed control of thermal printers was solved, achieving smooth control of motor speed and improving print quality.
Patent Information
- Application Number
- CN202411237377.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-09-04
AI Technical Summary
Existing methods for controlling the speed of thermal printer motors are difficult to achieve smooth speed changes when dealing with varying print content, resulting in problems such as high motor noise and horizontal lines appearing at the developing position, and also have high computational complexity.
By acquiring a set of motor speed adjustment parameters for a preset number of rows of data to be printed in advance, smoothing them, and storing them in a cache area, the system continuously updates the parameters during the printing process. The system then smoothly controls the motor speed based on the motor speed adjustment parameters for each new row to avoid sudden speed changes.
It achieves smooth control of motor speed, reduces noise and horizontal lines at the developing position, and simplifies computational resource requirements, making it suitable for printing devices with limited storage space.
Smart Images

Figure CN119329200B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of thermal printers, in particular to a printer motor speed control method, a printing device, a medium and a program product. BACKGROUND
[0002] A thermal printer is a device that uses thermal technology to achieve printing functions. It applies heat to thermal paper to make the content to be printed appear on the thermal paper.
[0003] In portable thermal printers, the thermal sheet needs to be dynamically heated for a certain number of heating points corresponding to each row of specific printed content. When the number of heating points is small, the motor can run quickly to improve printing speed; when the number of heating points is large, the motor needs to run at a lower speed to ensure accurate correspondence of the heating position. It can be seen that the speed control effect of the motor is an important indicator for evaluating the performance of the printer during printing.
[0004] However, due to the variability and unpredictability of the printed content, it is often difficult for thermal printers to achieve good motor speed control. The printing speed of the motor is limited by the number of heating points corresponding to different printing lines, the heating performance of the thermal sheet, and the heating control method, and needs to take into account the sudden change of heating time, which brings difficulties to the speed control of the motor. The existing motor speed control method has the phenomenon of speed mutation, which causes problems such as large motor noise and horizontal lines in the developing position during printing.
[0005] There is currently a scheme for smoothing the speed change process of the motor, which calculates the motor heating time required for each row to obtain the peak value, average value and change rate of the heating time and make a change trend judgment, and then calculates the motor heating time of each row according to different change trends, and then determines the corresponding running speed of the motor according to the motor heating time, and reduces the noise generated by the stepping motor during speed change through the smoothing processing of the motor heating time. However, this method needs to obtain N rows of data each time, and then performs least squares fitting on the obtained N rows of data to judge the change trend, which is a complex implementation and does not take into account the problem of speed mutation between the adjacent two N rows of data obtained, and the speed mutation also causes the developing position to be prone to horizontal lines, affecting the printing quality and effect. SUMMARY
[0006] The first object of the present application is to provide a printer motor speed control method with smooth motor speed change and simple implementation.
[0007] The second object of the present application is to provide a computer device for implementing the above-mentioned printer motor speed control method.
[0008] A third object of the present application is to provide a computer readable storage medium for implementing the above-mentioned printer motor variable speed control method.
[0009] A fourth object of the present application is to provide a computer program product for implementing the above-mentioned printer motor variable speed control method.
[0010] To achieve the above-mentioned first object, the present application provides a printer motor variable speed control method, comprising the following steps: obtaining a first motor speed adjustment parameter group of a preset number of rows of to-be-printed data; the first motor speed adjustment parameter group comprises a same number of first motor speed adjustment parameters as the preset number of rows, each first motor speed adjustment parameter corresponding to one row of to-be-printed data; performing smoothing processing on the first motor speed adjustment parameter group to obtain a second motor speed adjustment parameter group, and storing the second motor speed adjustment parameter group in a cache area; the second motor speed adjustment parameter group comprises a same number of second motor speed adjustment parameters as the preset number of rows, each second motor speed adjustment parameter corresponding to one row of to-be-printed data; performing printing based on the cache area, and in the printing process, continuously performing the following steps: obtaining a third motor speed adjustment parameter of a new printing row, the new printing row being separated from a current printing row by a preset number of rows; comparing the third motor speed adjustment parameter of the new printing row with a fourth motor speed adjustment parameter of a last printing row of the new printing row to determine an adjustment area in the cache area starting from the last printing row of the new printing row, performing smoothing processing on the adjustment area, and updating the third speed adjustment parameter, and updating the cache area with the updated third motor speed adjustment parameter.
[0011] As can be seen from the above scheme, this invention obtains a first set of motor speed adjustment parameters for the data to be printed before printing, and smooths it. Based on the obtained second set of motor speed adjustment parameters, the motor is controlled to start printing. During printing, the buffer area is continuously updated according to the newly obtained third set of motor speed adjustment parameters for the new printed line, thereby achieving smooth control of the motor speed and solving the problems of high noise and horizontal lines in the developing image caused by motor speed changes. This invention enables good motor speed control while ensuring the motor strictly corresponds to the heating parameters, effectively addressing the problem of sudden changes in heating time. Furthermore, this invention uses look-ahead planning based on the third set of motor speed adjustment parameters for the new printed line. Compared to obtaining the motor speed adjustment parameters for multiple lines at once and adjusting only the motor speed for those lines, this method requires fewer computational resources and is simpler and more reliable to implement. Furthermore, this invention achieves preprocessing of some printable information before printing and then initiating printing, while continuously receiving other printable information after printing begins, simultaneously performing preprocessing and updating the buffer area. This solves the problem of limited storage space within the thermal printing device for printing operations. Moreover, it provides excellent speed control throughout the printing process, preventing sudden speed changes when printing adjacent lines between two preset number of lines sequentially, thus exhibiting better general applicability. In addition, this invention allows for motor speed adjustment by setting a timer to trigger a speed change when a line is printed, facilitating the adjustment of motor speed parameters for different lines during actual printing.
[0012] A further approach is to smooth the first motor speed adjustment parameter group to obtain the second motor speed adjustment parameter group, which includes: determining the largest first motor speed adjustment parameter in the first motor speed parameter group, setting each first motor speed adjustment parameter in the first motor speed parameter group to the largest first motor speed adjustment parameter, and thus obtaining the second motor speed adjustment parameter group.
[0013] Therefore, it can be seen that by using the speed adjustment parameter of the first motor with the slowest corresponding motor speed as the preset number of rows to start printing, the present invention can ensure that no printing is missed.
[0014] A further solution is to smooth the adjustment area by: starting from the previous print line of the new print line, adjusting the fifth motor speed adjustment parameter of each print line sequentially from back to front in the adjustment area until the difference between two adjacent fifth motor speed adjustment parameters in the cache area according to the execution order does not exceed a preset difference.
[0015] As can be seen, the present invention determines the area that needs to change speed in advance by comparing the motor speed adjustment parameters of the new printed line with those of the corresponding previous printed line, and performs a smooth transition processing on the motor speed adjustment parameters in the area, thereby enabling the motor speed to change smoothly.
[0016] A further approach is to determine the adjustment area by: determining the number of rows to be changed based on the quotient of the difference between the speed adjustment parameters of the third motor and the speed adjustment parameters of the fourth motor and a preset difference, and then determining the adjustment area based on the number of rows to be changed.
[0017] Therefore, it can be seen that the present invention ensures smooth processing of the change in motor speed adjustment parameters of a new row relative to the previous row by adjusting a certain number of consecutive rows.
[0018] A further solution is to update the speed adjustment parameters of the third motor. When updating the cache area based on the updated speed adjustment parameters of the third motor, the following steps are taken: when comparing the speed adjustment parameters of the third motor of the new print line with the speed adjustment parameters of the fourth motor of the previous print line, if the difference between the speed adjustment parameters of the fourth motor and the speed adjustment parameters of the third motor is greater than or equal to a preset difference, the speed adjustment parameters of the third motor are updated to the difference between the speed adjustment parameters of the fourth motor and the preset difference, and the cache area is updated based on the updated speed adjustment parameters of the third motor.
[0019] A further solution is to update the third motor speed adjustment parameter. When updating the buffer area based on the updated third motor speed adjustment parameter, the following steps are taken: when comparing the third motor speed adjustment parameter of the new print line with the fourth motor speed adjustment parameter of the previous print line, if the difference between the fourth motor speed adjustment parameter and the third motor speed adjustment parameter is greater than or equal to 0 and less than a preset difference, the third motor speed adjustment parameter is kept unchanged and updated to the buffer area as the updated third motor speed adjustment parameter.
[0020] Therefore, this invention can ensure smooth acceleration of the motor and prevent drastic acceleration.
[0021] A further solution is to update the third motor speed adjustment parameter. When updating the buffer area based on the updated third motor speed adjustment parameter, the following steps are taken: when comparing the third motor speed adjustment parameter of the new print line with the fourth motor speed adjustment parameter of the previous print line, if the difference between the third motor speed adjustment parameter and the fourth motor speed adjustment parameter is greater than or equal to 0 and less than a preset difference, the third motor speed adjustment parameter is kept unchanged and updated to the buffer area as the updated third motor speed adjustment parameter.
[0022] Therefore, when the motor needs to decelerate, the present invention determines whether it is a severe deceleration by judging a corresponding threshold, and only adjusts by determining the adjustment area when a severe deceleration is determined.
[0023] To achieve the second objective described above, the present invention provides a thermal printing device, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the aforementioned printer motor speed control method.
[0024] To achieve the third objective mentioned above, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the printer motor speed control method described above.
[0025] To achieve the fourth objective mentioned above, the present invention provides a computer program product, including computer instructions, wherein: when the computer instructions are executed by a processor, they implement the printer motor speed control method described above. Attached Figure Description
[0026] Figure 1 This is a system block diagram of the printing system in an embodiment of the printer motor speed control method of the present invention.
[0027] Figure 2 This is a flowchart illustrating the execution of a thermal printing device in an embodiment of the printer motor speed control method of the present invention.
[0028] Figure 3 This is a schematic diagram illustrating the changes in motor speed adjustment parameters in an embodiment of the printer motor speed control method of the present invention.
[0029] The present invention will be further described below with reference to the accompanying drawings and embodiments. Detailed Implementation
[0030] The printer motor speed control method of the present invention achieves good motor speed control by proactively planning the motor speed adjustment parameters for a certain number of lines. The present invention also provides a printing apparatus, a computer-readable storage medium, and a computer program product for implementing the above-described printer speed control method.
[0031] Example of printer motor speed control method:
[0032] See Figure 1 The printing system of this embodiment includes a terminal device 1 and a thermal printing device 2, with the terminal device 1 connected to the thermal printing device 2.
[0033] Terminal device 1 can be a device that provides data to be printed, such as a personal computer, smartphone, or tablet.
[0034] The thermal printing unit 2 contains a motor, a rubber roller, and a thermal sheet. The motor is connected to the rubber roller, and the rubber roller and the thermal sheet are positioned opposite each other. During use, the thermal paper is tightly clamped between the thermal sheet and the rubber roller. The motor drives the rubber roller to rotate, and as the roller rotates, it moves the thermal paper along the paper output direction to feed the paper. The heating point of the thermal sheet heats up, causing the printed content to appear on the passing thermal paper.
[0035] Terminal device 1 and thermal printing device 2 can communicate via wired or wireless network. Thermal printing device 2 can then separate and parse the information to be printed obtained from terminal device 1 based on the set communication protocol, thereby realizing the printing operation.
[0036] After obtaining the printing information from the terminal device 1, the thermal printing device 2 controls the motor to feed paper for printing based on the printer speed control method of this embodiment. See [link to relevant documentation]. Figure 2 The thermal printing device 2 specifically performs the following steps:
[0037] First, perform step S1: Obtain the information to be printed.
[0038] In this embodiment, a portion of the information to be printed is first acquired and processed. While printing begins, other information to be printed is continuously acquired to synchronously update the storage space of the thermal printing device. This process is repeated to achieve printing operations on all the information to be printed corresponding to the current printing content, thus enabling the reuse of the storage space.
[0039] Continue with step S2: preprocess some of the data to be printed to obtain the first set of motor speed adjustment parameters.
[0040] Specifically, the information to be printed is separated and parsed according to the set communication protocol. That is, the information to be printed is divided into a preset number of rows of data to be printed, and the number of heating points on the thermal sheet corresponding to each row of data to be printed is obtained.
[0041] Based on the number of heating points in each row of data to be printed, and combined with the heating speed of the thermal sheet, the heating duration for each row can be calculated. This allows for the determination of the paper feeding time for each row, ensuring that the paper feeding time is not less than the heating duration. The paper feeding time for each row is then used as a motor speed adjustment parameter to regulate the motor speed for that row. This results in a first set of motor speed adjustment parameters, comprising multiple parameters equal to the preset number of rows. Each parameter corresponds one-to-one with a row of data to be printed. For example, if the acquired partial printing information includes N rows of data, then there are N first motor speed adjustment parameters. The first row corresponds to the first parameter, the second row to the second, and so on. Therefore, during printing, the motor speed can be controlled according to the first parameter to print the first row of data, and according to the second parameter to print the second row.
[0042] See Figure 3 In this embodiment, N is 16, and part of the data to be printed consists of 16 rows. After preprocessing this part of the data to be printed, the first motor speed adjustment parameter group is {3,12,16,5,7,14,3,7,3,2,16,5,7,14,3,7}. The first motor speed adjustment parameter corresponding to the first row of data to be printed is 3, and the first motor speed adjustment parameter corresponding to the second row of data to be printed is 12.
[0043] Without considering the smooth transition of motor speed changes, the motor speed and heating time information for each line of data to be printed are one-to-one. However, since the number of heating points between different lines is not exactly the same, if the motor operates solely based on the calculated paper feed time, or according to the first motor speed adjustment parameters corresponding to each line, sudden changes in motor speed will inevitably occur. Therefore, it is necessary to smooth the paper feed time, that is, to smooth the first motor speed adjustment parameter group.
[0044] In different embodiments, the process of preprocessing part of the data to be printed described above can also be performed by the terminal device, so that the thermal printing device can directly obtain the first motor speed adjustment parameter group from the terminal device.
[0045] Then, step S3 is executed: the first motor speed adjustment parameter group is smoothed to obtain the second motor speed adjustment parameter group.
[0046] First, the largest first motor speed adjustment parameter in the first motor speed adjustment parameter group is determined. Then, each first motor speed adjustment parameter in the first motor speed adjustment parameter group is set to the largest first motor speed adjustment parameter, thereby obtaining the second motor speed adjustment parameter group.
[0047] See Figure 3 In this embodiment, the largest first motor speed adjustment parameter in the first motor speed adjustment parameter group is 16. Then, the second motor speed adjustment parameter group obtained after smoothing the first motor speed adjustment parameter group is {16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16}.
[0048] Then execute step S4: store the second motor speed adjustment parameter group into the cache area.
[0049] Then proceed to step S5: perform a printing operation based on the buffer area.
[0050] When step S5 is executed for the first time, since the buffer area stores the second motor speed adjustment parameter group corresponding to N rows of data to be printed, the thermal printing device sequentially reads the buffer area (the buffer area includes N addresses, which are read in address order, and the second motor speed adjustment parameters are stored in address order). The device then controls the motor speed to start printing line by line using the second motor speed adjustment parameters stored therein.
[0051] See Figure 3 In this embodiment, the motor speed adjustment parameters corresponding to each print line from line 1 to line 16 are determined when printing begins, i.e., the actual values. At this time, each print line read sequentially by the thermal printing device is the second motor speed adjustment parameter.
[0052] S6: Determine whether the third motor speed adjustment parameters for the new print line have been obtained.
[0053] The third motor speed adjustment parameter is the motor speed adjustment parameter obtained for the new print line. During printing, data preprocessing and updating the motor speed adjustment parameter are performed simultaneously, with the new print line separated from the actual print line by a preset number of lines. For example, if N lines of data to be printed are processed first, the preset number of lines is N. If the current actual line is the first line, the new print line is N+1 lines; if the current actual line is the second line, the new print line is N+2 lines. The third motor speed adjustment parameter is derived from the parsing of newly received information to be printed from other parts.
[0054] See Figure 3In this embodiment, the preset number of rows is 16. When the current actual behavior is the first row, the new printing behavior is the 17th row. At this time, another part of the information to be printed will be received. After separating, parsing and preprocessing the information to be printed, the third motor adjustment parameters corresponding to the 17th row are obtained. At this time, the third motor adjustment parameters of the 17th row are obtained as 28. Similarly, when the current actual behavior is the second row, the third motor adjustment parameters of the 18th row are obtained as 12.
[0055] Therefore, by determining whether the third motor speed adjustment parameter has been obtained, it can be determined that the printing has been completed. If the third speed adjustment parameter has not been obtained, step S9 is executed to determine whether the printing content corresponding to the information to be printed has been completed. If yes, the printing ends; if no, return to step S5 and continue printing according to the actual value corresponding to each print line stored in the buffer area. If the third speed adjustment parameter has been obtained, step S7 is executed.
[0056] Then, step S7 is executed: the speed adjustment parameters of the third motor are compared with those of the fourth motor to determine the adjustment area, the adjustment area is smoothed, and the speed adjustment parameters of the third motor are updated.
[0057] The fourth motor speed adjustment parameter is the motor speed adjustment parameter corresponding to the previous printed line of the new printed line. The number of lines to be changed from the new printed line is determined by the quotient of the difference between the third and fourth motor speed adjustment parameters and the preset difference, and then the adjustment area is determined based on the number of lines to be changed.
[0058] Therefore, the fifth motor speed adjustment parameter is adjusted sequentially from back to front within the adjustment area until the difference between two adjacent fifth motor speed adjustment parameters executed in the buffer area does not exceed a preset difference. The fifth motor speed adjustment parameter represents the motor speed adjustment parameter within the buffer area during the smoothing process of the adjustment area. The selection of the preset difference affects the rate of change of motor speed and is determined by adjusting according to the characteristics of the specific motor used.
[0059] For example, when entering step S7 for the first time, the new print line is line N+1, and the previous print line is line N. Let the speed adjustment parameter of the third motor for line N+1 be T. n+1 Let the speed adjustment parameter of the fourth motor in the Nth row be T. n If the preset difference is a, and a>0, then through (T) n+1 -T n The ` / a` operator can determine the number of rows to be changed. The adjustment area is the set of motor speed adjustment parameters preceding the Nth motor speed adjustment parameter in the buffer area, where this set of parameters is the same as the number of rows to be changed. Specifically, it includes:
[0060] First, compare the third motor speed adjustment parameter of the new printed line with the fourth motor speed adjustment parameter of the previous printed line of the new printed line. The following situations exist: (1) When the difference between the fourth motor speed adjustment parameter and the third motor speed adjustment parameter is greater than or equal to the preset difference, that is, T n -T n+1 ≥a, then the third motor speed adjustment parameter needs to be updated to the difference between the fourth motor speed adjustment parameter and the preset difference, that is, T n -a. The meaning at this time is that the increase in the motor speed of the (N + 1)-th line relative to the motor speed of the N-th line is large, and slow acceleration needs to be performed according to the value of a; (2) When the difference between the fourth motor speed adjustment parameter and the third motor speed adjustment parameter is greater than or equal to 0 and less than the preset difference, that is, 0 ≤ T n -T n+1 <a, then the third motor speed adjustment parameter needs to be maintained as the actual T n+1 . The meaning at this time is that the increase in the motor speed of the (N + 1)-th line relative to the motor speed of the N-th line is small, and slow acceleration can be achieved by directly controlling the motor speed according to T n+1 ; (3) When the difference between the third motor speed adjustment parameter and the fourth motor speed adjustment parameter is greater than or equal to 0 and less than the preset difference, that is, 0 ≤ T n+1 -T n <a, then the third motor speed adjustment parameter needs to be maintained as the actual T n+1 . The meaning at this time is that the decrease in the motor speed of the (N + 1)-th line relative to the motor speed of the N-th line is small, and slow deceleration can be achieved by directly controlling the motor speed according to T n+1 ; (4) When the difference between the third motor speed adjustment parameter and the fourth motor speed adjustment parameter is greater than the preset difference, that is, T n+1 -T n ≥a, then the third motor speed adjustment parameter needs to be maintained as T n+1 . At this time, since the decrease in the motor speed of the (N + 1)-th line relative to the motor speed of the N-th line is large, it is necessary to determine the adjustment area, and perform preview control on the fifth motor speed adjustment parameter within the adjustment area and starting from the N-th line forward, and decelerate in advance to prevent the motor from decelerating violently at the (N + 1)-th line. Therefore, there is an actual adjustment area only when the third motor speed adjustment parameter of the new printed line is greater than the fourth motor speed adjustment parameter of the previous printed line to a certain extent. At this time, the motor speed of the new printed line is a violent deceleration relative to the motor speed of the previous printed line.
[0061] Then, for the situations in (1), (2), and (3) above, when calculating the quotient of (T n+1 -T n ) / a, a number greater than or equal to 1 cannot be obtained, and the number of lines to be changed is 0 for all. For the situation in (4) above, (T n+1-T n The quotient of (T) / a is a number greater than or equal to 1. n+1 -T n The quotient of ) / a can determine the number of rows that need to be changed, (T) n+1 -T n When the quotient of ) / a is not an integer, the number of rows to be changed is determined based on the integer part. Assume the calculated result is (T) n+1 -T n The quotient of ) / a is 3. Therefore, the adjustment area starts from row N and proceeds forward 3 rows. The adjustment area consists of rows N, N-1, and N-2. Adjustments are made sequentially starting from row N. For example, if the speed adjustment parameter for the fifth motor corresponding to row N is determined to be T... n+1 -a, determines the speed adjustment parameter of the fifth motor corresponding to the (N-1)th row as T. n+1 -2a, determine the speed adjustment parameter of the fifth motor corresponding to the N-2th row as T. n+1 -3a.
[0062] It should be noted that the calculation of the fifth motor speed adjustment parameter to be changed stops when the difference between two adjacent fifth motor speed adjustment parameters in the buffer area according to the printing order does not exceed the value 'a'. For example, during the adjustment process, the fifth motor speed adjustment parameter corresponding to the N-2th row in the buffer area is T. n+1 -2a, the speed adjustment parameter for the fifth motor corresponding to the N-1th row is T. n+1 -2a, the speed adjustment parameter for the fifth motor corresponding to the Nth row is T. n+1 -3a, the speed adjustment parameter for the third motor corresponding to the N+1th line of the new print line is T. n+1 When adjusting from the Nth row backwards, the Nth row is T. n+1 The speed regulation parameter of the fifth motor of -3a is adjusted to T. n+1 After -a, the speed adjustment parameters of the two fifth motors in the buffer area according to the printing order are now no more than a, so there is no need to continue adjusting the N-2 and N-1 lines.
[0063] See Figure 3In this embodiment, the preset difference a = 3, which corresponds to the situation in (4) above: when step S7 is executed for the first time, the new printing line is the 17th line, the third motor speed adjustment parameter corresponding to the 17th line is 28, the previous printing line of the new printing line is the 16th line, the fourth motor speed adjustment parameter corresponding to the 16th line is 16. Since the difference between 28 and 16 is greater than or equal to 3, the quotient of (28-16) / 3 is 4, so the number of lines to be changed is determined to be 4. Then, the 4 lines from the 16th line forward are the adjustment area, namely the 16th line, the 15th line, the 14th line and the 13th line. Then, a smoothing adjustment area is performed. During this process, the speed adjustment parameters of the fifth motors in the buffer area, arranged in printing order, are {16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16}. The fifth motor adjustment parameter in row 16 is adjusted to 25 (obtained by 28-3), the fifth motor adjustment parameter in row 15 is adjusted to 22 (obtained by 28-3*2), and the fifth motor adjustment parameter in row 14 is adjusted to 19 (obtained by 28-3*3). At this point, the speed adjustment parameters of the fifth motors in the buffer area, arranged in printing order, are {16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,19,22,25}. This satisfies the condition that the difference between any two adjacent fifth motor speed adjustment parameters in the buffer area, in printing order, does not exceed 3, thus completing the smoothing process of the adjustment area. At this point, the updated third motor speed adjustment is 28. Corresponding to the situation in (2) above: When step S7 is executed for the fourth time, the new printed line is line 20, and the third motor speed adjustment parameter corresponding to line 20 is 36. The previous printed line is line 19, and the fourth motor speed adjustment parameter corresponding to line 19 is 38. Since the difference between 38 and 36 is greater than or equal to 0 and less than 3, the third motor speed adjustment parameter for line 20 remains at 36. Furthermore, the number of lines to be changed, determined by the quotient of (36-38) / 3, is 0. At this point, the updated third motor speed adjustment parameter is 36. The situation corresponding to (1) above is as follows: When step S7 is executed for the 5th time, the new printed line is line 21, and the third motor speed adjustment parameter corresponding to line 21 is 25. The previous printed line is line 20, and the fourth motor speed adjustment parameter corresponding to line 20 is 36. Since the difference between 36 and 25 is greater than 3, the third motor speed adjustment parameter of line 21 is set to 33 (obtained by 36-3). In addition, the number of lines to be changed determined by the quotient of (25-36) / 3 is 0. At this time, the updated third motor speed adjustment parameter is 33.The situation corresponding to (3) above is as follows: When step S7 is executed for the 7th time, the new printed line is line 23, and the third motor speed adjustment parameter corresponding to line 23 is 32. The previous printed line is line 22, and the fourth motor speed adjustment parameter corresponding to line 22 is 30. Since the difference between 32 and 30 is greater than or equal to 0 and less than 3, the third motor speed adjustment parameter of line 23 remains at 32. In addition, the number of lines to be changed determined by the quotient of (32-30) / 3 is 0. At this time, the updated third motor speed adjustment parameter is 32.
[0064] S8: Update the speed adjustment parameters of the third motor to the cache area.
[0065] After smoothing the adjustment area as described above, the updated third motor speed adjustment parameters determined in step S7 are updated in the buffer area, and then the process returns to step S5 to continue printing. For example, when the thermal printer controls the motor to print the second line of data to be printed according to the second address of the buffer area, the third motor speed adjustment parameters corresponding to the N+1th line have already been updated in the first address of the buffer area.
[0066] See Figure 3 In this embodiment, the first adjustment is completed after the first execution of step S8. At this time, the motor speed adjustment parameters stored in the buffer area can be arranged in the printing order as {16,16,16,16,16,16,16,16,16,16,16,16,16,19,22,25,28}. Similarly, the second adjustment is completed after the second execution of step S8. At this time, the motor speed adjustment parameters stored in the buffer area can be arranged in the printing order. The parameters can be arranged as {16,16,16,16,16,16,16,16,16,16,16,16,19,22,25,28,25}. After the 7th execution of step S8, the 7th adjustment is completed. At this time, the motor speed adjustment parameters stored in the buffer area can be arranged in the printing order as {16,16,16,17,20,23,26,29,32,35,38,36,33,33,30,32}.
[0067] In summary, this invention enables smooth control of motor acceleration and deceleration, effectively addressing the issue of sudden changes in heating time. Furthermore, this invention requires fewer hardware resources, is simple and reliable to implement, provides excellent speed control, and has greater general applicability.
[0068] Example of a thermal printing device:
[0069] The thermal printing device of this embodiment includes a processor and a memory. The memory stores a computer program, and when the processor executes the computer program, it implements the above-described printer motor speed control method embodiment.
[0070] Thermal printing apparatus may include, but is not limited to, a processor and memory. Those skilled in the art will understand that a thermal printing apparatus may include more or fewer components, or a combination of certain components, or different components; for example, a thermal printing apparatus may also include input / output devices, network access devices, buses, etc.
[0071] For example, the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microcontroller or any conventional processor. The processor is the control center of the thermal printing device, connecting all parts of the device via various interfaces and lines.
[0072] The memory can be used to store computer programs and / or modules. The controller implements various functions of the thermal printing device by running or executing the computer programs and / or modules stored in the memory, and by calling data stored in the memory. For example, the memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function, etc.; the data storage area may store data created according to the use of the thermal printing device, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart memory card (SMC), secure digital (SD) card, flash memory card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0073] Examples of computer-readable storage media:
[0074] If the modules integrated into the thermal printing device of the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes of the printer motor speed control method embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a controller, it can implement the steps of the above printer motor speed control method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The storage medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0075] Example of a computer program product:
[0076] The computer program product of this embodiment includes computer instructions stored in a computer-readable storage medium. The processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the various steps of the above-described printer motor speed control method embodiment.
Claims
1. A method for controlling the speed of a printer motor, characterized in that, Includes the following steps: A first motor speed adjustment parameter group is obtained for a preset number of rows of data to be printed; the first motor speed adjustment parameter group includes the same number of first motor speed adjustment parameters as the preset number of rows, and each first motor speed adjustment parameter corresponds one-to-one with a row of data to be printed; The first motor speed adjustment parameter group is smoothed to obtain the second motor speed adjustment parameter group, and the second motor speed adjustment parameter group is stored in the cache area; The second motor speed adjustment parameter group includes the same number of second motor speed adjustment parameters as the preset number of rows, and each second motor speed adjustment parameter corresponds one-to-one with a row of data to be printed; Printing is performed based on the aforementioned buffer area, and the following steps are continuously executed during the printing process: Obtain the third motor speed adjustment parameters for the new print line, wherein the new print line is separated from the current print line by the preset number of lines; The adjustment region in the buffer area starting from the previous print line is determined by comparing the third motor speed adjustment parameter of the new print line with the fourth motor speed adjustment parameter of the previous print line. The adjustment region is smoothed, and the third motor speed adjustment parameter is updated. The updated third motor speed adjustment parameter is then updated to the buffer area. Smoothing the adjusted area includes: Starting from the previous print line of the new print line, the fifth motor speed adjustment parameter of each print line is adjusted sequentially from back to front in the adjustment area until the difference between two adjacent fifth motor speed adjustment parameters in the cache area according to the execution order does not exceed a preset difference. Determining the adjustment area includes: The number of rows to be changed is determined by the quotient of the difference between the speed adjustment parameters of the third motor and the speed adjustment parameters of the fourth motor and the preset difference, and the adjustment area is determined based on the number of rows to be changed.
2. The printer motor speed control method as described in claim 1, characterized in that, Includes the following steps: When smoothing the first motor speed adjustment parameter set to obtain the second motor speed adjustment parameter set, the following steps are included: Determine the largest first motor speed adjustment parameter in the first motor speed adjustment parameter group, and set each first motor speed adjustment parameter in the first motor speed adjustment parameter group to the largest first motor speed adjustment parameter to obtain the second motor speed adjustment parameter group.
3. The printer motor speed control method as described in claim 2, characterized in that: Updating the third motor speed adjustment parameter and updating the buffer area based on the updated third motor speed adjustment parameter includes: comparing the third motor speed adjustment parameter of the new print line with the fourth motor speed adjustment parameter of the previous print line of the new print line; if the difference between the fourth motor speed adjustment parameter and the third motor speed adjustment parameter is greater than or equal to the preset difference, then the third motor speed adjustment parameter is updated to the difference between the fourth motor speed adjustment parameter and the preset difference, and the buffer area is updated based on the updated third motor speed adjustment parameter.
4. The printer motor speed control method as described in claim 2, characterized in that: When updating the third motor speed adjustment parameter and updating the buffer area according to the updated third motor speed adjustment parameter, the following steps are included: when comparing the third motor speed adjustment parameter of the new printed line with the fourth motor speed adjustment parameter of the previous printed line of the new printed line, if the difference between the fourth motor speed adjustment parameter and the third motor speed adjustment parameter is greater than or equal to 0 and less than the preset difference, then the third motor speed adjustment parameter is kept unchanged and updated to the buffer area as the updated third motor speed adjustment parameter.
5. The printer motor speed control method as described in claim 2, characterized in that: When updating the third motor speed adjustment parameter and updating the buffer area according to the updated third motor speed adjustment parameter, the following steps are included: when comparing the third motor speed adjustment parameter of the new print line with the fourth motor speed adjustment parameter of the previous print line of the new print line, if the difference between the third motor speed adjustment parameter and the fourth motor speed adjustment parameter is greater than or equal to 0 and less than the preset difference, then the third motor speed adjustment parameter is kept unchanged and updated to the buffer area as the updated third motor speed adjustment parameter.
6. A thermal printing apparatus, comprising a processor and a memory, characterized in that: The memory stores a computer program, which, when executed by the processor, implements the printer motor speed control method according to any one of claims 1 to 5.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the printer motor speed control method according to any one of claims 1 to 5.
8. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by the processor, they implement the printer motor speed control method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method for reducing operation noise of stepping motor of thermal printer
CN112937134A
Printing data processing method and electronic equipment
CN113805808A