A printing method, apparatus, device and medium

CN121716422BActive Publication Date: 2026-08-14JIANGMEN DASCOM COMP PERIPHERAL
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-18
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

但实际应用中,该方式易受外部因素影响产生偏差,如皮带松紧,齿轮间隙,润滑油少了导致的摩擦力增加等影响,导致出针位置和理论偏差较大

Benefits of technology

[0015]本申请实施例提供的一种打印方法、打印装置、打印设备和计算机可读存储介质。该方法中,先配置控制印头出针的微步信号,其中,微步信号用于计量印头的实际移动距离和触发印头的出针时机,其生成基于光栅物理精度与打印目标精度的匹配关系;接着配置同步脉冲,其中,同步脉冲为微步信号的同步基准,同步脉冲包含预设数量的微步信号;然后根据微步信号控制印头出针,同时通过同步脉冲校准微步信号与光栅信号的相位关系,直至完成打印内容。通过光栅信号直接获取印头实际位置,微步信号实现精细计量,同步脉冲动态适配速度变化,能够有效消除皮带松紧、齿轮间隙等外部因素的影响,适配加减速等特殊打印场景,从而有效提升针式打印机的打印精度与稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121716422B_ABST
    Figure CN121716422B_ABST
Patent Text Reader

Abstract

This application discloses a printing method, apparatus, device, and medium. In this method, firstly, micro-stepping signals are configured to control the printhead needle ejection. These micro-stepping signals are used to measure the actual movement distance of the printhead and trigger the needle ejection timing, and their generation is based on the matching relationship between the physical precision of the grating and the printing target precision. Next, synchronization pulses are configured, whereby the synchronization pulses serve as the synchronization reference for the micro-stepping signals and contain a preset number of micro-stepping signals. Then, the printhead needle ejection is controlled according to the micro-stepping signals, while simultaneously calibrating the phase relationship between the micro-stepping signals and the grating signals through the synchronization pulses, until the printing content is completed. By directly obtaining the actual position of the printhead through the grating signal, achieving precise measurement through the micro-stepping signals, and dynamically adapting to speed changes through the synchronization pulses, the influence of external factors such as belt tension and gear clearance can be effectively eliminated, adapting to special printing scenarios such as acceleration and deceleration, thereby effectively improving the printing accuracy and stability of the dot matrix printer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to, but is not limited to, the field of printing technology, and particularly to a printing method, apparatus, device, and medium. Background Technology

[0002] The needle ejection accuracy of a dot matrix printer depends on the matching degree between the needle ejection timing and the actual position of the printhead. Current mainstream control methods rely on stepper motors to count and calculate the position, thereby controlling needle ejection. However, in practical applications, this method is easily affected by external factors, such as belt tension, gear clearance, and increased friction due to insufficient lubrication, leading to significant deviations between the needle ejection position and the theoretical value. Especially in special applications requiring accelerated or decelerated printing, print quality cannot be guaranteed. Summary of the Invention

[0003] The following is an overview of the subject matter described in detail herein. This overview is not intended to limit the scope of the claims.

[0004] This application provides a printing method, apparatus, device, and medium that can effectively improve the printing accuracy and stability of dot matrix printers.

[0005] In a first aspect, embodiments of this application provide a printing method, the method comprising: configuring microstep signals to control the needle ejection of the print head, the microstep signals being used to measure the actual movement distance of the print head and trigger the needle ejection timing of the print head, the microstep signals being generated based on the matching relationship between the physical precision of the grating and the precision of the printing target; configuring a synchronization pulse, the synchronization pulse being a synchronization reference for the microstep signals, the synchronization pulse containing a preset number of microstep signals; controlling the needle ejection of the print head according to the microstep signals, and simultaneously calibrating the phase relationship between the microstep signals and the grating signals through the synchronization pulses, until the printing content is completed.

[0006] In one embodiment of this application, the method further includes: acquiring two orthogonal pulse signals output by a grating sensor, wherein one period of the grating sensor is one basic grating unit; determining the movement direction of the print head based on the trigger edge of one of the two orthogonal pulse signals and the current level state of the other; and performing position counting on the movement distance of the print head based on the accuracy of the basic grating unit to obtain the movement distance of the print head, wherein the position counting is used to assist in calibrating the measurement benchmark of the microstep signal.

[0007] In one embodiment of this application, the step of generating the microstep signal includes: obtaining the physical precision of the grating and the printing target precision; determining the number of subdivisions of the grating precision according to the ratio between the physical precision of the grating and the printing target precision; subdividing the grating precision according to the number of subdivisions to generate the microstep signal.

[0008] In one embodiment of this application, the step of calibrating the phase relationship between the microstep signal and the grating signal by synchronizing the pulse includes: detecting the deviation between the actual moving speed and the theoretical speed of the print head; if the actual moving speed is slower than the theoretical speed, after all the preset number of microstep signals between two synchronizing pulses have been generated, waiting for the next synchronizing pulse to trigger before starting the generation of subsequent microstep signals; if the actual moving speed is faster than the theoretical speed, when the synchronizing pulse is detected before the preset number of microstep signals between two synchronizing pulses have been fully generated, shortening the generation cycle of the remaining microstep signals, and after generating the remaining microstep signals, starting the generation of subsequent microstep signals according to the theoretical cycle.

[0009] In one embodiment of this application, controlling the printhead needle ejection according to the microstep signal includes: determining the target needle ejection position of the content to be printed and the corresponding grating reference position; calculating the position difference between the target needle ejection position and the grating reference position; compensating the position difference according to the physical parameters of the printhead to obtain an actual compensation difference value; converting the actual compensation difference value into a microstep signal count; and triggering the first needle ejection of the printhead when the cumulative number of microstep signals for the printhead needle ejection reaches the microstep signal count.

[0010] In one embodiment of this application, after controlling the print head to eject needles according to the microstep signal count, the method further includes: after the first needle ejection, calculating the number of microstep intervals for subsequent needle ejections based on the ratio between the microstep signal accuracy and the printing target accuracy; counting the microstep signal, and triggering the print head to eject a subsequent needle each time the number of microstep intervals is reached, until the printing content corresponding to the target needle ejection position is completed.

[0011] In one embodiment of this application, determining the corresponding grating reference position includes: obtaining the movement path of the print head based on the target needle position; and selecting the nearest actual grating position in the movement path that can be detected by two orthogonal pulse signals as the grating reference position.

[0012] Secondly, embodiments of this application provide a precise needle ejection control device for a dot-matrix printhead. The device includes: a grating signal acquisition module for acquiring two orthogonal pulse signals output by a grating sensor, wherein one cycle of the grating sensor is one basic grating unit; a microstep configuration module for configuring microstep signals to control the needle ejection of the printhead, wherein the microstep signals are used to measure the actual movement distance of the printhead and trigger the needle ejection timing, and the microstep signals are generated based on the matching relationship between the physical precision of the grating and the precision of the printing target; a pulse configuration module for configuring a synchronization pulse, wherein the synchronization pulse is the synchronization reference of the microstep signals, and the synchronization pulse contains a preset number of microstep signals; and a needle ejection control module for controlling the needle ejection of the printhead according to the microstep signals, and simultaneously calibrating the phase relationship between the microstep signals and the grating signals through the synchronization pulses until the printing content is completed.

[0013] On the other hand, embodiments of this application provide a printing device including at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method described above.

[0014] On the other hand, embodiments of this application provide a computer-readable storage medium storing computer program instructions that, when executed by a processor, implement the method described above.

[0015] This application provides a printing method, printing apparatus, printing device, and computer-readable storage medium. The method first configures micro-step signals to control the printhead needle ejection. These micro-step signals measure the actual movement distance of the printhead and trigger the needle ejection timing, and are generated based on a matching relationship between the physical precision of the grating and the printing target precision. Next, a synchronization pulse is configured, which serves as the synchronization reference for the micro-step signals and contains a preset number of micro-step signals. Then, the printhead needle ejection is controlled according to the micro-step signals, while the phase relationship between the micro-step signals and the grating signals is calibrated using the synchronization pulse until the printing content is completed. By directly obtaining the actual position of the printhead through the grating signal, achieving precise measurement through the micro-step signals, and dynamically adapting to speed changes through the synchronization pulse, the influence of external factors such as belt tension and gear clearance can be effectively eliminated, adapting to special printing scenarios such as acceleration and deceleration, thereby effectively improving the printing accuracy and stability of the dot matrix printer. Attached Figure Description

[0016] Figure 1 This is a block diagram of the printing function provided in the embodiments of this application;

[0017] Figure 2 This is a flowchart of the printing method provided in the embodiments of this application;

[0018] Figure 3This is a flowchart of a printing method provided in another embodiment of this application;

[0019] Figure 4 This is a grating waveform diagram provided in one embodiment of this application;

[0020] Figure 5 This is a pulse waveform diagram provided in one embodiment of this application;

[0021] Figure 6 This is provided in one embodiment of the present application. Figure 2 The detailed flowchart of step 230;

[0022] Figure 7 This is a schematic diagram of pulse synchronization operation provided in one embodiment of this application;

[0023] Figure 8 This is a block diagram of the printing device provided in the embodiments of this application. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0025] It should be noted that although the flowchart shows a logical order, in some cases, the steps shown or described may be performed in a different order than that shown in the flowchart. The terms "first," "second," etc., used in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the structures, proportions, sizes, etc., depicted in the drawings are only used to complement the content disclosed in the specification for those skilled in the art to understand and read, and are not intended to limit the implementation conditions of this application. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in proportions, or adjustments to size, without affecting the effects and purposes achieved by this application, should still fall within the scope of the technical content disclosed in this application. Similarly, the terms such as "upper," "lower," "left," "right," "middle," and "one" used in this specification are only for clarity of description and are not used to limit the scope of implementation of this application. Changes or adjustments in their relative relationships, without substantially altering the technical content, should also be considered within the scope of implementation of this application.

[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0027] The core working principle of a dot matrix printer is that the print head moves along the printing medium via the carriage, while the print needles inside the print head strike the ink ribbon to form characters or patterns. The accuracy of the print head's needle ejection timing directly determines the print quality. Currently, the mainstream method for print head position control in the industry is to calculate the actual position of the print head using a counting stepper motor (STEP, basic action unit), and then control the needle ejection. However, this method is highly susceptible to external factors in practical applications, leading to significant deviations between the actual and theoretically calculated positions of the print head. For example, the drive belt of the carriage (i.e., the print head mounting frame) may loosen after prolonged use or experience tension fluctuations due to temperature changes. In such cases, although the stepper motor completes the preset number of steps, the actual distance the belt drives the print head to move will be less than the theoretical value, causing the print head to move lag. Furthermore, inherent gaps exist between the gears in the transmission mechanism. When the print head needs to move in the opposite direction (e.g., reverse printing after a line break), the stepper motor will first idle for a certain number of steps to eliminate the gear gaps before driving the print head to move, resulting in a misalignment between the theoretically calculated and actual print head positions. Reduced lubrication or dust accumulation in the transmission guide rails or motor bearings can significantly increase the frictional force on the print head, causing the actual speed of the stepper motor to be lower than the theoretical speed, resulting in a slower print head movement and further widening the deviation between the theoretical and actual positions.

[0028] The aforementioned problems already cause misaligned characters and uneven line thickness in normal constant-speed printing scenarios. In special application scenarios such as accelerated and decelerated printing, the deviation will be more obvious: the print head will deviate from the theoretical position due to inertia, and the stepper motor's STEP count cannot match the dynamic inertial movement of the print head in real time, ultimately resulting in the inability to guarantee the printing effect.

[0029] In view of this, embodiments of this application provide a printing method, a printing apparatus, a printing device, and a computer-readable storage medium. In this method, firstly, micro-stepping signals are configured to control the printhead needle ejection. These micro-stepping signals are used to measure the actual movement distance of the printhead and trigger the needle ejection timing, and their generation is based on a matching relationship between the physical precision of the grating and the printing target precision. Next, a synchronization pulse is configured, where the synchronization pulse serves as a synchronization reference for the micro-stepping signals and contains a preset number of micro-stepping signals. Then, the printhead needle ejection is controlled according to the micro-stepping signals, while simultaneously calibrating the phase relationship between the micro-stepping signals and the grating signals using the synchronization pulses, until the printed content is completed. By directly obtaining the actual position of the printhead through the grating signal, achieving precise measurement through the micro-stepping signals, and dynamically adapting to speed changes through the synchronization pulses, the influence of external factors such as belt tension and gear clearance can be effectively eliminated, adapting to special printing scenarios such as acceleration and deceleration, thereby effectively improving the printing accuracy and stability of the dot matrix printer.

[0030] The embodiments of this application will be further described below with reference to the accompanying drawings.

[0031] In a feasible embodiment, the control logic of this application can be implemented based on the functional modules inside an integrated circuit (IC), and the core hardware signals and modules are as follows: Figure 1 As shown, HPSA / HPSB are the raster signal input ports, receiving two orthogonal pulse signals output by the raster sensor to detect the actual movement of the print head. Rasterdecode & Print control is the core module for raster signal processing and needle output control, responsible for parsing HPSA / HPSB signals, calculating positions, generating microstep signals, and needle output control logic. HP[23:0] are print head control pins, supporting up to 24-pin needle print heads, with each pin corresponding to the needle output control of one needle. Data-buffer is the data buffer module, storing the data to be printed and configuration parameters such as the initial position of the needle and DPI. APB Regblock is the Advanced Peripheral Bus (APB) register module, configuring parameters such as PRINT_INIT_POSn (initial position calculator for each needle) and PRINT_DPI_SET (print DPI configuration register) through the APB bus.

[0032] Reference Figure 2 , Figure 2 This is a flowchart of the printing method provided in the embodiments of this application. The process may specifically include, but is not limited to, steps 210 to 230.

[0033] Step 210: Configure the microstep signal to control the needle output of the print head. The microstep signal is used to measure the actual movement distance of the print head and trigger the needle output of the print head. The microstep signal is generated based on the matching relationship between the physical accuracy of the grating and the accuracy of the printing target.

[0034] Step 220: Configure the synchronization pulse, wherein the synchronization pulse is the synchronization reference for the microstep signal, and the synchronization pulse contains a preset number of microstep signals;

[0035] Step 230: Control the printhead needles according to the microstep signal, and at the same time calibrate the phase relationship between the microstep signal and the raster signal through the synchronization pulse until the printing content is completed.

[0036] Steps 210 to 230 will be described in detail below.

[0037] In one feasible embodiment, in step 210, the physical precision of the grating refers to the number of grating lines per inch of the grating sensor (unit: lines per inch, LPI). The physical distance between two adjacent grating lines corresponds to one cycle of the physical precision of the grating (i.e., the basic grating unit LAB). For example, 300 LPI means there are 300 grating lines per inch, and the spacing between two adjacent grating lines is 1 / 300 inch. The printing target precision refers to the number of printing dots that the print head needs to form per inch (unit: dots per inch, DPI). For example, 1200 DPI means that 1200 dots need to be printed per inch, and the ideal spacing between two adjacent dots is 1 / 1200 inch.

[0038] It should be noted that, since the printing precision of some parts of a dot matrix printer, the shape parameters of the printhead, and the precision of the grating are not necessarily integer multiples, the physical precision of the grating can be further subdivided to generate microstep signals to adapt to more precise needle ejection control requirements. That is, the microstep signal (FINE_STEP) refers to the pulse signal generated after subdividing the physical precision of the grating sensor. Its smallest unit corresponds to a tiny movement distance of the printhead, and its period can be dynamically adjusted by the period timer (FINE_STEP_PREC_COUNTER).

[0039] In a feasible embodiment, the specific steps for generating the microstep signal include: first, acquiring the physical precision of the grating and the target precision of printing; then, determining the number of subdivisions of the grating precision based on the ratio between the physical precision of the grating and the target precision of printing; and then subdividing the grating precision according to the number of subdivisions to generate the microstep signal. Specifically: first, acquiring the physical precision of the grating and the target precision of printing; then, determining the subdivision factor based on the ratio between the two, for example, the ratio of the target precision of printing 1440 DPI to the grating precision of 180 LPI is 8, that is, 1 LAB is subdivided into 8 FINE_STEPs; next, setting the theoretical period of each FINE_STEP (which can be set through a period timer) based on the current moving speed of the carriage, generating evenly distributed FINE_STEP pulses within 1 LAB period (e.g., for a 180 LPI grating, 1 LAB corresponds to 1 / 180 inch, and after subdividing into 8 FINE_STEPs, each FINE_STEP theoretically corresponds to 1 / 1440 inch of movement). The core function of the periodic timer is to dynamically match the actual speed. That is, when the speed of the print head changes, it can adjust the generation period of FINE_STEP to ensure that the measurement of the micro-step signal is synchronized with the actual movement of the print head.

[0040] In one feasible embodiment, in step 220, the synchronization pulse (HSYNC) is a reference signal used to calibrate the generation rhythm of the microstepping signal. Its frequency is typically lower than that of FINE_STEP, and each HSYNC interval contains a preset number of FINE_STEP signals (e.g., one HSYNC interval contains eight FINE_STEP signals). HSYNC can be used to ensure that the microstepping signal is synchronized with the actual position of the grating.

[0041] It is understandable that the actual movement speed of the print head may deviate from the theoretical speed due to factors such as motor load and voltage fluctuations, resulting in a missynchronization between the theoretical measurement of the microstepping signal and the actual movement of the print head. Using a synchronization pulse as a reference, the generation rhythm of the microstepping signal can be adjusted to keep the two in phase.

[0042] In one feasible embodiment, the generation interval of HSYNC can be configured via registers (e.g., one HSYNC is generated for every LAB), and the preset number can be calculated and determined based on the target printing precision and the HSYNC frequency to cover the printhead movement requirements in dynamic scenarios. For example, if the HSYNC frequency is determined by the raster LAB period (e.g., for a 180 LPI raster, the LAB period corresponds to 1 / 180 second, and the HSYNC frequency is 180 Hz), and the target printing precision is 1440 DPI (corresponding to a FINE_STEP precision of 1440 DPI), then one HSYNC interval needs to contain 8 FINE_STEPs (1440 ÷ 180 = 8) to ensure that the microstep metering can track the dynamic movement of the printhead in real time, and there will be no metering lag or lead even during acceleration and deceleration.

[0043] In a feasible embodiment, in step 230, the timing of needle emergence is controlled by counting microstep signals, and the phase of FINE_STEP and the grating signal is dynamically calibrated by synchronous pulses to ensure that the measurement is consistent with the actual movement.

[0044] In one feasible embodiment, before configuring the micro-step signal controlling the needle ejection of the print head, it is necessary to process the orthogonal pulse signal output by the grating sensor to obtain the real-time movement direction and actual movement distance of the print head, thereby controlling the needle ejection of the print head. For example... Figure 3 As shown, the process includes, but is not limited to, steps 310 to 330.

[0045] Step 310: Acquire the two orthogonal pulse signals output by the grating sensor. One cycle of the grating sensor is one basic grating unit.

[0046] Step 320: Determine the direction of printhead movement based on the trigger edge of any one of the two quadrature pulse signals and the current level state of the other;

[0047] Step 330: Count the position of the print head movement distance based on the accuracy of the basic grating unit to obtain the print head movement distance. The position count is used to assist in calibrating the measurement benchmark of the microstep signal.

[0048] In a feasible embodiment, in step 310, two orthogonal pulse signals (HPSA, HPSB) are generated by the grating driven by the movement of the print head. The edge changes (rising edge or falling edge) of the signals directly reflect the actual movement distance of the print head, and the level state directly reflects the movement direction, serving as a direct feedback signal of the actual position of the print head. The basic grating unit refers to the physical distance between two adjacent grating lines in the grating sensor, corresponding to one cycle of the grating's physical precision (e.g., a 180 LPI grating with a LAB length of 1 / 180 inch), and is the basic unit for calculating the actual movement distance of the print head.

[0049] In one feasible embodiment, in step 32310, the trigger edge includes a rising edge (the instant the signal changes from low to high) and a falling edge (the instant the signal changes from high to low). Figure 4 As shown, one black-and-white grid period of the grating is defined as 1 LAB. When the grating actually moves 1 / 4 LAB, HPSA or HPSB will generate a rising edge or a falling edge, which can be used to determine the direction of print head movement. Taking HPSA as a reference, the direction determination logic is as follows: when HPSA generates a rising edge and HPSB is high, the print head moves in the first direction (e.g., to the right); when HPSA generates a rising edge and HPSB is low, the print head moves in the second direction (e.g., to the left); when HPSA generates a falling edge and HPSB is low, the print head moves in the first direction; when HPSA generates a falling edge and HPSB is high, the print head moves in the second direction. This direction determination is based on the actual movement of the print head. Even if there is gear backlash in the transmission mechanism, the timing of the reverse movement of the print head can be accurately captured through the real-time changes of the quadrature pulse signal.

[0050] In a feasible embodiment, in step 330, the precision of the position count can be set to 1 / 4 LAB. That is, whenever the printhead actually moves 1 / 4 LAB, the HPSA or HPSB pulse will generate an edge change, thereby incrementing the position count by 1 (first direction) or decrementing it by 1 (second direction). For example, for a 180 LPI raster, 1 / 4 LAB corresponds to (1 / 180) inch ÷ 4 = 1 / 720 inch. Increasing the position count by 1 represents that the printhead has actually moved 1 / 720 inch. This count result is a quantized value of the actual position of the printhead, which can be directly used as the measurement reference for the FINE_STEP signal, ensuring that each unit of FINE_STEP corresponds to the actual movement of the printhead.

[0051] In one feasible embodiment, a LAB generates an HSYNC pulse, the waveform of which is as follows: Figure 5As shown, HPSA and HPSB are two orthogonal pulse signals output by the grating sensor. When the grating moves 1 / 4 LAB (i.e., the interval corresponding to 1 / 4 LAB marked in the figure, such as the process of HPSA moving from A to A1, A1 to A2, and A2 to A3), HPSA or HPSB will generate a rising edge or falling edge, which is used for position counting. At the same time, an HSYNC pulse is generated every complete LAB (i.e., the length of LAB marked in the figure). HSYNC ensures that the microstep signal FINE_STEP used for needle control is synchronized with the grating signal within a certain distance.

[0052] In one feasible embodiment, such as Figure 6 As shown, the execution process of controlling the print head needle output according to the microstep signal in step 230 may include, but is not limited to, steps 610 to 640.

[0053] Step 610: Determine the target needle position and the corresponding raster reference position of the content to be printed;

[0054] Step 620: Calculate the positional difference between the target needle position and the grating reference position;

[0055] Step 630: Compensate for the position difference based on the physical parameters of the print head to obtain the actual compensation difference;

[0056] Step 640: Convert the actual compensation difference into a microstep signal count. When the cumulative number of microstep signals of the print head needle reaches the microstep signal count, the print head is triggered to emit the needle for the first time.

[0057] In a feasible embodiment, in step 610, the target needle exit position refers to the physical coordinates of the point to be printed on the printing medium (e.g., X=100.5mm), which can be obtained by parsing the printing data. The raster reference position refers to the actual position reference point of the printhead used to calibrate the needle exit position.

[0058] In a feasible embodiment, the process of determining the corresponding grating reference position includes: using the target needle exit position as a reference, obtaining the movement path of the print head (i.e., the trajectory of the print head moving from the current position to the target needle exit position); selecting the nearest actual grating position on the movement path that can be detected by two orthogonal pulse signals (HPSA, HPSB) as the grating reference position. Specifically, the actual grating position refers to the point where the position counter (Raster_Locating_Counter, used to accumulate position count increments or decrements) is an integer (because each change of 1 in the position count corresponds to an actual movement of 1 / 4 LAB), therefore, it is necessary to trace back from the target needle exit position to find the nearest integer count point. For example, if the target needle exit position corresponds to a position count of 1000.3, then the nearest integer count point is 1000, and its corresponding physical position is the grating reference position.

[0059] In one feasible embodiment, in step 620, the position difference is the absolute value of the target needle position minus the grating reference position, for example, 100.5mm - 100.4917mm = 0.0083mm. This difference is the actual distance the printhead needs to move.

[0060] In a feasible embodiment, in step 630, the physical parameters of the print head include the needle spacing (the lateral distance between two adjacent needles, such as 0.1 mm) and the needle diameter (the diameter of the needle, such as 0.05 mm). The purpose of compensation is to further eliminate the positional deviation caused by the print head's own structure and ensure that the needle position perfectly matches the printing requirements. For example, if the currently ejected needle is offset by 2 spacings relative to the reference needle (such as the first needle), then 0.2 mm (2 × 0.1 mm) needs to be compensated; if the needle diameter is 0.05 mm, to avoid overlapping of adjacent printing points, an additional 0.025 mm (1 / 2 of the needle diameter) needs to be compensated; therefore, the actual compensation difference = positional difference + needle offset compensation + needle diameter compensation = 0.0083 mm + 0.2 mm + 0.025 mm = 0.2333 mm, which is the final distance that the print head needs to actually move.

[0061] In a feasible embodiment, in step 640, the FINE_STEP signal count refers to the number of microsteps corresponding to the actual compensation difference, calculated as "actual compensation difference ÷ physical length of a single FINE_STEP signal". For example, a single FINE_STEP signal corresponds to 1 / 1440 inch ≈ 0.0017 mm, then the FINE_STEP signal count = 0.2333 mm ÷ 0.0017 mm ≈ 137. The count is based on the trigger threshold of the actual movement distance of the print head. The cumulative FINE_STEP signal count refers to the real-time accumulation of the generated FINE_STEP signals starting from the grating reference position (the cumulative count increases by 1 for each generated FINE_STEP signal), and the generation rhythm of the FINE_STEP signals has been calibrated by HSYNC to ensure consistency with the actual movement of the print head. When the cumulative count reaches 137, it indicates that the print head has actually moved to the target needle exit position.

[0062] In a feasible embodiment, when performing the phase relationship calibration of the microstep signal and the grating signal using a synchronization pulse, the specific steps are as follows: First, the deviation between the actual moving speed and the theoretical speed of the print head is detected. If the actual moving speed is slower than the theoretical speed, after all the preset number of microstep signals between two synchronization pulses are generated, the system waits for the next synchronization pulse to trigger before starting the generation of subsequent microstep signals. If the actual moving speed is faster than the theoretical speed, when a synchronization pulse trigger is detected before all the preset number of microstep signals between two synchronization pulses are generated, the generation cycle of the remaining microstep signals is shortened. After generating the remaining microstep signals, the generation of subsequent microstep signals is started according to the theoretical cycle. Figure 7Taking the waveform as an example, the upper part shows the situation where the print head carriage moves slower than the theoretical speed: the periodic timer FINE_STEP_PREC_COUNTER generates the microstep signal FINE_STEP according to the theoretical period. After the preset number of microstep signals between two HSYNC synchronization pulses are generated, it waits for the next HSYNC pulse to trigger before starting the generation process of subsequent microstep signals, so as to avoid the microstep count being generated too quickly and ahead of the actual movement position of the print head. The lower part shows the situation where the print head carriage moves faster than the theoretical speed: when the preset number of microstep signals between two HSYNC synchronization pulses have not been fully generated, the HSYNC pulse arrives in advance. At this time, the generation period of the remaining microstep signals is shortened (achieved by adjusting the counting target value of FINE_STEP_PREC_COUNTER). After the remaining microstep signals are generated quickly, the theoretical period is restored to start the generation of subsequent microstep signals, ensuring that the microstep count can be synchronized with the actual movement position of the print head without lag. Among them, FINE_STEP_PREC_IMPULSE is a pulse signal related to the periodic control of the microstep signal (FINE_STEP). It works by relying on the periodic timer (FINE_STEP_PREC_COUNTER) to assist in the precise generation of the microstep signal FINE_STEP, ensuring that the measurement of the microstep signal is synchronized with the actual movement of the print head, and providing a timing reference for the precise control of the needle ejection timing.

[0063] In a feasible embodiment, after the printhead emits its first needle according to the FINE_STEP signal, to ensure uniform spacing between printed dots of the same character or graphic, subsequent needle emission control can be performed through the following steps: Calculate the number of microstep intervals for subsequent needle emission based on the ratio between the microstep signal accuracy and the target printing accuracy; count the microstep signals, and trigger the printhead to emit a subsequent needle each time the number of microstep intervals is reached, until the printing content corresponding to the target needle emission position is completed. Specifically, the initial position compensation value for each needle can be written to the initial position calculator (PRINT_INIT_POSn), and the FINE_STEP interval corresponding to the target printing accuracy can be written to the PRINT_DPI_SET register. For example: PRINT_INIT_POS1 for the first pin is set to 3, indicating that 3 FINE_STEPs must be accumulated from the raster reference position before the first pin is triggered; PRINT_INIT_POS2 for the second pin is set to 75, indicating that 75 FINE_STEPs must be accumulated before the first pin is triggered; PRINT_DPI_SET is set to 12 (if the target printing resolution is 120 DPI and the FINE_STEP resolution is 1440 DPI, then 1440 / 120=12, meaning that a subsequent pin is triggered every 12 FINE_STEPs). When the print head moves to the raster reference position, the PRINT_INIT_POSn counter for each pin starts, accumulating the number of FINE_STEPs: Pin 1: After accumulating 3 FINE_STEPs, the first pin is triggered; thereafter, the DPI counter starts, and every 12 FINE_STEPs, a subsequent pin is triggered until the printing content for that pin is completed. The second pin: After a total of 75 FINE_STEPs, the first pin is triggered; thereafter, the DPI counter also triggers a subsequent pin every 12 FINE_STEPs.

[0064] The printing method of this application will be described below with reference to a specific embodiment.

[0065] Taking a dot matrix printer with a printing resolution of 1200 DPI as an example,

[0066] Its hardware configuration includes:

[0067] Grating sensor: 180LPI incremental grating (LAB length is 1 / 180 inch ≈ 0.0142mm), outputting HPSA and HPSB quadrature pulses;

[0068] Control IC: Integrates the aforementioned functional modules, and is configured via the APB bus to PRINT_INIT_POS1=3, PRINT_INIT_POS2=75, and PRINT_DPI_SET=12;

[0069] Imprint head: 24-pin structure, pin spacing 0.1mm, pin diameter 0.05mm;

[0070] HSYNC configuration: One HSYNC is generated for each LAB, and each HSYNC interval is pre-defined to contain 8 FINE_STEP (because 1440DPI÷180LPI=8).

[0071] Periodic timer FINE_STEP_PREC_COUNTER: The theoretical period is set to 2 units (corresponding to the FINE_STEP generation rhythm at a theoretical speed of 10mm / s for the chassis).

[0072] The IC receives quadrature pulses in real time via the HPSA / HPSB interface. When a rising edge of HPSA is detected and HPSB is high, it determines that the printhead has moved along the first direction (to the right). Each detected edge change (corresponding to a 1 / 4 LAB movement) increments the position counter by 1. With the raster precision subdivided from 180 LPI into 8x subdivisions, the FINE_STEP precision is 1440 DPI, and a single FINE_STEP corresponds to 1 / 1440 inch ≈ 0.0017 mm. FINE_STEP_PREC_COUNTER generates FINE_STEPs at a theoretical cycle of 2 units. When the printhead accelerates (actual speed 12 mm / s, faster than the theoretical 10 mm / s), only 6 FINE_STEPs are generated when the IC detects the HSYNC pulse. In this case, FINE_STEP_PREC_COUNTER temporarily changes the cycle of the remaining 2 FINE_STEPs to 1 unit, quickly generates them, and then restores the cycle to 2, ensuring that 8 FINE_STEPs are synchronized with 1 LAB.

[0073] When printing the character "8", multiple needles need to coordinate at the target needle position. Specifically: Needle 1: The raster reference position corresponds to the integer point of the position count, PRINT_INIT_POS1=3, so the needle will first emerge after accumulating 3 FINE_STEPs, and then trigger the subsequent needle emergence once every 12 FINE_STEPs (determined by PRINT_DPI_SET=12); Needle 2: PRINT_INIT_POS2=75, the needle will first emerge after accumulating 75 FINE_STEPs, and then trigger the subsequent needle emergence once every 12 FINE_STEPs; Even when the print head moves at an accelerated speed, HSYNC calibrates the FINE_STEP rhythm in real time to ensure that the needle emergence time of each needle corresponds to the actual position of the print head. The final printed "8" character has clear edges and uniform lines, meeting the accuracy requirement of 1440 DPI.

[0074] As can be seen from the above implementation process, the solution proposed in this application can effectively solve the problems of the traditional STEP counting-based control method, effectively improve the printing accuracy and stability of dot matrix printers, and is especially suitable for scenarios with high printing quality requirements, frequent acceleration and deceleration, and multi-needle synchronization.

[0075] See Figure 8 , Figure 8 This is a block diagram of a printing device provided in an embodiment of this application. The device 800 includes:

[0076] The grating signal acquisition module 810 is used to acquire two orthogonal pulse signals output by the grating sensor. One cycle of the grating sensor is one basic grating unit.

[0077] The microstep configuration module 820 is used to configure the microstep signal controlling the printhead needle ejection. The microstep signal measures the actual movement distance of the printhead and triggers the needle ejection timing. The microstep signal is generated based on the matching relationship between the physical precision of the grating and the precision of the printing target. This module can dynamically adjust the FINE_STEP period through a periodic timer to ensure synchronization with the actual movement of the printhead.

[0078] The pulse configuration module 830 is used to configure the synchronization pulse, which serves as the synchronization reference for the microstep signal and contains a preset number of microstep signals. This module can dynamically configure the generation interval of HSYNC through registers to adapt to different printing precision and speed scenarios.

[0079] The needle ejection control module 840 controls the needle ejection from the printhead based on the microstepping signal, and simultaneously calibrates the phase relationship between the microstepping signal and the raster signal through a synchronization pulse until the printed content is completed. This module, in conjunction with the PRINT_INIT_POSn and PRINT_DPI_SET registers, achieves precise synchronous needle ejection across multiple needles.

[0080] This application also discloses a printing device, which includes at least one processor, at least one memory, and computer program instructions stored in the memory. When the computer program instructions are executed by the processor, the printing method described above is implemented.

[0081] This application also discloses a computer-readable storage medium storing a processor-executable program, which, when executed by a processor, is used to perform the printing method described above.

[0082] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A printing method, characterized in that, The method includes: Configure a microstep signal to control the needle ejection of the print head. The microstep signal is used to measure the actual movement distance of the print head and trigger the needle ejection timing of the print head. The microstep signal is generated based on the matching relationship between the physical precision of the grating and the precision of the printing target. Configure a synchronization pulse, which serves as the synchronization reference for the microstep signal, and the synchronization pulse contains a preset number of microstep signals; The microstepping signal controls the printhead needle output, and the phase relationship between the microstepping signal and the grating signal is calibrated by a synchronization pulse until the printing content is completed; The step of generating the microstep signal includes: obtaining the physical precision of the grating and the printing target precision; determining the number of subdivisions of the grating precision based on the ratio between the physical precision of the grating and the printing target precision; and subdividing the grating precision according to the number of subdivisions to generate the microstep signal. The step of controlling the printhead needle ejection according to the microstep signal includes: determining the target needle ejection position of the content to be printed and the corresponding grating reference position; calculating the position difference between the target needle ejection position and the grating reference position; compensating for the position difference according to the physical parameters of the printhead to obtain an actual compensation difference value; converting the actual compensation difference value into a microstep signal count; and triggering the first needle ejection of the printhead when the cumulative number of microstep signals for the printhead needle ejection reaches the microstep signal count. The step of calibrating the phase relationship between the microstep signal and the grating signal using a synchronization pulse includes: detecting the deviation between the actual moving speed and the theoretical speed of the print head; if the actual moving speed is slower than the theoretical speed, after all the preset number of microstep signals between two synchronization pulses have been generated, waiting for the next synchronization pulse to trigger before starting the generation of subsequent microstep signals; if the actual moving speed is faster than the theoretical speed, when a synchronization pulse trigger is detected before all the preset number of microstep signals between two synchronization pulses have been generated, shortening the generation cycle of the remaining microstep signals, and after generating the remaining microstep signals, starting the generation of subsequent microstep signals according to the theoretical cycle. After controlling the printhead needle ejection based on the microstep signal count, the method further includes: after the first needle ejection, calculating the number of microstep intervals for subsequent needle ejections based on the ratio between the microstep signal accuracy and the printing target accuracy; counting the microstep signal, and triggering the printhead to eject a subsequent needle each time the number of microstep intervals is reached, until the printing content corresponding to the target needle ejection position is completed.

2. The printing method according to claim 1, characterized in that, The method further includes: Two orthogonal pulse signals output by the grating sensor are acquired, wherein one cycle of the grating sensor is one basic grating unit; The direction of print head movement is determined based on the trigger edge of one of the two orthogonal pulse signals and the current level state of the other. The position count is performed on the movement distance of the print head based on the accuracy of the basic grating unit to obtain the movement distance of the print head. The position count is used to assist in calibrating the measurement reference of the microstep signal.

3. The printing method according to claim 1, characterized in that, Determining the corresponding grating reference position includes: Based on the target needle exit position, the movement path of the printing head is obtained; The nearest actual position of the grating in the moving path that can be detected by two orthogonal pulse signals is selected as the grating reference position.

4. A printing device, characterized in that, The apparatus, used in the printing method as described in any one of claims 1-3, comprises: The grating signal acquisition module is used to acquire two orthogonal pulse signals output by the grating sensor, wherein one cycle of the grating sensor is one basic grating unit; The microstep configuration module is used to configure the microstep signal that controls the needle ejection of the print head. The microstep signal is used to measure the actual movement distance of the print head and trigger the needle ejection timing of the print head. The microstep signal is generated based on the matching relationship between the physical precision of the grating and the precision of the printing target. A pulse configuration module is used to configure a synchronization pulse, wherein the synchronization pulse is a synchronization reference for the microstep signal, and the synchronization pulse contains a preset number of microstep signals; The needle ejection control module is used to control the needle ejection of the print head according to the micro-step signal, and at the same time calibrate the phase relationship between the micro-step signal and the grating signal through the synchronization pulse until the printing content is completed.

5. A printing device, characterized in that, include: At least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method as described in any one of claims 1-3.

6. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by a processor, the method as described in any one of claims 1-3 is implemented.

Citation Information

Patent Citations

  • Printing method and equipment of needle printer and needle printer

    CN103481694A

  • Method and device for detecting machine stepping transmission structure error and storage medium

    CN117719263A