Single-chip microcomputer signal circuit with multipath NPN or PNP type input
By designing a multi-channel NPN or PNP input microcontroller signal circuit, the problem that the microcontroller cannot be compatible with NPN and PNP switching quantities is solved, and the hardware circuit is not modified and cost reduction is achieved.
Patent Information
- Application Number
- CN202422330694.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2034-09-24
AI Technical Summary
Existing microcontrollers can only support one of NPN or PNP switches, and cannot be compatible with both types at the same time, resulting in increased costs and labor investment when replacing or modifying hardware circuits.
A single-chip signal circuit with multiple NPN or PNP type input is designed, including a multi-input level protection circuit, an optocoupler and a multi-input signal output circuit, the optocoupler is protected by the input level protection circuit, and the optocoupler is converted into a level state that the microcontroller can recognize.
The microcontroller signal circuit is compatible with NPN and PNP, avoiding hardware circuit modification, reducing product costs and meeting the needs of small circuit boards.
Smart Images

Figure CN223051656U_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of electronic circuits, and particularly to a single-chip microcomputer signal circuit with multiple NPN or PNP type inputs. Background Art
[0002] Currently, many sensors and other devices used in industrial control systems, especially sensors for detecting the position, status, or presence of objects, often have switch outputs in NPN or PNP type. These output types are suitable for connecting to a main control board or a PLC (Programmable Logic Controller) to transmit signals and perform corresponding control and decision-making.
[0003] In many industrial projects, a large number of such switch signals need to be processed. For example, on an automated production line, there may be multiple sensors to detect the position or completion status of products and then send corresponding signals to the main control system to trigger subsequent operations. In these scenarios, ensuring the stability and accuracy of the sensor outputs and the timely response of the main control system to the signals are crucial.
[0004] However, existing single-chip microcomputers can only support one of NPN or PNP type switch signals and cannot support both types simultaneously. If the switch signal of a sensor or other device does not match the single-chip microcomputer, it is necessary to replace the single-chip microcomputer or modify the hardware circuit, which will increase costs and require additional manpower. Summary of the Utility Model
[0005] Therefore, this application provides a single-chip microcomputer signal circuit with multiple NPN or PNP type inputs to solve the problem in the prior art that a single-chip microcomputer can only support one of NPN or PNP type switch signals.
[0006] To achieve the above object, this application provides the following technical solutions:
[0007] A single-chip microcomputer signal circuit with multiple NPN or PNP type inputs includes a multiple-input level protection circuit, an optocoupler, and a multiple-output single-chip microcomputer signal circuit. The input ends of the multiple-input level protection circuits are used to input NPN or PNP type switch signals. The output ends of the multiple-input level protection circuits are electrically connected to the input end of the optocoupler. The output end of the optocoupler is electrically connected to the input ends of the multiple-output single-chip microcomputer signal circuits. The output ends of the multiple-output single-chip microcomputer signal circuits are electrically connected to the input end of the single-chip microcomputer. Among them, the multiple-input level protection circuits are used to protect the optocoupler, the optocoupler is used for optoelectronic conversion, and the multiple-output single-chip microcomputer signal circuits are used to output a determined level state to the single-chip microcomputer.
[0008] Preferably, the input level protection circuit includes a first resistor, a second resistor, and a bidirectional TVS diode. The connection point of the first resistor and the bidirectional TVS diode is used to input an NPN-type or PNP-type switch signal. The other end of the first resistor is electrically connected to one end of the second resistor and the input end of the optocoupler. The other end of the bidirectional TVS diode is electrically connected to the other end of the second resistor and the input end of the optocoupler.
[0009] Preferably, the optocoupler is a transistor output optocoupler.
[0010] Preferably, the model of the transistor output optocoupler is TLP290-4.
[0011] Preferably, the single-chip microcomputer signal output circuit includes a third resistor, a fourth resistor, and a light-emitting diode. After the third resistor, the fourth resistor, and the light-emitting diode are connected in series, one end is electrically connected to the output end of the optocoupler, and the other end is electrically connected to the input end of the single-chip microcomputer. A voltage is applied between the third resistor and the fourth resistor, and a short circuit line is provided between the output end of the optocoupler and the output end of the light-emitting diode.
[0012] Preferably, both the input level protection circuit and the single-chip microcomputer signal output circuit are provided with four paths.
[0013] Compared with the prior art, the present application has at least the following beneficial effects:
[0014] The present application provides a single-chip microcomputer signal circuit with multiple NPN or PNP-type inputs, including a multiple-input level protection circuit, an optocoupler, and a multiple single-chip microcomputer signal output circuit. The input end of the multiple-input level protection circuit is used to input an NPN-type or PNP-type switch signal. The output end of the multiple-input level protection circuit is electrically connected to the input end of the optocoupler. The output end of the optocoupler is electrically connected to the input end of the multiple single-chip microcomputer signal output circuit. The output end of the multiple single-chip microcomputer signal output circuit is electrically connected to the input end of the single-chip microcomputer. Among them, the multiple-input level protection circuit is used to protect the optocoupler, the optocoupler is used for photoelectric conversion, and the multiple single-chip microcomputer signal output circuit is used to output a determined level state to the single-chip microcomputer. The single-chip microcomputer signal circuit with multiple NPN or PNP-type inputs provided by the present application can be compatible with both NPN and PNP forms of switch quantities at the same time. This compatibility makes it unnecessary to modify the hardware circuit when the scheme is changed or different signal output devices are replaced, reducing the product cost. Description of the Drawings
[0015] To more intuitively illustrate the prior art and this application, exemplary drawings are given below. It should be understood that the specific shapes and structures shown in the drawings generally should not be regarded as limiting conditions when implementing this application; for example, those skilled in the art are capable of making routine adjustments or further optimizations to the addition / deletion / attribution division of certain units (components), specific shapes, positional relationships, connection methods, dimensional proportional relationships, etc. based on the technical concept disclosed in this application and the exemplary drawings.
[0016] Figure 1 This is a schematic block diagram of a single-chip microcomputer signal circuit with multiple NPN or PNP type inputs provided by this application;
[0017] Figure 2 This is a circuit schematic diagram of a multi-input level protection circuit and an optocoupler provided by this application;
[0018] Figure 3 This is a circuit schematic diagram of an optocoupler and a multi-channel single-chip microcomputer signal output circuit provided by this application.
[0019] Explanation of reference numerals:
[0020] 1. Input level protection circuit; 2. Optocoupler; 3. Single-chip microcomputer signal output circuit. Detailed implementation manners
[0021] The following further details this application through specific embodiments in conjunction with the drawings.
[0022] In the description of this application: Unless otherwise specified, the meaning of "multiple" is two or more. Terms such as "first", "second", "third", etc. in this application are intended to distinguish the objects being referred to, and do not have special significance in terms of technical connotations (for example, they should not be understood as emphasizing importance or order, etc.). Expressions such as "including", "comprising", "having", etc. also mean "not limited to" (certain units, components, materials, steps, etc.).
[0023] Terms such as "upper", "lower", "left", "right", "middle", etc. cited in this application are usually indications of the general relative positional relationship for the convenience of intuitively understanding with reference to the drawings, and are not absolute limitations on the positional relationship in the actual product.
[0024] Please refer to Figure 1, this application provides a single-chip microcomputer signal circuit with multiple NPN or PNP type inputs, including a multiple-input level protection circuit 1, an optocoupler 2, and a multiple single-chip microcomputer signal output circuit 3. The input end of the multiple-input level protection circuit 1 is used to input NPN type or PNP type switch signals. The output end of the multiple-input level protection circuit 1 is electrically connected to the input end of the optocoupler 2. The output end of the optocoupler 2 is electrically connected to the input end of the multiple single-chip microcomputer signal output circuit 3. The output end of the multiple single-chip microcomputer signal output circuit 3 is electrically connected to the input end of the single-chip microcomputer. Among them, the multiple-input level protection circuit 1 is used to protect the optocoupler 2, the optocoupler 2 is used for optoelectronic conversion, and the multiple single-chip microcomputer signal output circuit 3 is used to output a determined level state to the single-chip microcomputer.
[0025] Please refer to Figure 2 , the input level protection circuit 1 is provided with four paths. Each path of the input level protection circuit 1 cooperates with a bidirectional TVS diode through two resistors to protect the optocoupler 2 against signal anomalies that may be brought about by the input of NPN type and PNP type switch signals.
[0026] Specifically, the first path of the input level protection circuit 1 includes a first resistor R34, a second resistor R42, and a bidirectional TVS diode DR15. The connection point of the first resistor R34 and the bidirectional TVS diode DR15 is used to input NPN type or PNP type switch signals. The other end of the first resistor R34 is electrically connected to one end of the second resistor R42 and the input end of the optocoupler 2 (pin 1 of chip U6). The other end of the bidirectional TVS diode DR15 is electrically connected to the other end of the second resistor R42 and the input end of the optocoupler 2 (pin 2 of chip U6).
[0027] The second path of the input level protection circuit 1 includes a first resistor R18, a second resistor R26, and a bidirectional TVS diode DR7. The connection point of the first resistor R18 and the bidirectional TVS diode DR7 is used to input NPN type or PNP type switch signals. The other end of the first resistor R18 is electrically connected to one end of the second resistor R26 and the input end of the optocoupler 2 (pin 3 of chip U6). The other end of the bidirectional TVS diode DR7 is electrically connected to the other end of the second resistor R26 and the input end of the optocoupler 2 (pin 4 of chip U6).
[0028] The third input level protection circuit 1 includes a first resistor R19, a second resistor R27, and a bidirectional TVS diode DR8. The connection point of the first resistor R19 and the bidirectional TVS diode DR8 is used to input an NPN-type or PNP-type switch signal. The other end of the first resistor R19 is electrically connected to one end of the second resistor R27 and the input end (the 5th pin of chip U6) of the optocoupler 2. The other end of the bidirectional TVS diode DR8 is electrically connected to the other end of the second resistor R27 and the input end (the 6th pin of chip U6) of the optocoupler 2.
[0029] The fourth input level protection circuit 1 includes a first resistor R35, a second resistor R43, and a bidirectional TVS diode DR16. The connection point of the first resistor R35 and the bidirectional TVS diode DR16 is used to input an NPN-type or PNP-type switch signal. The other end of the first resistor R35 is electrically connected to one end of the second resistor R43 and the input end (the 7th pin of chip U6) of the optocoupler 2. The other end of the bidirectional TVS diode DR16 is electrically connected to the other end of the second resistor R43 and the input end (the 8th pin of chip U6) of the optocoupler 2.
[0030] In this application, the optocoupler 2 (chip U6) is a transistor output optocoupler, and the model of the transistor output optocoupler is TLP290-4.
[0031] In other words, pin 1 of the transistor output optocoupler with the model of TLP290-4 and the part number U6 is connected to one end of the chip resistor with the part number R42 and one end of the chip resistor with the part number R34. Pin 2 is connected to pin 4, pin 6, pin 8, one end of the chip resistor with the part number R42, one end of the bidirectional TVS diode with the part number DR15, one end of the chip resistor with the part number R26, one end of the bidirectional TVS diode with the part number DR7, one end of the chip resistor with the part number R27, one end of the bidirectional TVS diode with the part number DR8, one end of the chip resistor with the part number R43, and one end of the bidirectional TVS diode with the part number DR16, and they are commonly connected to the DI_COM1 network. Pin 3 is connected to one end of the chip resistor with the part number R26 and one end of the chip resistor with the part number R18. Pin 5 is connected to one end of the chip resistor with the part number R27 and one end of the chip resistor with the part number R19. Pin 7 is connected to one end of the chip resistor with the part number R43 and one end of the chip resistor with the part number R35. One end of the chip resistor with the part number R34 is connected to one end of the bidirectional TVS diode with the part number DR15 and they are commonly connected to the DI_13 network. One end of the chip resistor with the part number R18 is connected to one end of the bidirectional TVS diode with the part number DR7 and they are commonly connected to the DI_14 network. One end of the chip resistor with the part number R19 is connected to one end of the bidirectional TVS diode with the part number DR8 and they are commonly connected to the DI_15 network. One end of the chip resistor with the part number R35 is connected to one end of the bidirectional TVS diode with the part number DR16 and they are commonly connected to the DI_16 network.
[0032] Please refer toFigure 3 The single-chip microcomputer signal output circuit 3 is also provided with four paths. Each path of the single-chip microcomputer signal output circuit 3 gives a definite level state to the I / O pin of the single-chip microcomputer after current limiting through a resistor. That is, when there is a signal input, a 3.3V voltage will be given to a specific I / O pin of the single-chip microcomputer, and the corresponding digital signal is "1"; when there is no signal input, a 3.3V voltage will not be given to a specific I / O pin of the single-chip microcomputer, and at this time, the I / O pin of the single-chip microcomputer is in the level state configured internally.
[0033] Specifically, the first path of the single-chip microcomputer signal output circuit 3 includes a third resistor R56, a fourth resistor R72, and a light-emitting diode D15. After the third resistor R56, the fourth resistor R72, and the light-emitting diode D15 are connected in series, one end is electrically connected to the output end of the optocoupler 2 (the 16th pin of chip U6), and the other end is electrically connected to the input end of the single-chip microcomputer. A 3.3V voltage is applied between the third resistor R56 and the fourth resistor R72, and a short circuit line is provided between the output end of the optocoupler 2 (the 16th pin of chip U6) and the output end of the light-emitting diode D15.
[0034] The second path of the single-chip microcomputer signal output circuit 3 includes a third resistor R57, a fourth resistor R73, and a light-emitting diode D16. After the third resistor R57, the fourth resistor R73, and the light-emitting diode D16 are connected in series, one end is electrically connected to the output end of the optocoupler 2 (the 14th pin of chip U6), and the other end is electrically connected to the input end of the single-chip microcomputer. A 3.3V voltage is applied between the third resistor R57 and the fourth resistor R73, and a short circuit line is provided between the output end of the optocoupler 2 (the 14th pin of chip U6) and the output end of the light-emitting diode D16.
[0035] The third path of the single-chip microcomputer signal output circuit 3 includes a third resistor R58, a fourth resistor R74, and a light-emitting diode D17. After the third resistor R58, the fourth resistor R74, and the light-emitting diode D17 are connected in series, one end is electrically connected to the output end of the optocoupler 2 (the 12th pin of chip U6), and the other end is electrically connected to the input end of the single-chip microcomputer. A 3.3V voltage is applied between the third resistor R58 and the fourth resistor R74, and a short circuit line is provided between the output end of the optocoupler 2 (the 12th pin of chip U6) and the output end of the light-emitting diode D17.
[0036] The fourth path of the single-chip microcomputer signal output circuit 3 includes a third resistor R59, a fourth resistor R75, and a light-emitting diode D18. After the third resistor R59, the fourth resistor R75, and the light-emitting diode D18 are connected in series, one end is electrically connected to the output end of the optocoupler 2 (the 10th pin of chip U6), and the other end is electrically connected to the input end of the single-chip microcomputer. A 3.3V voltage is applied between the third resistor R59 and the fourth resistor R75, and a short circuit line is provided between the output end of the optocoupler 2 (the 10th pin of chip U6) and the output end of the light-emitting diode D18.
[0037] In other words, pin 9 of the transistor output optocoupler with the model number TLP290-4 at designator U6 is connected to pin 11, and pins 13 and 15 are commonly connected to the GND network. Pin 10 is connected to one end of the surface mount resistor R59 at designator and the cathode of the surface mount LED D18, and they are commonly connected to the IN_16 network. Pin 12 is connected to one end of the surface mount resistor R58 at designator and the cathode of the surface mount LED D17, and they are commonly connected to the IN_15 network. Pin 14 is connected to one end of the surface mount resistor R57 at designator and the cathode of the surface mount LED D16, and they are commonly connected to the IN_14 network. Pin 16 is connected to one end of the surface mount resistor R56 at designator and the cathode of the surface mount LED D15, and they are commonly connected to the IN_13 network. One end of the surface mount resistor R59 at designator is connected to one end of the surface mount resistor R75 at designator and they are commonly connected to the 3.3V network. One end of the surface mount resistor R58 at designator is connected to one end of the surface mount resistor R74 at designator and they are commonly connected to the 3.3V network. One end of the surface mount resistor R57 at designator is connected to one end of the surface mount resistor R73 at designator and they are commonly connected to the 3.3V network. One end of the surface mount resistor R56 at designator is connected to one end of the surface mount resistor R72 at designator and they are commonly connected to the 3.3V network. One end of the surface mount resistor R75 at designator is connected to the anode of the surface mount LED D18 at designator. One end of the surface mount resistor R74 at designator is connected to the anode of the surface mount LED D17 at designator. One end of the surface mount resistor R73 at designator is connected to the anode of the surface mount LED D16 at designator. One end of the surface mount resistor R72 at designator is connected to the anode of the surface mount LED D15 at designator.
[0038] A single-chip microcomputer signal circuit with multiple NPN or PNP type inputs provided by this application can process 4 input signals that are compatible with both NPN and PNP forms using one chip, and convert them into digital signals recognizable by the single-chip microcomputer. This compatibility eliminates the need to modify the hardware circuit when the scheme is changed or different signal output devices are replaced, thus reducing the product cost. In addition, the 4 inputs of a single chip being compatible with both forms helps to meet the requirements of a small circuit board size and save costs.
[0039] The technical features of the above embodiments can be combined arbitrarily (as long as there is no contradiction in the combination of these technical features). For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described; these embodiments that are not explicitly written should also be considered to be within the scope described in this specification.
Claims
1. A single-chip signal circuit with multiple NPN or PNP inputs, characterized in that: It comprises a multi-channel input level protection circuit, a photoelectric coupler and a multi-channel single-chip signal output circuit, wherein the input end of the multi-channel input level protection circuit is used to input NPN or PNP switch signals, the output end of the multi-channel input level protection circuit is electrically connected to the input end of the photoelectric coupler, the output end of the photoelectric coupler is electrically connected to the input end of the multi-channel single-chip signal output circuit, and the output end of the multi-channel single-chip signal output circuit is electrically connected to the input end of the single-chip; wherein the multi-channel input level protection circuit is used to protect the photoelectric coupler, the photoelectric coupler is used for photoelectric conversion, and the multi-channel single-chip signal output circuit is used to output a determined level state to the single-chip.
2. The single chip signal circuit with multiple NPN or PNP inputs according to claim 1, characterized in that: The input level protection circuit includes a first resistor, a second resistor and a bidirectional TVS diode, the connection point between the first resistor and the bidirectional TVS diode is used to input an NPN or PNP switching signal, the other end of the first resistor is electrically connected to one end of the second resistor and the input end of the photocoupler, and the other end of the bidirectional TVS diode is electrically connected to the other end of the second resistor and the input end of the photocoupler.
3. The single chip signal circuit with multiple NPN or PNP inputs according to claim 1, characterized in that: The photoelectric coupler is a transistor output photocoupler.
4. The single chip signal circuit with multiple NPN or PNP inputs according to claim 3, characterized in that: The model of the transistor output optocoupler is TLP290-4.
5. The single chip signal circuit with multiple NPN or PNP inputs according to claim 1, characterized in that: The single-chip signal output circuit includes a third resistor, a fourth resistor and a light-emitting diode. The third resistor, the fourth resistor and the light-emitting diode are connected in series, one end of which is electrically connected to the output end of the photoelectric coupler, and the other end is electrically connected to the input end of the single-chip computer. A voltage is loaded between the third resistor and the fourth resistor, and a short-circuit line is set between the output end of the photoelectric coupler and the output end of the light-emitting diode.
6. The single chip signal circuit with multiple NPN or PNP inputs according to claim 1, characterized in that: The input level protection circuit and the single chip computer signal output circuit are both provided with four paths.