Specific embodiment
Fig. 1 is the flow chart of an embodiment of processing method of printing precision of the present invention, as shown in figure 1, the present embodiment
Method executive agent be numerical control system, then the method include:
Step 101, the frequency division value D according to setting and frequency multiplication value M, and gap count value K of the current time obtaining, adopt
With formula (1):
N=K × D ÷ M (1)
Obtain and count 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 according to precision
Require setting.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 again start counting up.
In the present embodiment, the frequency division value D according to setting and frequency multiplication value M, and gap count value K obtaining, using public affairs
Formula N=K × D ÷ M, obtains and counts reference value P, wherein, this P is the integer part of this N;And according to this counting reference value P, export
Pulse signal.Because the first gap count value is more than or equal to predetermined threshold value, and predetermined threshold value is according to accuracy requirement setting,
Therefore, carrying out remainder process, that is, after referring to the integer part of acquisition N, error can reduced, thus being effectively improved printing essence
Degree.In addition, algorithm actually uses the ratio of D and M, therefore, the numerical values recited of D and M is not limited, divide and frequency multiplication
Degree of regulation can be as accurate as a system sampling clock cycle, far beyond the demand of printing precision, and no process remainder
Difficulty, therefore, it is possible to the circularity of correct reflection coder structure, the problem of concentricity, and user's request can be met.
Fig. 2 is the flow chart of another embodiment of processing method of printing precision of the present invention, as shown in Fig. 2 the method
Executive agent be numerical control system, then the method include:
Step 201, calculating obtain the interval between current time the first input pulse signal and the second input pulse signal
Count value K, this first input pulse signal is the previous pulse signal of this second input pulse signal.
Step 202, the frequency division value D according to setting and frequency multiplication value M, and this gap count value K, using formula (1):
N=K × D ÷ M (1)
Obtain and count 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 according to precision
Require setting.
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 it is assumed that dividing
Frequency times frequency ratio is 1/2, then using formula (1), the counting reference value obtaining is followed successively by 2500,2250,1750,1500, thus
Understand, this output pulse signal follows the change of gap count value completely.
Fig. 3 is the flow chart of another embodiment of processing method of printing precision of the present invention, as shown in figure 3, the method
Executive agent be numerical control system, then the method include:
Step 301, ready-to-print.
Step 302, calculating obtain the interval between current time the first input pulse signal and the second input pulse signal
Count value K, this first input pulse signal is the previous pulse signal of this second input pulse signal.
Step 303, the frequency division value D according to setting and frequency multiplication value M, and this gap count value K, using formula (1):
N=K × D ÷ M (1)
Obtain and count 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 according to precision
Require setting.
After step 304, printing enable, start and counted using clock counter.
Step 305, judge that whether the numerical value of sampling clock rolling counters forward be more than or equal to this counting reference value P;If big
In or be equal to, then execution step 306;If being less than, wait this sampling clock rolling counters forward cumulative after execution step again
305.
Step 306, output pulse signal, and this sampling clock is counted with device clearing.
Whether step 307, judge to print and terminate;If being not over, execution step 304.If terminating, flow process stops.
In the present embodiment, for example, assume the pulse interval of encoder input to be counted, between obtaining
Be K=3000 every count value, and assume that encoder input signal is ideal, output needs to do 2 frequencys multiplication, then divide/times
Frequency can be set to 1/2,100/200 or 1000/2000, then using formula (1), and counting reference value P obtaining is 1500.
If the encoder input signal cycle is less than normal compared with theoretical value, can arrange frequency dividing/frequency multiplication is 1000/1998, that
Adopt formula (1), counting reference value P obtaining is 1501.Again assume that frequency dividing/frequency multiplication is set to 1000/1997, then adopt
Formula (1), counting reference value P obtaining is 1502.It follows that by arranging frequency dividing/frequency multiplication, entering to the pulse signal of output
Row adjustment, can reach a sampling clock cycle, such precision just can meet the requirement of printing precision.
In the same manner, if encoder input signal is bigger than normal compared with theoretical value, can also be by arranging frequency dividing/frequency multiplication so that P is
1499th, 1498,1497 etc., thus also disclosure satisfy that the requirement of printing precision.
In addition, in the case that a frequency dividing times frequency ratio is not integer, such as P=1501 or 1499, then corresponding, is defeated
Enter encoder pulse interval (i.e. gap count value) nor corresponding integer output pulse signal, but the pulse signal of output
To count reference value for strict reference, that is, more than or equal to P, then output pulse signal is laid equal stress on New count;Then continue to count less than P,
The response of the pulse signal of the output pulse signal to input coding device with the continuous real-time update of K and P, can be fully achieved
With follow it is ensured that printing precision.
Further, in another embodiment of the present invention, on the basis of example shown in above-mentioned Fig. 3, the method is also
Including:
When this first gap count value is updated to the second gap count value, according to this second gap count value, this frequency dividing
Value D and frequency multiplication value M, using this formula, obtain the second counting reference value.
Then step 305 replaces with:
The numerical value judging this sampling clock rolling counters forward whether more than or equal to this second counting reference value, if more than or
It is equal to, then execution step 306;If being less than, wait this sampling clock rolling counters forward cumulative after execution step 305 again.
In the present embodiment, because the speed of service of stock is variable, therefore, K is likely to changing always, because
, can there are two kinds of special situations of comparison in this:The first situation, the numerical value of sampling clock rolling counters forward are less than or equal to first
When 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 be compared with the second counting reference value.The number of times that second situation, sampling clock count device stored count has been over
First gap count value, but the first gap count value does not also update, then the numerical value of sampling clock rolling counters forward still can be with
First counting reference value is compared, until first counts reference value renewal.
One of ordinary skill in the art will appreciate that:The all or part of step realizing above-mentioned each method embodiment can be led to
Cross the related hardware of programmed instruction to complete.Aforesaid program can be stored in a computer read/write memory medium.This journey
Sequence upon execution, executes the step including above-mentioned each method embodiment;And aforesaid storage medium includes:ROM, RAM, magnetic disc or
Person's CD etc. is various can be with the medium of store program codes.
Fig. 4 is the structural representation of an embodiment of processing meanss of printing precision of the present invention, as shown in figure 4, this reality
The device applying example includes:Count reference value acquisition module 11 and output of pulse signal module 12;Wherein, count reference value and obtain mould
Block 11 is used for the frequency division value D and frequency multiplication value M according to setting, and gap count value K obtaining, using formula N=K × D ÷ M,
Obtain and count reference value P, wherein, described P is the integer part of described N;This first gap count value is more than or equal to default threshold
Value;This predetermined threshold value is according to required precision setting.Output of pulse signal module 12, for counting reference value P according to described,
Output pulse signal.
The processing meanss of the printing precision of the present embodiment can execute the technical scheme of embodiment of the method shown in Fig. 1, in fact
Existing principle is similar, and here is omitted.
In the present embodiment, the frequency division value D according to setting and frequency multiplication value M, and gap count value K obtaining, using public affairs
Formula N=K × D ÷ M, obtains and counts reference value P, wherein, this P is the integer part of this N;And according to this counting reference value P, export
Pulse signal.Because the first gap count value is more than or equal to predetermined threshold value, and predetermined threshold value is according to accuracy requirement setting,
Therefore, carrying out remainder process, that is, after referring to the integer part of acquisition N, error can reduced, thus being effectively improved printing essence
Degree.In addition, algorithm actually uses the ratio of D and M, therefore, the numerical values recited of D and M is not limited, divide and frequency multiplication
Degree of regulation can be as accurate as a system sampling clock cycle, far beyond the demand of printing precision, and no process remainder
Difficulty, therefore, it is possible to the circularity of correct reflection coder structure, the problem of concentricity, and user's request can be met.
Fig. 5 is the structural representation of another embodiment of processing meanss of printing precision of the present invention, shown in above-mentioned Fig. 4
On the basis of embodiment, as shown in figure 5, this device can also include:Gap count value acquisition module 13, works as calculating to obtain
Gap count value K between front moment the first input pulse signal and the second input pulse signal, this first input pulse signal
Previous pulse signal for this second input pulse signal.
Preferably, output of pulse signal module 12 includes:Enabling unit 121, judging unit 122 and output unit 123;Make
Unit 121 can be used for printing enable, and start sampling clock counting device and counted;When judging unit 122 is used for judging sampling
Whether the numerical value of clock rolling counters forward is more than or equal to this counting reference value P;Output unit 123, if should for this judging unit
The numerical value of sampling clock rolling counters forward is more than or equal to this counting reference value P, then output pulse signal, and to this sampling clock
Counter O reset.
Preferably, if this first gap count value is updated to the second gap count value by this gap count value acquisition module 13
When, then flip-flop number reference value acquisition module 11 is according to this second gap count value, this frequency division value D and frequency multiplication value M, using this public affairs
Formula, obtains the second counting reference value;
Then this judging unit 122 be additionally operable to judge the numerical value of this sampling clock rolling counters forward whether more than or equal to this
Two counting reference values;
If this output unit 123 is additionally operable to this judging unit judge to be more than or equal to, output pulse signal, and to this
Sampling clock counts device and resets.
Finally it should be noted that:Various embodiments above only in order to technical scheme to be described, is not intended to limit;To the greatest extent
Pipe has been described in detail to the present invention with reference to foregoing embodiments, it will be understood by those within the art that:Its according to
So the technical scheme described in foregoing embodiments can be modified, or wherein some or all of technical characteristic is entered
Row equivalent;And these modifications or replacement, do not make the essence of appropriate technical solution depart from various embodiments of the present invention technology
The scope of scheme.