Summary of the invention
The technical matters that the application will solve is for the deficiencies in the prior art, and what provide a kind of current mode industrial-controlled general line returns code determination methods.
The technical matters that the application will solve is solved by the following technical programs:
A time code determination methods for current mode industrial-controlled general line, comprises the following steps:
Gather the detection signal that detector sends;
Described detection signal is converted to the level signal of amplification;
Obtain pedestals value, the level value after the conversion of acquisition testing signal, calculates the difference of the level value after described conversion and pedestals value;
Code has been judged whether back according to described difference.
Described acquisition pedestals value, is specially: the level value obtained in the schedule time is set to pedestals value.
Described the level value obtained in the schedule time is set to pedestals value, specifically comprises: be synchronous with low and high level figure signal, the level value that the schedule time of rising when low level uprises level obtains is set to pedestals value.
Describedly judge whether back code according to described difference, specifically comprised: preset first reference value; Calculate the difference between described level value and described pedestals value; Described difference is more than or equal to described first reference value, and described detector has back code.
Describedly judge whether back code according to described difference, also comprised: preset second reference value; When described difference is greater than described second reference value, judge that described detector has repeated code.
The described difference according to described level value and described pedestals value has judged whether back code, also comprises: described difference is less than described first reference value, judges that described detector is without returning code.
Also comprise before the detection signal that described collection detector sends: send the step of patrolling and examining signal to detector.
Owing to have employed above technical scheme, the beneficial effect that the application is possessed is:
In the embodiment of the application, owing to first obtaining the level value after pedestals value and acquisition testing signal conversion processes, the difference of the level value again after computing and pedestals value, and judged whether back code according to this difference, because when comprising back coded signal in detection signal, this difference drops in fixing span, so the method for the application is not only easy to judge whether back code, and method is accurately simple, is easy to realize.
Embodiment
By reference to the accompanying drawings the application is described in further detail below by embodiment.
Embodiment one:
As shown in Figure 2, time code determination methods of the application's current mode industrial-controlled general line, its a kind of embodiment, comprises the following steps:
Step 202: gather the detection signal that detector sends;
Step 204: level signal detection signal being converted to amplification;
Step 206: obtain pedestals value, the level value after the conversion of acquisition testing signal, namely obtains the level value of pedestals value and detection signal from the level signal of amplifying, and calculates the difference of the level value after conversion and pedestals value;
Step 208: judged whether back code according to difference.
In one embodiment, in step 206, obtain pedestals value, be specially and the level value obtained in the schedule time is set to pedestals value.
In a kind of embodiment, the level value obtained in the schedule time is set to pedestals value, specifically realizes by following steps:
Synchronous with low and high level figure signal, the level value that the schedule time of rising when low level uprises level obtains is set to pedestals value.In this embodiment, specifically come synchronous by 24V/18V figure signal, the schedule time of rising when 18V becomes 24V obtains pedestals value, specifically can when not receiving the minimum level value of detection signal.In this embodiment, pedestals value can be obtained at the 200 μ s risen when 18V becomes 24V
In one embodiment, in step 208, judge whether back code according to difference, specifically comprised:
Step 2081: preset first reference value; First reference value can set according to the needs of user, can measure or calculate to obtain, and also can be an empirical value.
Step 2082: the difference between compute level value and pedestals value;
Step 2083: difference is more than or equal to the first reference value, judges that detector has back code.Judge whether detector has back code according to the difference between level value and pedestals value, when the difference between level value and pedestals value is greater than the first reference value, can determine that detector has back code.
In one embodiment, in step 208, judge whether back code according to difference, also comprised:
Step 2084: preset second reference value; Second reference value can set according to the needs of user, can measure or calculate to obtain, and also can be an empirical value.
Step 2085: when difference is greater than the second reference value, judges that detector has repeated code.Judge whether detector has repeated code according to the difference between level value and pedestals value, when the difference between level value and pedestals value is greater than the second reference value, can determine that detector has repeated code.
In one embodiment, in step 208, judge whether back code according to difference, also comprised:
Step 2086: difference is less than described first reference value, described detector is without returning code.Judging whether detector has back code according to the difference between level value and pedestals value, when the difference between level value and pedestals value is less than the first reference value, can determining that detector is without returning code.
In one embodiment, also comprise before gathering the detection signal of detector transmission:
The step of patrolling and examining signal is sent to detector.Detector returns detection signal after receiving and patrolling and examining signal.
Time code determination methods of the application's current mode industrial-controlled general line, available query mode gathers the signal in one or more loop, for each loop, available 24V/18V figure signal does synchronously, play 200 μ s places when 18V becomes 24V and obtain pedestals, after this continuous acquisition detection signal to 700 μ s, namely compares with pedestals after collection, has judged whether back code.A kind of embody rule example of the application, as shown in Figure 3, comprises the following steps:
Step 302: start; Send to detector and patrol and examine signal, detector returns detection signal after receiving and patrolling and examining signal.
Step 304: whether start signal effective? judge that whether start signal is effective, if effectively, go to step 306, otherwise go to step 308.
Step 306: put sampling mark, start timing.
Step 308: sampling mark is 1? judge whether sampling mark is 1, if 1, goes to step 310, otherwise, go to step 330.
Step 310: whether to 200 μ s? judge whether timing time has reached 200 μ s, if so, goes to step 312, otherwise goes to step 330.
Step 312: detection signal is amplified and does AD conversion; Sampled signal amplified and carries out AD conversion, being converted into level value;
Step 314: obtain pedestals value, the level value after acquisition testing signal is converted, and calculate the difference of the level value after being converted and pedestals value.
Step 316: difference is more than or equal to the first reference value? first reference value is the reference value judging whether to have back code, first reference value can pre-set, in this embodiment, first reference value is empirical value, judge whether the difference of the level value after being processed and pedestals value is more than or equal to the first reference value, in this way, goes to step 318, otherwise, go to step 320.
Step 318: have back code; Judge that detector has back code, go to step 322.
Step 320: without returning code; Namely, when difference is less than the first reference value, judge that detector is without returning code, goes to step 328.
Step 322: difference is greater than the second reference value? second reference value is the reference value judging whether repeated code, second reference value can pre-set, in this embodiment, second reference value is empirical value, and the second reference value can pre-set, and judges whether the difference of the level value after being processed and pedestals value is more than or equal to the second reference value, in this way, go to step 324, otherwise, go to step 326.
Step 324: have repeated code; When difference is more than or equal to the second reference value, judge that detector has back code and as repeated code.
Step 326: without repeated code; Difference is more than or equal to the first reference value, and when being less than the second reference value, judges that detector has back code and without repeated code, goes to step 328.
Step 328: whether to 700 μ s? in this example, the sampling time 500 μ s of setting, both from 200 μ s to 700 μ s, had judged whether timing time reaches 700 μ s, if so, goes to step 330, otherwise, go to step 332.
Step 330: mark of sampling clearly.
Step 332: terminate.
Embodiment two:
The driving circuit of the current mode industrial-controlled general line of the application, what use the current mode industrial-controlled general line in embodiment one returns code determination methods.
Above content is the further description done the application in conjunction with concrete embodiment, can not assert that the concrete enforcement of the application is confined to these explanations.For the application person of an ordinary skill in the technical field, under the prerequisite not departing from the application's design, some simple deduction or replace can also be made.