CN113535099B - Print head driving method and apparatus, storage medium, and electronic apparatus - Google Patents

Print head driving method and apparatus, storage medium, and electronic apparatus Download PDF

Info

Publication number
CN113535099B
CN113535099B CN202110498845.8A CN202110498845A CN113535099B CN 113535099 B CN113535099 B CN 113535099B CN 202110498845 A CN202110498845 A CN 202110498845A CN 113535099 B CN113535099 B CN 113535099B
Authority
CN
China
Prior art keywords
printing
needles
storage area
data
stepping motor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110498845.8A
Other languages
Chinese (zh)
Other versions
CN113535099A (en
Inventor
徐森
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Fujitsu Electronic Information Technologies Co Ltd
Original Assignee
Nanjing Fujitsu Electronic Information Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Fujitsu Electronic Information Technologies Co Ltd filed Critical Nanjing Fujitsu Electronic Information Technologies Co Ltd
Priority to CN202110498845.8A priority Critical patent/CN113535099B/en
Publication of CN113535099A publication Critical patent/CN113535099A/en
Application granted granted Critical
Publication of CN113535099B publication Critical patent/CN113535099B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1211Improving printing performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1218Reducing or saving of used resources, e.g. avoiding waste of consumables or improving usage of hardware resources
    • G06F3/122Reducing or saving of used resources, e.g. avoiding waste of consumables or improving usage of hardware resources with regard to computing resources, e.g. memory, CPU
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1293Printer information exchange with computer
    • G06F3/1295Buffering means

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Dot-Matrix Printers And Others (AREA)

Abstract

The embodiment of the application provides a printing head driving method and device, a storage medium and an electronic device, wherein the method comprises the following steps: constructing an array as a printing buffer area, wherein the array comprises a start storage area, an information storage area and an end storage area, the start storage area and the end storage area respectively comprise a storage area with the length of k and the empty content, the value of k is related to the step length of the stepping motor, and the information storage area is used for storing target printing information; and sending the target printing information stored in the printing buffer zone to the printing head so as to enable the printing head to execute printing operation.

Description

Print head driving method and apparatus, storage medium, and electronic apparatus
Technical Field
The present invention relates to the field of information security technologies, and in particular, to a print head driving method and apparatus, a storage medium, and an electronic apparatus.
Background
The pin printer is generally divided into a printing mechanism and a control and driving circuit. The pin printer has three movements during normal operation, namely lateral movement of the print head, longitudinal movement of the printing paper, and firing pin movement of the printing pins. These movements are all performed by a software controlled drive system, by some precision machinery. The printing needle is the key of correct printing, and the printing needle control mechanism realizes the needle discharging and retracting actions of the printing needle. The driving algorithm of the print head is the core technology of the needle printer, and the efficiency of the algorithm determines the speed of the printer processing information and the speed of responding to the task. In the prior related art, the CPU resource occupation of a driving algorithm of a printing head is high and the processing efficiency is low.
Aiming at the problems of higher CPU resource occupation and lower processing efficiency of a driving algorithm of a printing head in the related art, no effective solution exists at present.
Disclosure of Invention
The embodiment of the application provides a printing head driving method and device, a storage medium and an electronic device, which are used for at least solving the problems of higher CPU resource occupation and lower processing efficiency of a driving algorithm of a printing head in the related technology.
In one embodiment of the present application, there is provided a printhead driving method adapted for a needle printer driven by a stepping motor, the method including: constructing an array as a printing buffer area, wherein the array comprises a starting storage area, an information storage area and an ending storage area, the starting storage area and the ending storage area respectively comprise a storage area with the length of k and the empty content, the value of k is related to the step length of the stepping motor, and the information storage area is used for storing target printing information; and sending the target printing information stored in the printing buffer zone to the printing head so as to enable the printing head to execute printing operation.
In one embodiment, said constructing a tuple as a print buffer comprises: setting the information storage area with the length of L, wherein the value of L is consistent with the number of columns of printing needles in the needle printer; setting the initial storage area with the length of k and the end storage area with the length of k, wherein the value of k is consistent with the step number of the stepping motor which walks by a target distance, and the target distance is the linear distance between two rows of printing needles which are farthest in the needle printer; and sequentially connecting the initial storage area, the end storage area and the information storage area into an array with the length of L+2k, and generating the printing buffer area.
In an embodiment, a shielding word corresponding to each row of printing pins is respectively set, wherein the shielding word is used for shielding the printing data of other rows of printing pins. The step length of the stepping motor is taken as a unit, the distance between two rows of printing needles with farthest printing heads is k steps, the step sequence is the number of each row of needles, the first row of needles enter the printing buffer zone, and the last row of needles enter the printing buffer zone is the 0 th row of needles. The data to be printed at a certain moment can be obtained by processing according to the following mapping algorithm: the serial number of each column of needles is added with the step length of the movement of the stepping motor to be used as an address for acquiring the data of the printing buffer, the printing data corresponding to each column of needles at the current moment is indexed, the printing data and the shielding word of each corresponding column of needles are subjected to logical AND operation respectively, and then the results of the logical operation of each column of needles are added and summed to obtain the printing data at the current moment.
In an embodiment, sending the target print information stored in the print buffer to the printhead to cause the printhead to perform a printing operation includes: and sending control information to the stepper motor, wherein the control information is used for indicating that the stepper motor generates an interrupt every time when the stepper motor moves, and taking out data to be printed from a printing array buffer area according to the moving distance of the stepper motor in the interrupt program, and sending the data to a printing head driving port after the data is subjected to mapping algorithm processing so as to realize the printing of the data.
In another embodiment of the present application, there is also provided a printhead driving apparatus applied to a needle printer driven by a stepping motor, the apparatus including:
the construction module is configured to construct an array as a printing buffer zone, wherein the array comprises a start storage area, an information storage area and an end storage area, the start storage area and the end storage area respectively comprise storage areas with length of k and empty content, the value of k is related to the step length of the stepping motor, and the information storage area is used for storing target printing information;
and the sending module is configured to send the target printing information stored in the printing buffer area to the printing head so as to enable the printing head to execute printing operation.
In one embodiment, the building block comprises:
a first setting unit configured to set the information storage area with a length L, wherein the value of L is consistent with the number of columns of printing needles in the needle printer;
the second setting unit is configured to set the initial storage area with the length of k and the end storage area with the length of k, wherein the value of k is consistent with the step number of the stepping motor passing through a target distance, and the target distance is a linear distance between two rows of printing needles farthest from each other in the needle type printer;
the generating unit is configured to sequentially connect the initial storage area, the end storage area and the information storage area into an array with the length of L+2k, and generate the printing buffer area;
and the storage unit is configured to fill the first k storage spaces and the last k storage spaces of the printing buffer area to 0 and fill the data to be printed into L storage spaces in the middle of the printing buffer area.
In an embodiment, the sending module includes:
the operation unit is configured to take out a row of data from the printing buffer zone, respectively set a shielding word of the corresponding printing data for each row of printing needles, take the step length of the stepping motor as a unit, take the distance between the two rows of printing needles with the farthest distance of the printing head as k steps, take the step sequence as the number of each row of needles, firstly enter the printing buffer zone and finally enter the 0 th row of needles, and the data needing to be printed at a certain moment can be obtained by processing according to the following mapping algorithm: the serial number of each column of needles is added with the step length of the movement of the stepping motor to be used as an address for acquiring the data of the printing buffer zone, the printing data corresponding to each column of needles at the current moment is indexed, logic AND operation is respectively carried out on the printing data and the shielding word of each corresponding column of needles, and then the results of the logic operation of each column of needles are added and summed to obtain the printing data at the current moment;
and the sending unit is configured to send control information to the stepping motor, wherein the control information is used for indicating the stepping motor to generate an interrupt every time the stepping motor moves, and taking out data to be printed from a printing array buffer area according to the moving distance of the stepping motor in the interrupt program, and sending the data to a printing head driving port after the data are subjected to mapping algorithm processing so as to realize the printing of the data.
In an embodiment of the present application, a computer-readable storage medium is also presented, in which a computer program is stored, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
In an embodiment of the application, there is also proposed an electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the steps of any of the method embodiments described above.
According to the embodiment of the application, an array is constructed to serve as a printing buffer zone, wherein the array comprises a start storage area, an information storage area and an end storage area, the start storage area and the end storage area respectively comprise storage areas with the length of k and the empty content, the value of k is related to the step length of the stepping motor, and the information storage area is used for storing target printing information; and processing the target printing information stored in the printing buffer area and then sending the processed target printing information to the printing head so as to enable the printing head to execute printing operation. The method solves the problems of higher CPU resource occupation and lower processing efficiency of the driving algorithm of the printing head in the related technology, effectively reduces the CPU occupation rate of the driving algorithm of the printing head and improves the printing efficiency.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a flow chart of an alternative printhead actuation method according to an embodiment of the present application;
FIG. 2 is a schematic illustration of a printhead configuration with an alternative "diamond" arrangement of printheads according to one embodiment of the present application;
FIG. 3 is a schematic diagram of a data processing algorithm for an alternative print pin "diamond" arrangement in accordance with embodiments of the present application;
FIG. 4 is a schematic illustration of a printhead configuration with an alternative printhead "11" arrangement according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an alternative data processing algorithm for a print pin "11" type arrangement in accordance with embodiments of the present application;
fig. 6 is a block diagram of an alternative printhead driver according to an embodiment of the present application.
Detailed Description
The present application will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The embodiment of the application provides a print head driving method which is suitable for a needle printer, wherein the needle printer is driven by a stepping motor. FIG. 1 is a flow chart of an alternative printhead actuation method according to an embodiment of the present application, as shown in FIG. 1, including:
step S102, constructing an array as a printing buffer zone, wherein the array comprises a start storage area, an information storage area and an end storage area, the start storage area and the end storage area respectively comprise storage areas with length of k and empty content, the value of k is related to the step length of the stepping motor, and the information storage area is used for storing target printing information;
step S104, the target print information stored in the print buffer is sent to the print head, so that the print head performs a printing operation.
In an embodiment, the step S102 may be implemented by the following steps:
setting the information storage area with the length of L, wherein the value of L is consistent with the number of columns of dot matrix information for printing one line of data in the needle printer;
setting the initial storage area with the length of k and the end storage area with the length of k, wherein the value of k is consistent with the step number of the stepping motor which walks by a target distance, and the target distance is the linear distance between two rows of printing needles which are farthest in the needle printer;
and sequentially connecting the initial storage area, the end storage area and the information storage area into an array with the length of L+2k, and generating the printing buffer area.
The first k storage spaces and the last k storage spaces of the printing buffer are filled with 0, and the data to be printed is filled into L storage spaces in the middle of the printing buffer.
In an embodiment, the step S104 may be implemented by the following steps:
and setting a shielding word corresponding to each row of printing pins, wherein the shielding word is used for shielding the printing data of other rows of printing pins. When the printer works, each row of needles of the printing head participate in printing, the step length of the stepping motor is taken as a unit, the distance between the two rows of printing needles farthest from the printing head is k steps, the step sequence is the number of each row of needles, the first row of needles enter the printing buffer zone, and the last row of needles enter the printing buffer zone is the 0 th row of needles. The data to be printed at a certain moment can be obtained by processing according to the following mapping algorithm: the serial number of each column of needles is added with the step length of the movement of the stepping motor to be used as an address for acquiring the data of the printing buffer, the printing data corresponding to each column of needles at the current moment is indexed, the printing data and the shielding word of each corresponding column of needles are subjected to logical AND operation respectively, and then the results of the logical operation of each column of needles are added and summed to obtain the printing data at the current moment.
The target printing information stored in the printing buffer area is fetched and processed according to a mapping algorithm and then sent to the printing head, so that the printing head can execute printing operation, and the method comprises the following steps: and sending control information to the stepper motor, wherein the control information is used for indicating that the stepper motor generates an interrupt every time when the stepper motor moves, and taking out data to be printed from a printing array buffer area according to the moving distance of the stepper motor in the interrupt program, and sending the data to a printing head driving port after the data is subjected to mapping algorithm processing so as to realize the printing of the data.
Taking a printhead consisting of 24 print pins as an example, the method provided by the embodiments of the present application may be implemented in the following manner. There are various ways in which the print pins may be arranged, and different print head designs may have different arrangements of print pins. The printing needles are generally arranged in groups of odd and even needles, and common arrangements are "rhombus" and "11" shapes. The algorithms disclosed herein may be adapted to drive printheads in a variety of pin (orifice) arrangements. The algorithm is implemented as follows: driving a print head by using an IO port of a 32-bit CPU, and defining an array buffer zone of an int type; this array consists of 3 parts of information; the method comprises the following steps: an array start portion (corresponding to the aforementioned "start storage area"), an information storage portion (corresponding to the aforementioned "information storage area"), and an array end portion (corresponding to the aforementioned "end storage area"). The initial part and the end part of the array are provided with a certain length of storage areas with empty content, which are called Dummy buffers; the information storage section stores data to be printed. The length of the Dummy Buffer of the printing head is determined by the distance between the two rows of needles (spray holes) which are farthest from the printing needles (spray holes), and the stepping motor needs to walk through the distance by k steps, so that the length of the Dummy Buffer is k; the length of the information storage part in the array is determined by the line width of the printer, and if the information storage part is L, the whole array length is L+2k. Each row of needles (spray holes) is provided with a corresponding shielding word, the data of each row of needles (spray holes) to be printed currently and the corresponding shielding word are subjected to logical AND operation, and all the shielding words are added and summed to obtain the information to be printed at the moment. Each step of the step motor moves to generate an interrupt, and control information required to be output at the current position is calculated in an interrupt service routine to drive a printing head to print information. The driving algorithm is described as follows:
PDAT=∑ k A i+k M k (i=0,1,2…L+2k-1)
where k represents the row of pins k steps from the 0 th row of pins of the printhead, M k Is a shielding word of the array needle; a is that i+k Is the i+k-th column lattice information in the buffer area LineBuf; l+2k is the length of the buffer area lineBuf, and PDAT is the dot matrix information to be printed at the current moment obtained by calculation.
Taking the step design of the carriage motor as 1/180inch as an example, the step design is marked as 1P. Taking 1 row data as 80 columns of information as an example, each column has 24 points in the longitudinal direction and 18 points in the transverse direction. For the convenience of program processing, on a 32-bit processor, an array lineBuf of 1 int type is defined to store lattice information, so that the operation speed is faster; for a 32 processor, 1 int type variable occupies 4 Byte spaces. Thus, 1 line has a buffer capacity of 18×80=1440 DW (Double Word), corresponding to 5760Byte. After the printer receives the data sent by the upper computer, the data is stored in the line buffer area LineBuf.
For a diamond-type arrangement of printheads, as shown in FIG. 2, the odd 3 and even 3 groups of needles together make up 6 groups. The distance between the 11, 13 gauge needle and the 12, 14 gauge needle is 18.125P at maximum from the right side to the left side. In order to make the odd and even needles of the printing head sweep the data stored in the LineBuf to realize 24-needle printing, dummy data of 18 storage units are respectively added before and after line buffering, and the data content is empty; when the even-numbered pins of the printing head start to process the LineBuf data, the driven content of the odd-numbered pins is null, no data is printed, and printing is performed according to the content of the LineBuf after the odd-numbered pins walk into the LineBuf area. The distance between every two groups of needles is not an integral multiple of the step distance of the motor, and the needle outlet time can be adjusted. The motor operating frequency is 1812PPS, and 552uS is required to move 1P, i.e., 0.141 mm. Since the motor is at constant speed, 414uS is required for 0.75P movement, 276uS is required for 0.5P movement, 345uS is required for 0.625P movement, 207uS is required for 0.375P movement, and 69uS is required for 0.125P movement. From the principle shown in fig. 3, a signal processing algorithm of the print head of the diamond needle arrangement can be deduced, as shown in the following formula.
PIN_DATA=LineBuf[i+18]&0x002800+LineBuf[i+16]&0x028280+LineBuf[i+12]&0xA8002A+LineBuf[i+5]&0x540015+LineBuf[i+1]&0x014140+LineBuf[i]&0x001400
In the above-mentioned formula(s),
the shielding words of the 12 th needle and the 14 th needle are 0x002800, and the time delay is avoided;
the shielding word of the 8, 10, 16 and 18-gauge needle is 0x028280, and the delay time is 414uS;
the shielding word of pins 2,4,6, 20, 22 and 24 is 0xA8002A, and the delay time is 276uS;
the shielding word of the 1,3,5, 19, 21, 23 needle is 0x540015, and the delay time is 345uS;
the shielding word of the needle of 7,9, 15 and 17 is 0x014140, and the delay time is 207uS;
the masks for pins 11 and 13 are 0x001400, with a delay of 69uS.
Taking the print head arranged in the shape of 11 as an example, as can be seen from fig. 4, the print heads arranged in the shape of 11 are divided into 2 groups of print needles, 1 group of 12 odd needles and 1 group of 12 even needles; the spacing between adjacent 2 needles in the longitudinal direction was 0.141mm, i.e. 1/180inch, and the lateral spacing between the 2 groups of needles was 9/180inch. The odd needles are 9 steps away from the even needles; in order to make the odd and even needles of the printing head sweep the data stored in the LineBuf to realize 24-needle printing, dummy data of 9 storage units are respectively added before and after line buffering, and the data content is empty; when the even-numbered pins of the print head start processing LineBuf data, the content of the odd-numbered pins driven is null without printing any data until the odd-numbered pins walk into the LineBuf area, and printing is performed according to the content of LineBuf, as shown in fig. 5. From the principle shown in fig. 5, a processing algorithm of the print needle driving signal can be deduced. The following formula is shown:
PIN_DATA=LineBuf[i]&0x555555+LineBuf[i+9]&0xAAAAAA;
where 0x555555 is the odd needle shield and 0xaaaaa is the even needle shield.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
According to another aspect of the embodiments of the present application, there is also provided a printhead driving apparatus for implementing the above printhead driving method. Fig. 6 is a block diagram of an alternative printhead driving apparatus according to an embodiment of the present application, as shown in fig. 6, including:
in another embodiment of the present application, there is also provided a printhead driving apparatus applied to a needle printer driven by a stepping motor, the apparatus including:
the construction module 602 is configured to construct an array as a print buffer, where the array includes a start storage area, an information storage area, and an end storage area, where the start storage area and the end storage area include storage areas with a length of k and an empty content, respectively, where a value of k is related to a step size of the stepper motor, and the information storage area is used to store target print information;
and the sending module 604 is configured to take out the target printing information stored in the printing buffer area, process the target printing information according to a mapping algorithm and send the target printing information to the printing head so as to enable the printing head to execute printing operation.
In one embodiment, the building block 602 includes:
a first setting unit configured to set the information storage area with a length L, wherein the value of L is consistent with the number of columns of dot matrix information for printing one line of data in the needle printer;
the second setting unit is configured to set the initial storage area with the length of k and the end storage area with the length of k, wherein the value of k is consistent with the step number of the stepping motor passing through a target distance, and the target distance is a linear distance between two rows of printing needles farthest from each other in the needle type printer;
and the generating unit is configured to sequentially connect the initial storage area, the end storage area and the information storage area into an array with the length of L+2k, and generate the printing buffer area.
And the storage unit is configured to fill the first k storage spaces and the last k storage spaces of the printing buffer area to 0 and fill the data to be printed into L storage spaces in the middle of the printing buffer area.
In one embodiment, the sending module 604 includes:
and an operation unit configured to take out one column of data from the print buffer, and set a mask word of the corresponding print data for each column of print pins. The step length of the stepping motor is taken as a unit, the distance between two rows of printing needles with farthest printing heads is k steps, the step sequence is the number of each row of needles, the first row of needles enter the printing buffer zone, and the last row of needles enter the printing buffer zone is the 0 th row of needles. The data to be printed at a certain moment can be obtained by processing according to the following mapping algorithm: the serial number of each column of needles is added with the step length of the movement of the stepping motor to be used as an address for acquiring the data of the printing buffer, the printing data corresponding to each column of needles at the current moment is indexed, the printing data and the shielding word of each corresponding column of needles are subjected to logical AND operation respectively, and then the results of the logical operation of each column of needles are added and summed to obtain the printing data at the current moment.
And the sending unit is configured to send control information to the stepping motor, wherein the control information is used for indicating the stepping motor to generate an interrupt every time the stepping motor moves, and taking out data to be printed from a printing array buffer area according to the moving distance of the stepping motor in the interrupt program, and sending the data to a printing head driving port after the data are subjected to mapping algorithm processing so as to realize the printing of the data.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application and are intended to be comprehended within the scope of the present application.

Claims (7)

1. A print head driving method, adapted to a needle printer driven by a stepping motor, comprising:
constructing an array as a printing buffer area, wherein the array comprises a starting storage area, an information storage area and an ending storage area, the starting storage area and the ending storage area respectively comprise a storage area with the length of k and the empty content, the value of k is related to the step length of the stepping motor, the information storage area is used for storing target printing information, the value of k is consistent with the step number of the stepping motor passing through a target distance, and the target distance is the linear distance between two rows of printing needles farthest in the needle printer;
setting the information storage area with the length of L, wherein the value of L is consistent with the number of columns of dot matrix information for printing one line of data in the needle printer;
sequentially connecting the initial storage area, the information storage area and the end storage area to form an array with the length of L+2k, and generating the printing buffer area;
setting a shielding word corresponding to each row of printing needles, wherein the shielding word is used for shielding printing data of other rows of printing needles;
taking the step length of a stepping motor as a unit, taking the distance between two rows of printing needles with farthest printing heads as k steps, taking the distance between each row of needles and the 0 th row of needles as the number of each row of needles, wherein the first row of needles enter a printing buffer zone, and the last row of needles enter the printing buffer zone is the 0 th row of needles;
the data to be printed at a certain moment can be obtained by processing according to the following mapping algorithm: the serial number of each column of needles is added with the step length of the movement of the stepping motor to be used as an address for acquiring the data of the printing buffer zone, the printing data corresponding to each column of needles at the current moment is indexed, logic AND operation is respectively carried out on the printing data and the shielding word of each corresponding column of needles, and then the results of the logic operation of each column of needles are added and summed to obtain the printing data at the current moment;
and sending control information to the stepping motor, wherein the control information is used for indicating that the stepping motor generates an interrupt every time when moving, and sending the data to a printing head driving port after the data to be printed is obtained in the interrupt according to the moving distance of the stepping motor and the processing of the mapping algorithm, so as to realize the printing of the data.
2. The method of claim 1, wherein said constructing a tuple as a print buffer comprises:
setting the initial storage area with the length of k and the ending storage area with the length of k.
3. The method according to claim 2, wherein the method further comprises:
the serial number of each column of needles is added with the step length of the movement of the stepping motor to be used as an address for acquiring the data of the printing buffer, the printing data corresponding to each column of needles at the current moment is indexed, the printing data and the shielding word of each corresponding column of needles are subjected to logical AND operation respectively, and then the results of the logical operation of each column of needles are added and summed to obtain the printing data at the current moment.
4. A printhead driving apparatus for a needle printer driven by a stepping motor, the apparatus comprising:
the system comprises a construction module, a printing buffer area and a printing module, wherein the construction module is configured to construct an array which is used as the printing buffer area, the array comprises a start storage area, an information storage area and an end storage area, the start storage area and the end storage area respectively comprise a storage area with the length of k and the empty content, the value of k is related to the step length of the stepping motor, the information storage area is used for storing target printing information, the value of k is consistent with the step number of the stepping motor which passes through a target distance, and the target distance is the linear distance between two rows of printing needles which are farthest in the needle printer; setting the information storage area with the length of L, wherein the value of L is consistent with the number of columns of dot matrix information for printing one line of data in the needle printer; sequentially connecting the initial storage area, the information storage area and the end storage area to form an array with the length of L+2k, and generating the printing buffer area;
the sending module is configured to respectively set a shielding word corresponding to each row of printing needles, wherein the shielding word is used for shielding the printing data of other rows of printing needles;
taking the step length of a stepping motor as a unit, taking the distance between two rows of printing needles with farthest printing heads as k steps, taking the distance between each row of needles and the 0 th row of needles as the number of each row of needles, wherein the first row of needles enter a printing buffer zone, and the last row of needles enter the printing buffer zone is the 0 th row of needles;
the data to be printed at a certain moment can be obtained by processing according to the following mapping algorithm: the serial number of each column of needles is added with the step length of the movement of the stepping motor to be used as an address for acquiring the data of the printing buffer zone, the printing data corresponding to each column of needles at the current moment is indexed, logic AND operation is respectively carried out on the printing data and the shielding word of each corresponding column of needles, and then the results of the logic operation of each column of needles are added and summed to obtain the printing data at the current moment;
and sending control information to the stepping motor, wherein the control information is used for indicating that the stepping motor generates an interrupt every time when moving, and sending the data to a printing head driving port after the data to be printed is obtained in the interrupt according to the moving distance of the stepping motor and the processing of the mapping algorithm, so as to realize the printing of the data.
5. The apparatus of claim 4, wherein the build module is further configured to:
setting the initial storage area with the length of k and the ending storage area with the length of k.
6. A computer-readable storage medium, characterized in that the storage medium has stored therein a computer program, wherein the computer program is arranged to perform the method of any of claims 1 to 3 when run.
7. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of claims 1 to 3.
CN202110498845.8A 2021-05-08 2021-05-08 Print head driving method and apparatus, storage medium, and electronic apparatus Active CN113535099B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110498845.8A CN113535099B (en) 2021-05-08 2021-05-08 Print head driving method and apparatus, storage medium, and electronic apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110498845.8A CN113535099B (en) 2021-05-08 2021-05-08 Print head driving method and apparatus, storage medium, and electronic apparatus

Publications (2)

Publication Number Publication Date
CN113535099A CN113535099A (en) 2021-10-22
CN113535099B true CN113535099B (en) 2024-01-02

Family

ID=78095358

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110498845.8A Active CN113535099B (en) 2021-05-08 2021-05-08 Print head driving method and apparatus, storage medium, and electronic apparatus

Country Status (1)

Country Link
CN (1) CN113535099B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115447289B (en) * 2022-08-30 2024-04-30 苏州浪潮智能科技有限公司 Label breakpoint compensation printing device and detection compensation method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE2317493A1 (en) * 1972-04-06 1973-10-11 Centronics Data Computer HIGH SPEED PRINTER
US6870633B1 (en) * 1996-09-30 2005-03-22 Brother Kogyo Kabushiki Kaisha Printing device
JP2008155530A (en) * 2006-12-25 2008-07-10 Seiko Epson Corp Printer, printer system and printer system control method
CN103507448A (en) * 2012-06-29 2014-01-15 山东新北洋信息技术股份有限公司 Printing control method and printer
CN106681673A (en) * 2016-12-21 2017-05-17 福建升腾资讯有限公司 Grayscale printing method of thermosensitive printer
JP2017222084A (en) * 2016-06-15 2017-12-21 セイコーエプソン株式会社 Printer and control method for the same

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE2317493A1 (en) * 1972-04-06 1973-10-11 Centronics Data Computer HIGH SPEED PRINTER
US6870633B1 (en) * 1996-09-30 2005-03-22 Brother Kogyo Kabushiki Kaisha Printing device
JP2008155530A (en) * 2006-12-25 2008-07-10 Seiko Epson Corp Printer, printer system and printer system control method
CN103507448A (en) * 2012-06-29 2014-01-15 山东新北洋信息技术股份有限公司 Printing control method and printer
JP2017222084A (en) * 2016-06-15 2017-12-21 セイコーエプソン株式会社 Printer and control method for the same
CN106681673A (en) * 2016-12-21 2017-05-17 福建升腾资讯有限公司 Grayscale printing method of thermosensitive printer

Also Published As

Publication number Publication date
CN113535099A (en) 2021-10-22

Similar Documents

Publication Publication Date Title
CN113535099B (en) Print head driving method and apparatus, storage medium, and electronic apparatus
US4458333A (en) Dot matrix character printing using constrained memory
CA1040254A (en) Dot matrix printer with slanted print head and modular skewing of dot pattern information
US4567570A (en) Electronic control system for a linearly slanted print head
US4621340A (en) Method for construction and display of ideographic characters
WO1990009629A1 (en) Real-time rasterization system for a column-oriented printing apparatus or the like
WO2014000659A1 (en) Printing control method and printer
EP0703086A2 (en) Method and apparatus for printing having logic circuitry to reduce video data input rate
KR20010062683A (en) Printer and printing method
EP1438193B1 (en) Printing method for continuous ink jet printer
CA1130463A (en) Dot matrix character printer with variable speed control
CN110091592B (en) Ink jet printing method, apparatus, system, computer device and storage medium
CN113442581B (en) Printing method, device, equipment and storage medium
US7289243B2 (en) Apparatus and method for data compression optimized by print head architecture
CN112757779B (en) Ink jet head nozzle alternation control method and ink jet printer
US5020927A (en) Grouping of dot data in a multiple column dot-matrix printer
US4780006A (en) Dot matrix printer
CN113769409A (en) Modular game level generation method and device, computer equipment and storage medium
CN110053253B (en) Optimization method and device for galvanometer scanning path
JPS6353948B2 (en)
CN110674934A (en) Neural network pooling layer and operation method thereof
US7637578B2 (en) Printing data processing apparatus and method therefor
JPH035994B2 (en)
KR890003918B1 (en) Dot pattern generating system
JPH09300735A (en) Printing controlling apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant