Detailed description of the invention
Fig. 1 is the flow chart of an embodiment of the processing method of printing precision of the present invention, and as shown in Figure 1, the executive agent of the method for the present embodiment is numerical control system, then the method comprises:
Step 101, according to the frequency division value D arranged and frequency multiplication value M, and the gap count value K of current time obtained, adopts formula (1):
N=K×D÷M (1)
Obtain counting reference value P, wherein, this P is the integer part of this N.
In the present embodiment, this first gap count value is more than or equal to predetermined threshold value; This predetermined threshold value is arrange according to required precision.For example, when required precision one thousandth, predetermined threshold value can be 1000.
Step 102, according to this counting reference value P, output pulse signal.
In the present embodiment, when output count down to P, export a pulse signal, and restart counting.
In the present embodiment, according to the frequency division value D arranged and frequency multiplication value M, and the gap count value K obtained, adopt formula N=K × D ÷ M, obtain counting reference value P, wherein, this P is the integer part of this N; And according to this counting reference value P, output pulse signal.Because the first gap count value is more than or equal to predetermined threshold value, and predetermined threshold value is arrange according to accuracy requirement, therefore, is carrying out remainder process, after namely referring to the integer part of acquisition N, can reduce error, thus effectively improve printing precision.In addition, the ratio of what in fact algorithm adopted is D and M, therefore, the numerical values recited of D and M is not limited, the degree of regulation of frequency division and frequency multiplication can be as accurate as a system sampling clock cycle, far beyond the demand of printing precision, and the difficulty of non-processor remainder, therefore, it is possible to correct the reflection circularity of coder structure, the problem of concentricity, and can meet consumers' demand.
Fig. 2 is the flow chart of another embodiment of the processing method of printing precision of the present invention, and as shown in Figure 2, the executive agent of the method is numerical control system, then the method comprises:
Step 201, calculating obtain the gap count value K between current time first input pulse signal and the second input pulse signal, and this first pulse signal is the previous pulse signal of this second pulse signal.
Step 202, according to the frequency division value D arranged and frequency multiplication value M, and this gap count value K, adopt formula (1):
N=K×D÷M (1)
Obtain counting reference value P, wherein, this P is the integer part of this N.
In the present embodiment, this first gap count value is more than or equal to predetermined threshold value; This predetermined threshold value is arrange according to required precision.
Step 203, according to this counting reference value P, output pulse signal.
In the present embodiment, for example, when gap count value is followed successively by 5000,4500,3500,3000, suppose that frequency division times frequency ratio is 1/2, so adopt formula (1), the counting reference value obtained is followed successively by 2500,2250,1750,1500, it can thus be appreciated that this output pulse signal follows the change of gap count value completely.
Fig. 3 is the flow chart of another embodiment of the processing method of printing precision of the present invention, and as shown in Figure 3, the executive agent of the method is numerical control system, then the method comprises:
Step 301, ready-to-print.
Step 302, calculating obtain the gap count value K between current time first input pulse signal and the second input pulse signal, and this first pulse signal is the previous pulse signal of this second pulse signal.
Step 303, according to the frequency division value D arranged and frequency multiplication value M, and this gap count value K, adopt formula (1):
N=K×D÷M (1)
Obtain counting reference value P, wherein, this P is the integer part of this N.
In the present embodiment, this first gap count value is more than or equal to predetermined threshold value; This predetermined threshold value is arrange according to required precision.
Step 304, print enable after, start adopt clock counter count.
Step 305, judge whether the numerical value of sampling clock rolling counters forward is more than or equal to this counting reference value P; If be more than or equal to, then perform step 306; If be less than, then wait for this sampling clock rolling counters forward cumulative after perform step 305 again.
Step 306, output pulse signal, and this sampling clock counting device is reset.
Whether step 307, judge to print and terminate; If do not terminate, then perform step 304.If terminate, then Flow ends.
In the present embodiment, for example, suppose to count the pulse interval of encoder input, the gap count value obtained is K=3000, and hypothesis encoder input signal is ideal, export and need to do 2 frequencys multiplication, then frequency division/frequency multiplication can be set to 1/2,100/200 or 1000/2000, so adopt formula (1), the counting reference value P obtained is 1500.
If the encoder input signal cycle is less than normal compared with theoretical value, then can arrange frequency division/frequency multiplication is 1000/1998, so adopts formula (1), and the counting reference value P obtained is 1501.Suppose that frequency division/frequency multiplication is set to 1000/1997 again, so adopt formula (1), the counting reference value P obtained is 1502.It can thus be appreciated that by arranging frequency division/frequency multiplication, adjust the pulse signal exported, can reach a sampling clock cycle, such precision just can meet the requirement of printing precision.
In like manner, if encoder input signal is bigger than normal compared with theoretical value, then also can by arranging frequency division/frequency multiplication, make P be 1499,1498,1497 etc., thus also can meet the requirement of printing precision.
In addition, when frequency division times frequency ratio is not integer, such as P=1501 or 1499, so corresponding, input coding device pulse spacing (i.e. gap count value) can not a corresponding integer output pulse signal, but the pulse signal exported is strict reference to count reference value, be namely more than or equal to P then output pulse signal to lay equal stress on New count; Be less than P and then continue counting, along with the continuous real-time update of K and P, the pulse signal that can realize completely exporting, to the response of the pulse signal of input coding device and following, ensure that printing precision.
Further, in another embodiment of the present invention, on the basis of example shown in above-mentioned Fig. 3, the method also comprises:
When this first gap count value is updated to the second gap count value, according to this second gap count value, this frequency division value D and frequency multiplication value M, adopt this formula, obtain the second counting reference value.
Then step 305 replaces with:
Judge whether the numerical value of this sampling clock rolling counters forward is more than or equal to this second counting reference value, if be more than or equal to, then performs step 306; If be less than, then wait for this sampling clock rolling counters forward cumulative after perform step 305 again.
In the present embodiment, the speed of service due to stock is variable, therefore, K also may change always, therefore, can there are two kinds of more special situations: when the numerical value of the first situation, sampling clock rolling counters forward is less than or equal to the first counting reference value, this first gap count value is updated to the second gap count value, then the numerical value of sampling clock rolling counters forward can count reference value and compares with second.The number of times of the second situation, sampling clock counting device stored count has exceeded the first gap count value, but the first gap count value does not also upgrade, then the numerical value of sampling clock rolling counters forward still can count reference value and compares with first, until the first counting reference value upgrades.
One of ordinary skill in the art will appreciate that: all or part of step realizing above-mentioned each embodiment of the method can have been come by the hardware that programmed instruction is relevant.Aforesaid program can be stored in a computer read/write memory medium.This program, when performing, performs the step comprising above-mentioned each embodiment of the method; And aforesaid storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
Fig. 4 is the structural representation of an embodiment of the treating apparatus of printing precision of the present invention, and as shown in Figure 4, the device of the present embodiment comprises: counting reference value acquisition module 11 and output of pulse signal module 12; Wherein, counting reference value acquisition module 11 is for according to the frequency division value D arranged and frequency multiplication value M, and the gap count value K obtained, and adopt formula N=K × D ÷ M, obtain counting reference value P, wherein, described P is the integer part of described N; This first gap count value is more than or equal to predetermined threshold value; This predetermined threshold value is arrange according to required precision.Output of pulse signal module 12, for according to described counting reference value P, output pulse signal.
The treating apparatus of the printing precision of the present embodiment can perform the technical scheme of embodiment of the method shown in Fig. 1, and it is similar that it realizes principle, repeats no more herein.
In the present embodiment, according to the frequency division value D arranged and frequency multiplication value M, and the gap count value K obtained, adopt formula N=K × D ÷ M, obtain counting reference value P, wherein, this P is the integer part of this N; And according to this counting reference value P, output pulse signal.Because the first gap count value is more than or equal to predetermined threshold value, and predetermined threshold value is arrange according to accuracy requirement, therefore, is carrying out remainder process, after namely referring to the integer part of acquisition N, can reduce error, thus effectively improve printing precision.In addition, the ratio of what in fact algorithm adopted is D and M, therefore, the numerical values recited of D and M is not limited, the degree of regulation of frequency division and frequency multiplication can be as accurate as a system sampling clock cycle, far beyond the demand of printing precision, and the difficulty of non-processor remainder, therefore, it is possible to correct the reflection circularity of coder structure, the problem of concentricity, and can meet consumers' demand.
Fig. 5 is the structural representation of another embodiment of the treating apparatus of printing precision of the present invention, on above-mentioned basis embodiment illustrated in fig. 4, as shown in Figure 5, this device can also comprise: gap count value acquisition module 13, for calculating the gap count value K obtained between current time first input pulse signal and the second input pulse signal, this first pulse signal is the previous pulse signal of this second pulse signal.
Preferably, output of pulse signal module 12 comprises: enable unit 121, judging unit 122 and output unit 123; Enable unit 121 is enable for printing, and start sampling clock counting device count; Judging unit 122 is for judging whether the numerical value of sampling clock rolling counters forward is more than or equal to this counting reference value P; Output unit 123, if be more than or equal to this counting reference value P, then output pulse signal for the numerical value of this sampling clock rolling counters forward of this judging unit, and resets this sampling clock counting device.
Preferably, if when this first gap count value is updated to the second gap count value by this gap count value acquisition module 13, then flip-flop number reference value acquisition module 11, according to this second gap count value, this frequency division value D and frequency multiplication value M, adopts this formula, obtains the second counting reference value;
Then this judging unit 122 is also for judging whether the numerical value of this sampling clock rolling counters forward is more than or equal to this second counting reference value;
If this output unit 123 is also judged to be more than or equal to for this judging unit, then output pulse signal, and this sampling clock counting device is reset.
Last it is noted that above each embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to foregoing embodiments to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein some or all of technical characteristic; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the scope of various embodiments of the present invention technical scheme.