Utility model content
One purpose of the utility model is to provide a kind of device that data communication is carried using Sensor output, can
Realize that output line can not only directly drive the executing agencies such as relay, moreover it is possible to and host computer carries out data exchange, and does not increase
Cost.
One aspect according to the present utility model provides a kind of dress that data communication is carried using Sensor output
It sets, which includes: sensor unit and setup unit, wherein
The sensor unit, comprising: sensor MPU, resistance R1, the triode Tr1 of resistance R2, NPN, NPN triode
Tr2, voltage regulator circuit Reg and sample resistance Rsense, wherein one end of voltage regulator circuit Reg is connected with 12V power supply, and the other end is defeated
5V power supply out;The port P1.0 of sensor MPU is connected with one end of R2, the collector of the port P2.0 and Tr2 of sensor MPU and
One end of R1 is connected;One end of resistance R1 is connected with 5V power supply, the other end of resistance R1 and the collector and sensing of triode Tr2
The port P2.0 of device MPU is connected;One end of electricity group R2 is connected with the port P1.0 of sensor MPU, and the other end is with triode Tr1's
Base stage is connected;The base stage of triode Tr1 is connected with one end of resistance R2, the emitter of triode Tr1 and the base stage of triode Tr2
And one end of sample resistance Rsense is connected;One end phase of the collector of triode Tr2 and the port P2.0 and R1 of sensor MPU
Even, the base stage of triode Tr2 is connected with one end of the emitter of Tr1 and sample resistance Rsense, and the emitter of triode Tr2 connects
Ground;One end of sample resistance Rsense is connected with the base stage of the emitter of Tr1 and Tr2, the other end ground connection of Rsense;
The setup unit, comprising: setup unit MPU, PNP triode Tr3, NPN triode Tr4, resistance R3, resistance
R4, resistance R5 and setting panel, wherein the setting panel is connect with setup unit MPU, implements the port of setup unit MPU
P3.0 is connected with one end of resistance R3, one end of the port P3.1 and resistance R4 of setup unit MPU and the collector of triode Tr4
It is connected;The collector of triode Tr3 is connected with 12V power supply, and the base stage of triode Tr3 is connected with one end of resistance R3, triode
The emitter of Tr3 is connected with one end of R5, and the emitter of triode Tr3 is connected with the collector of triode Tr1, defeated as signal
Enter output line (SIO);The collector of NPN triode Tr4 is connected with one end of the port P3.1 of setup unit MPU and resistance R4,
The base stage of triode Tr4 is connected with one end of resistance R5, the emitter ground connection of triode Tr4;One end of resistance R3 and setting are single
The port P3.0 of first MPU is connected, and the resistance R3 other end is connected with the base stage of Tr3;One end of the resistance R4 and 12V power supply phase
Even, the other end of resistance R4 is connected with the collector of the port P3.1 of the setup unit MPU and triode Tr4;Resistance R5's
The base stage of one end triode Tr4 is connected, and the other end is connected with the emitter of the collector of triode Tr1 and Tr3
Further, in above-mentioned apparatus, the time of data of described device transmission successively include duty cycle T1 and
Rest period T2, wherein the duty cycle, T1 successively included:
In signal stabilization cycle T 10, after sensor MPU issues signal, setup unit MPU switchs to data from other states
Swap status, waiting signal;
In confirmation cycle T 11, after issuing confirmation signal by setup unit MPU, by sensor MPU to the confirmation signal
Confirmed;
It successively include the response bits of sensor MPU in response and data transmission cycle T 12, setup unit MPU issues number
According to start bit, data bit and check bit.
In data return period T13, after sensor MPU is according to the data for receiving setup unit MPU sending, to setting
Unit MPU returned data.
Further, in above-mentioned apparatus, in the signal stabilization cycle T 10, successively include:
Port P1.0 becomes high level from low level;
Triode Tr1 conducting;
Triode Tr4 cut-off;
Port P3.1 becomes high level from low level.
Further, in above-mentioned apparatus, in the confirmation cycle T 11, successively include:
Port P3.0 becomes high level from low level;
Triode Tr3 cut-off;
Overcurrent disappears;
Triode Tr2 cut-off;
Port P2.0 becomes high level from low level.
Further, in above-mentioned apparatus, in the response and data transmission cycle T 12, successively include:
Port P1.0 becomes low level from high level;
Triode Tr1 cut-off;
Triode Tr4 conducting;
Port P3.1 becomes low level from high level.
Compared with prior art, the utility model compared with prior art, has the advantages that
1. improving the efficiency of parameter testing in sensor production process
The certain system-level parameters needs of sensor could be set after the assembly is completed, and for these parameters, present way is
Testing weld pad is placed on circuit boards, carries out on-line tuning after being contacted with thimble.The shortcomings that this mode, is that testing weld pad accounts for
It according to circuit board space, and cannot be configured after complete assembly, parameters precision is not high.The method of the utility model can be
After product assembles completely, achieve the purpose that parameter is written by the communication of output line.
2. contribution of pair product during installation and debugging
During product installation and debugging, there is the installation point of some equipment excessively narrow, hand and the unapproachable occasion of tool,
If be adjusted by output line, so that it may solve the problems, such as.The equipment that connection output line is adjusted can be host controller,
It is also possible to hand-held adjustment box.
3. the contribution pair reduction material and processing cost
Communication function is increased, but does not need expensive telecommunication circuit and chip, using in sensor output circuit
Short-circuit checking circuit, by the utility model proposes timing and method, with can with the controller of setup parameter carry out data friendship
It changes.It thus can be omitted adjustment structure and adjustment circuit, because assembly time also shortens dramatically without adjustment structure, save
About processing cost.
4. reducing the difficulty of product structure design, assembly difficulty, while accelerating development progress, reduction assembly time
Structure component, such as knob, button, sealing ring can be reduced using communication modes, reducing infrastructure cost (reduces
About 10%) and assembly cost (reduce about 20%).
5. can more easily reach the environmental resistance of product, accomplish inexpensive high protection.
Specific embodiment
The utility model is described in further detail with reference to the accompanying drawing.
In a typical configuration of this application, terminal, the equipment of service network and trusted party include one or more
Processor (CPU), input/output interface, network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or
Any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, computer
Readable medium does not include non-temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
The parameter of sensor is configured using potentiometer and button, switch.Such as to carry out sensitivity (sensitivity) tune
Whole, general method of adjustment is divided into two kinds, and a kind of method of simulation changes the big of signal level by adjusting the resistance value of potentiometer
It is small to adjust sensitivity.Also one is digital forms, and the adjustment of sensitivity is completed by the operation of button.
The method that sensor and host computer are communicated generally may include: sensor by dedicated communication chip and lead to
Circuit is interrogated, carries out the parameter of communication acquisition sensitivity by setting necessary communications protocol and host computer.Host computer can be calculating
Machine is also possible to dedicated handheld device.This mode can carry out the data exchange of large capacity, but need additional biography
Defeated line and transmission circuit.
The purposes of sensor output control line be the state that detects sensor with certain load capacity (usually
Lower level controller is output to for 100mA or so) current system.Lower level controller can be the input such as relay coil, PLC, IPC
Circuit.It is example as shown in Figure 1, in Fig. 1 with general output circuit (NPN), exports triode and sample resistance constitutes most
Simple output circuit, the effect of sample resistance are when output line and load power source short circuit, and short circuit current is on sample resistance
When the voltage of generation is greater than the conducting voltage of Tr2, the port MPU will appear low level, and after CPU detects the low level, P1.0 is defeated
Low level out guarantees that output triode Tr1 is not destroyed because of short circuit.After closing output a period of time (T2), P1.0
High level is exported, output triode is opened into (T1), detection short-circuit signal is either with or without disappearance, if disappeared, according to detection shape
State normally exports, if still Tr2 is on state, continues to close output.Wherein, the selection of T1 and T2 guarantees
Tr1 will not be short-circuited electric current destruction.The duty ratio of general T1 and T2 is 1:100, and data used herein are 200us and 20ms.
If output electric current is lower than the short circuit current that can be detected, the short circuit detection port of P2.0 is as shown in Fig. 2 dotted line, place
In high level.Short-circuit detecting timing diagram is as shown in Figure 2.
1. the composition of communication
As described above, it is found that when output action, i.e. P1.0 is in the T1 stage of high level, triode Tr1
It is constantly on state, and the on state of triode Tr2 depends on the state of load.This state is according to typically now setting
The fixed time is 200us.According to the basic conception of data communication and the speed of service of CPU, during 200us, carry out several
The communication of ten bit datas is entirely possible.
As shown in figure 3, being divided into T10~T13 in the 200us period of T1, being respectively:
T10: signal stabilization time, about 50us
T11: handshake, about 30us
T12: response and data receiver 10bit, about 50us
T13: data return, about 70us
T10 is a signal stabilization period, after sensor MPU issues signal, setup unit MPU (and sensor is counted
According to the equipment of exchange) from other states switch to data exchange state, the waiting signal needed.This state can be with 10us, can also
With 50us, depending on different hardware
T11 is a confirmation period, confirmation signal is issued by setup unit MPU, by sensor MPU to the confirmation signal
Confirmed, it is therefore intended that differentiation be short circuit in sensor use process or in order to exchange data and deliberately caused by it is short
Road.In use because route shake or wiring it is not firm, also will appear the shape instantaneously disconnected in short-circuit process
State, so the confirmation period is ensuring that and identifies communication state or unexpected state.The longer this period the more reliable.
T12 is response and data transfer cycles, can be divided into the response bits of sensor MPU, and setup unit MPU issues data
Start bit, data bit and check bit, this example period between 50~60us, transmit 8~10bit data.
T13 is sensor MPU according to returning to the one of setup unit MPU after the data for receiving setup unit MPU sending
Group data can also return to the characteristic value of data just now according to received value just now is returned.Guarantee to receive the correct of data
Property.
2. the composition of data
Because not implementing communication using the serial port resource of MPU, in communication, upper and lower machine is in highest level
Response, shields all interruptions, can not implement multitask, so data must be short and clean and tidy.It is one that upper and lower machine, which arranges 5us,
Data width is calibrated after being responded by enabling signal edging trigger, eliminates cumulative errors.Data constitute such as Fig. 4 institute
Show.
Pulse series data shown in Fig. 4 is 010100001010110, wherein may include start bit, data bit, check bit
Deng identical with the data of general communication expression.But the definition of bits per inch evidence is not exactly the same.
It is T1+T2, about 22ms according to the time for shown in Fig. 3, completing the transmission of a data.T2 is the time that must be rested,
Guarantee that output triode is not burnt.
As shown in figure 5, the utility model provides a kind of device for carrying data communication using Sensor output, including pass
Sensor cell (Sensor) and setup unit (Setting unit), wherein
The sensor unit, comprising: sensor MPU, resistance R1, the triode Tr1 of resistance R2, NPN, NPN triode
Tr2, voltage regulator circuit Reg and sample resistance Rsense, wherein one end of voltage regulator circuit Reg is connected with 12V power supply, and the other end is defeated
5V power supply out;The port P1.0 of sensor MPU is connected with one end of R2, the collector of the port P2.0 and Tr2 of sensor MPU and
One end of R1 is connected;One end of resistance R1 is connected with 5V power supply, the other end of resistance R1 and the collector and sensing of triode Tr2
The port P2.0 of device MPU is connected;One end of electricity group R2 is connected with the port P1.0 of sensor MPU, and the other end is with triode Tr1's
Base stage is connected;The base stage of triode Tr1 is connected with one end of resistance R2, the emitter of triode Tr1 and the base stage of triode Tr2
And one end of sample resistance Rsense is connected;One end phase of the collector of triode Tr2 and the port P2.0 and R1 of sensor MPU
Even, the base stage of triode Tr2 is connected with one end of the emitter of Tr1 and sample resistance Rsense, and the emitter of triode Tr2 connects
Ground;One end of sample resistance Rsense is connected with the base stage of the emitter of Tr1 and Tr2, the other end ground connection of Rsense;
The setup unit, comprising: setup unit MPU, PNP triode Tr3, NPN triode Tr4, resistance R3, resistance
R4, resistance R5 and setting panel (setting panel), wherein the setting panel is connect with setup unit MPU, and setting is single
The port P3.0 of first MPU is connected with one end of resistance R3, one end of the port P3.1 and resistance R4 of setup unit MPU and triode
The collector of Tr4 is connected;The collector of triode Tr3 is connected with 12V power supply, the base stage of triode Tr3 and one end of resistance R3
It is connected, the emitter of triode Tr3 is connected with one end of R5, the collector phase of the emitter and triode Tr1 of triode Tr3
Even, as signal input-output line (SIO);The collector of NPN triode Tr4 and the port P3.1 of setup unit MPU and resistance
One end of R4 is connected, and the base stage of triode Tr4 is connected with one end of resistance R5, the emitter ground connection of triode Tr4;Resistance R3's
One end is connected with the port P3.0 of setup unit MPU, and the resistance R3 other end is connected with the base stage of Tr3;One end of the resistance R4
It is connected with 12V power supply, the collector phase of the other end of resistance R4 and the port P3.1 and triode Tr4 of the setup unit MPU
Even;The base stage of one end triode Tr4 of resistance R5 is connected, the other end and the collector of triode Tr1 and the emitter phase of Tr3
Even.
Here, the sensor unit can be simplest three-wire type NPN output.Three lines are respectively power supply 12v, power supply
Ground and movement output line (being multiplexing port when parameter setting, as signal I/O line)
Three line end mouths of the setup unit, respectively power supply 12v, power ground and I/O line can be hand-held adjuster,
It is also possible to the parameter setting module of production line check machine.
Specific port setting can be as follows:
As shown in figure 5, sensor unit is connected with setup unit according to Fig. 5 when needing to carry out parameter setting.Setting is single
Member is powered, and sensor is placed in movement output.The parameter of setup unit is adjusted, setup unit is transferred data to by SIO line
Sensor.
According to the circuit that Fig. 5 is indicated, sensor MPU and setup unit MPU completely may be used by respective input/output port
To monitor and adapter tube SIO line is according to the prior agreement to messaging parameter can carry out bidirectional data transfers on SIO line.
The signal input-output line (SIO) of the utility model can not only directly drive the executing agencies such as relay, moreover it is possible to
Simple data exchange is carried out with host computer, and does not increase cost.
As shown in fig. 6, in one embodiment of device for carrying data communication using Sensor output of the utility model, institute
The time for stating the data transmission of device successively includes duty cycle T1 and rest period T2, wherein duty cycle T1 is successively
Include:
Signal stabilization cycle T 10, after issuing signal for sensor MPU, setup unit MPU switchs to data from other states
Swap status, waiting signal;
Cycle T 11 is confirmed, after issuing confirmation signal by setup unit MPU, by sensor MPU to the confirmation signal
Confirmed;
Response and data transmission cycle T 12, successively include the response bits of sensor MPU, and setup unit MPU issues data
Start bit, data bit and check bit.
Data return period T13, for sensor MPU according to receive setup unit MPU sending data after, to setting
Unit MPU returned data.
In one embodiment of device for carrying data communication using Sensor output of the utility model, the signal stabilization
Cycle T 10 successively includes:
Port P1.0 becomes high level from low level;
Triode Tr1 conducting;
Triode Tr4 cut-off;
Port P3.1 becomes high level from low level.
In one embodiment of device for carrying data communication using Sensor output of the utility model, the confirmation period
T11 successively includes:
Port P3.0 becomes high level from low level;
Triode Tr3 cut-off;
Overcurrent disappears;
Triode Tr2 cut-off;
Port P2.0 becomes high level from low level.
In one embodiment of device for carrying data communication using Sensor output of the utility model, the response sum number
Successively include: according to transmission cycle T 12
Port P1.0 becomes low level from high level;
Triode Tr1 cut-off;
Triode Tr4 conducting;
Port P3.1 becomes low level from high level.
Specifically, data flow and signal transmitting are as follows:
1. the T1 period starts:
Port P1.0 0 → 1, Tr1 conducting, Tr4 cut-off, P3.1 0 → 1
2. handshake sends and receives: by taking transmission " 1 " as an example:
P3.0 0 → 1, Tr3 cut-off, overcurrent disappear, Tr2 cut-off, P2.0 0 → 1
3. that replys and verify sends and receives:
Send P1.0 1 → 0, Tr1 cut-off, Tr4 conducting, P3.1 1 → 0.
As shown in fig. 7, the setting method of the device for carrying data communication using Sensor output of the utility model, packet
It includes:
Connect the signal input-output line (SIO) between setup unit and sensor unit;
The setup unit is powered, and makees data and sends preparation;
Sensor MPU is powered and is in action state, triode Tr1 conducting, the T10 period for starting the T1 period and entering;
Sensor MPU reads handshake, into the T11 period;
Setup unit MPU detects the T1 period, waits preset time such as 50us, sends handshake;
Sensor MPU verifies handshake, and after being verified, triode Tr1 closes preset time as described in 5us carrys out response
Setup unit MPU;
The setup unit MPU judges whether to receive response, if receiving response, sends one group of setting data to sensing
Device MPU;
After sensor MPU receives the setting data, into the T13 period, judge sensor MPU whether to setup unit
MPU, which is returned, reads data, if so,
Setup unit MPU verifies the reading data of the return;
Judge whether setup unit MPU has operation, if without operation, into the T2 period.
In one embodiment of setting method of the device for carrying data communication using Sensor output of the utility model, institute
It states after setup unit MPU judges whether to receive response, further includes:
If not receiving response, next T1 period is waited to be again started up.
In one embodiment of setting method of the device for carrying data communication using Sensor output of the utility model, sentence
After whether link sensor MPU returns to reading data to setup unit MPU, further includes:
If it is not, closing triode Tr1 into the T2 period, preventing triode Tr1 scaling loss;
This transmission failure, will be again started up transmission in next T1 period.
In one embodiment of setting method of the device for carrying data communication using Sensor output of the utility model, sentence
Whether disconnected setup unit MPU has after operation, further includes:
If there is operation, show that setup unit MPU has data to send, is then again started up transmission in next T1 period.
In conclusion the utility model compared with prior art, has the advantages that
4. improving the efficiency of parameter testing in sensor production process
The certain system-level parameters needs of sensor could be set after the assembly is completed, and for these parameters, present way is
Testing weld pad is placed on circuit boards, carries out on-line tuning after being contacted with thimble.The shortcomings that this mode, is that testing weld pad accounts for
It according to circuit board space, and cannot be configured after complete assembly, parameters precision is not high.The method of the utility model can be
After product assembles completely, achieve the purpose that parameter is written by the communication of output line.
5. contribution of pair product during installation and debugging
During product installation and debugging, there is the installation point of some equipment excessively narrow, hand and the unapproachable occasion of tool,
If be adjusted by output line, so that it may solve the problems, such as.The equipment that connection output line is adjusted can be host controller,
It is also possible to hand-held adjustment box.
6. the contribution pair reduction material and processing cost
Communication function is increased, but does not need expensive telecommunication circuit and chip, using in sensor output circuit
Short-circuit checking circuit, by the utility model proposes timing and method, with can with the controller of setup parameter carry out data friendship
It changes.It thus can be omitted adjustment structure and adjustment circuit, because assembly time also shortens dramatically without adjustment structure, save
About processing cost.
4. reducing the difficulty of product structure design, assembly difficulty, while accelerating development progress, reduction assembly time
Structure component, such as knob, button, sealing ring can be reduced using communication modes, reducing infrastructure cost (reduces
About 10%) and assembly cost (reduce about 20%).
5. can more easily reach the environmental resistance of product, accomplish inexpensive high protection.
In addition, for the output form of PNP, the utility model does not exclusively carry out description, but according to the circuit of NPN and
Implementation method, special industry personnel are easy to realize by the method for analogy.
The data that the utility model uses during foregoing description, such as T1, T2, response 5us are intended merely to illustrate
Illustrate, not as special case, other any data belong to the scope of the utility model.
The method of the utility model description, which can be applied, detects scene in optoelectronic switch, may be implemented using the utility model
Sensitivity adjustment at the scene;The characteristic check process being also applicable in during sensor production, check machine can pass through this side
Sensor is written in performance data by method.
This patent utility model point is sensor and extraneous progress data interaction, has shared the output line of sensor, and
Do not increase additional circuit.
The communication protocol and timing of the utility model description, are different from general data communication, are under a kind of specified conditions
Data exchange.
Obviously, those skilled in the art can carry out various modification and variations without departing from the essence of the application to the application
Mind and range.In this way, if these modifications and variations of the application belong to the range of the claim of this application and its equivalent technologies
Within, then the application is also intended to include these modifications and variations.
It should be noted that the utility model can be carried out in the assembly of software and/or software and hardware, for example,
Can be used specific integrated circuit (ASIC), general purpose computer or any other realized similar to hardware device.In a reality
It applies in example, the software program of the utility model can be executed to implement the above steps or functions by processor.Similarly,
The software program (including relevant data structure) of the utility model can be stored in computer readable recording medium, example
Such as, RAM memory, magnetic or optical driver or floppy disc and similar devices.In addition, some steps or function of the utility model can
It employs hardware to realize, for example, as the circuit cooperated with processor thereby executing each step or function.
In addition, a part of the utility model can be applied to computer program product, such as computer program instructions, when
When it is computer-executed, by the operation of the computer, method and/or skill according to the present utility model can be called or provided
Art scheme.And the program instruction of the method for the utility model is called, it is possibly stored in fixed or moveable recording medium
In, and/or transmitted by the data flow in broadcast or other signal-bearing mediums, and/or it is stored according to the journey
In the working storage of the computer equipment of sequence instruction operation.Here, one embodiment according to the present utility model includes one
Device, the device include the memory for storing computer program instructions and the processor for executing program instructions, wherein
When the computer program instructions are executed by the processor, device operation is triggered based on aforementioned according to the present utility model multiple
The method and/or technology scheme of embodiment.
It is obvious to a person skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and
And without departing substantially from the spirit or essential attributes of the utility model, it can realize that this is practical new in other specific forms
Type.Therefore, in all respects, the present embodiments are to be considered as illustrative and not restrictive, this is practical new
The range of type is indicated by the appended claims rather than the foregoing description, it is intended that containing for the equivalent requirements of the claims will be fallen in
All changes in justice and range are included in the utility model.It should not treat any reference in the claims as limiting
Related claim.Furthermore, it is to be understood that one word of " comprising " does not exclude other units or steps, odd number is not excluded for plural number.Device
The multiple units or device stated in claim can also be implemented through software or hardware by a unit or device.The
One, the second equal words are used to indicate names, and are not indicated any particular order.