Digital quantity module configurable input and output mode method and system, program product and storage medium
By designing a circuit that can configure input and output modes of digital modules, the problem of installing two modules when input and output is required in the prior art is solved, and a module is used for input and output at the same time, reducing cost and complexity, and improving stability and reliability.
Patent Information
- Application Number
- CN202510062743.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2045-01-15
AI Technical Summary
When existing digital modules require digital input and output operations at the same time, two modules must be installed, which increases the hardware procurement cost and wiring complexity in the electrical cabinet.
By designing a circuit in which digital module can be configured with input and output mode, the IO point can switch input and output mode according to the command of the upper computer, so that a module can be used for input and output at the same time. The circuit includes an input switch circuit and an optocoupler circuit. Through joint work, effective control of the output circuit and invalid determination of input data are achieved.
It reduces hardware procurement costs, reduces wiring costs and difficulty, simplifies wiring in electrical cabinets, and improves the working stability and reliability of digital modules in different modes.
Smart Images

Figure CN119511916A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of control or regulation systems, and in particular to a method, system, program product, and storage medium for configurable input and output modes of a digital quantity module. Background Art
[0002] In the field of industrial automation control, digital modules play a key role. They are important components for realizing signal interaction and control between devices.
[0003] Currently, the common digital modules on the market are divided into pure input and pure output types. However, in some scenarios, when digital input and output operations are required at the same time, two modules must be installed. This not only increases the hardware procurement cost, but also the two modules occupy a large space in the electrical cabinet, which may make the wiring in the electrical cabinet more complicated, increasing the wiring cost and difficulty. Summary of the invention
[0004] The present application provides a method, system, program product, and storage medium for configuring input and output modes of a digital quantity module, so that a digital quantity module can be used for input and output at the same time, thereby reducing costs and occupying space.
[0005] In the first aspect, the present application provides a method for configurable input and output modes of a digital quantity module, which is applied to a circuit in which the digital quantity module can be configured with input and output modes, wherein the IO points of the circuit in which the digital quantity module can be configured with input and output modes are respectively connected to the input circuit and the output circuit, and the method comprises: when receiving an instruction from a host computer, changing the corresponding IO point to an input mode or an output mode; when receiving data from the host computer, judging whether the corresponding IO point is in input mode or output mode; if the corresponding IO point is in input mode, controlling the output circuit of the corresponding IO point so that the output circuit cannot output data; if the corresponding IO point is in output mode, determining that the input data of the corresponding IO point is invalid.
[0006] By adopting the above technical solution, the circuit of the digital quantity module can be configured with input and output modes by connecting the IO point with the input circuit and the output circuit, and switching the input and output mode of the IO point according to the host computer instruction, so that a digital quantity module can be used for input and output at the same time. It avoids the situation where two modules need to be installed when pure input and pure output modules need to perform digital input and output operations at the same time, thereby reducing the hardware procurement cost. In addition, the space occupied by only one module in the electrical cabinet is greatly reduced, which simplifies the wiring in the electrical cabinet and reduces the wiring cost and difficulty.
[0007] In combination with some embodiments of the first aspect, in some embodiments, the circuit of the digital quantity module that can configure the input and output mode includes: an input switch circuit and an optocoupler circuit; the input switch circuit includes a switch chip, the first pin of the switch chip is connected to an external first power supply that provides an operating voltage for the switch chip, the second pin of the switch chip is connected to the external control end, the third pin of the switch chip is connected to the external second power supply, and the fourth pin of the switch chip is connected to the internal control end; the optocoupler circuit includes an optocoupler, the first pin of the optocoupler is connected to the internal control end, the second pin of the optocoupler is connected to the output signal end, the third pin of the optocoupler is connected to the ground, and the fourth pin of the optocoupler is connected to the input signal end.
[0008] By adopting the above technical solution, the input switch circuit and the optocoupler circuit work together. Under the instruction of the external control end, the switch chip changes the internal control end level through the connection relationship of the pins, thereby affecting the optocoupler circuit. The optocoupler circuit controls the input signal end level according to the change of the output signal end level, thereby realizing effective control of the output circuit. This circuit structure enables the output circuit to stop output in the input mode, and correctly judges that the input data is invalid in the output mode, which improves the accuracy and efficiency of the input and output mode switching, and ensures the stability and reliability of the entire digital module working in different modes.
[0009] In combination with some embodiments of the first aspect, in some embodiments, if the corresponding IO point is in input mode, the output circuit of the corresponding IO point is controlled so that the output circuit cannot output data, specifically including: by transmitting instructions to the external control end, the third pin of the switch chip and the fourth pin of the switch chip are turned on, so that the internal control end is consistent with the level of the external second power supply; when a valid level is input to the output signal end, the first pin of the optocoupler and the second pin of the optocoupler are turned on, so that the third pin of the optocoupler and the fourth pin of the optocoupler are turned on; the input signal end outputs a low level, and the low level is used to prohibit the output of the output circuit, and the valid level is a level lower than the level of the external second power supply; when an invalid level is input to the output signal end, the first pin of the optocoupler and the second pin of the optocoupler are not turned on, so that the third pin of the optocoupler and the fourth pin of the optocoupler are not turned on; the input signal end outputs a high level; the high level is used to allow the output of the output circuit, and the invalid level is a level lower than the level of the external second power supply.
[0010] By adopting the above technical solution, in the input mode, the instruction is transmitted to the external control terminal, so that the switch chip pin is turned on to change the internal control terminal level. When there is a valid level input at the output signal end, the corresponding pin of the optocoupler circuit is turned on, so that the input signal end outputs a low level to prohibit the output circuit from outputting; the opposite is true when there is no valid level. Under the control of the level logic, each component avoids the interference of output data under different input modes, improves the adaptability and response speed of the digital module to different working scenarios, and improves work efficiency.
[0011] In combination with some embodiments of the first aspect, in some embodiments, the optocoupler circuit also includes: a diode D1, a resistor R2, a resistor R3, and a resistor R4; the first pin of the optocoupler is connected to the internal control end, specifically including: the positive electrode of the diode D1 is connected to the internal control end, and the negative electrode is connected to one end of the resistor R2; the other end of the resistor R2, one end of the resistor R3, and the internal control end are connected together; the other end of the resistor R3 is connected to the output signal end; the fourth pin of the optocoupler is connected to the input signal end through the resistor R4.
[0012] By adopting the above technical solution, diode D1 can prevent the current from flowing in the reverse direction and protect the internal control end circuit. Resistor R2 is used as the current limiting resistor of the first pin of the optocoupler to effectively limit the current flowing into the optocoupler and prevent excessive current from damaging the optocoupler. Resistor R3 is used as the current limiting resistor of the output signal end and works together with R2 to prevent the output signal end from abnormal due to excessive current. Resistor R4 is used as a pull-up resistor to pull the input signal end up to signal 1, so that the optocoupler circuit can work more accurately according to the changes in the input and output signals, thereby improving the accuracy and stability of the circuit.
[0013] In combination with some embodiments of the first aspect, in some embodiments, the input switch circuit further includes: a resistor R1; and a first pin of the switch chip is connected to an external first power source through the resistor R1.
[0014] By adopting the above technical solution, the resistor R1 connects the first pin of the switch chip and the external first power supply in the input switch circuit, which can limit the current flowing into the switch chip, prevent excessive current from damaging the switch chip, and ensure stable operation of the switch chip.
[0015] In combination with some embodiments of the first aspect, in some embodiments, the optocoupler circuit further includes: a capacitor C1; and the fourth pin of the optocoupler is connected to the input signal terminal through the capacitor C1.
[0016] By adopting the above technical solution, capacitor C1 is connected between the fourth pin of the optocoupler and the input signal end, which can filter the input signal, filter out high-frequency clutter and interference components in the signal, and make the input signal purer and more stable.
[0017] In combination with some embodiments of the first aspect, in some embodiments, a first pin of the IO point is connected to an input circuit, and a second pin of the IO point is connected to an output circuit.
[0018] By adopting the above technical solution, the input end and the DO output end are connected to the same IO point, realizing the integration of input and output functions at the level of a single IO point. This avoids the waste of resources and space occupation caused by the need for multiple independent IO points to handle input and output separately in related designs.
[0019] In a second aspect, the present application provides a digital quantity module configurable input and output mode system, the digital quantity module configurable input and output mode system includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and one or more processors call the computer instructions to enable the digital quantity module configurable input and output mode system to execute the method described in the first aspect and any possible implementation method of the first aspect.
[0020] In a third aspect, the present application provides a computer program product comprising instructions, which, when the computer program product is run on a digital module configurable input-output mode system, enables the digital module configurable input-output mode system to execute the method described in the first aspect and any possible implementation method of the first aspect.
[0021] In a fourth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on a digital module configurable input / output mode system, enables the digital module configurable input / output mode system to execute the method described in the first aspect and any possible implementation method of the first aspect.
[0022] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. The circuit of the digital quantity module can be configured with input and output modes. By connecting the IO point with the input circuit and the output circuit, and switching the input and output mode of the IO point according to the host computer instruction, a digital quantity module can be used for input and output at the same time. It avoids the situation where two modules need to be installed when the pure input and pure output modules need to perform digital input and output operations at the same time, thereby reducing the hardware procurement cost. In addition, the space occupied by only one module in the electrical cabinet is greatly reduced, which simplifies the wiring in the electrical cabinet and reduces the wiring cost and difficulty.
[0023] 2. The input switch circuit works in coordination with the optocoupler circuit. Under the command of the external control terminal, the switch chip changes the internal control terminal level through the connection relationship of the pins, thereby affecting the optocoupler circuit. The optocoupler circuit controls the input signal terminal level according to the change of the output signal terminal level, thereby achieving effective control of the output circuit. This circuit structure enables the output circuit to stop output in the input mode, and correctly determines that the input data is invalid in the output mode, which improves the accuracy and efficiency of the input and output mode switching, and ensures the stability and reliability of the entire digital module in different modes.
[0024] 3. In input mode, transmit instructions to the external control terminal to turn on the pin of the switch chip and change the level of the internal control terminal. When there is a valid level input at the output signal end, the corresponding pin of the optocoupler circuit is turned on, so that the input signal end outputs a low level to prohibit the output circuit from outputting; the opposite is true when there is no valid level. Under the control of level logic, each component avoids interference in output data under different input modes, improves the adaptability and response speed of the digital module to different working scenarios, and improves work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a flowchart of a method for configuring input and output modes of a digital quantity module in an embodiment of the present application; Figure 2 is a circuit diagram of an input switch circuit in an embodiment of the present application; Figure 3 is a circuit diagram of an optocoupler circuit in an embodiment of the present application; Figure 4 This is a circuit diagram of an IO point in an embodiment of the present application; Figure 5 It is an exemplary hardware structure diagram of the configurable input and output mode system of the digital quantity module in the embodiment of the present application. DETAILED DESCRIPTION
[0026] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0027] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0028] A method for configuring input and output modes of a digital quantity module is applied to a circuit of a digital quantity module that can configure input and output modes, wherein the IO points of the circuit of the digital quantity module that can configure input and output modes are connected to an input circuit and an output circuit respectively; See also Figure 1 , Figure 1It is a flowchart of a method for configuring input and output modes of a digital quantity module in an embodiment of the present application; S101, when receiving the instruction from the host computer, change the corresponding IO point to input mode or output mode; Among them, the circuit with configurable input and output modes for the digital quantity module represents a circuit architecture that can flexibly adjust the input and output functions according to actual needs. It refers to a circuit system that can change the working mode of each IO point in the circuit with the help of specific control means in the context of digital quantity signal processing. IO point refers to the connection endpoint used as data input or output in the circuit. The host computer refers to the computer equipment that can issue instructions and transmit data to the digital quantity module in the entire control system to achieve centralized control.
[0029] In some embodiments, after the host computer successfully establishes a communication link with the digital quantity module, the host computer generates and transmits instructions according to the system operation requirements. When the digital quantity module receives the host computer instruction, it will perform a mode switching operation on the corresponding IO point according to the instruction details and convert it into input mode or output mode.
[0030] In some specific embodiments, when the mode needs to be switched, the mode information of the corresponding IO point is directly obtained from the table according to the current task, and an instruction is generated and sent to the digital quantity module. After receiving the instruction, the digital quantity module uses the microcontroller to read the local mode switching program code, and controls the mode switching circuit of the IO point according to the code logic to achieve the mode switching. This is not limited here.
[0031] S102: When receiving data from the host computer, determine whether the corresponding IO point is in input mode or output mode; In some embodiments, when the digital quantity module receives data from the host computer, it will immediately start the mode judgment process. The unit will compare the extracted information with the mode configuration information stored locally according to pre-set rules and algorithms. For example, if the data contains a specific mode identification field, the mode judgment logic unit will search for a match in the local mode identification list to determine whether the corresponding IO point is in input mode or output mode. This judgment method can quickly and accurately determine the working status of the IO point so that the corresponding processing operations can be performed later.
[0032] S103, if the corresponding IO point is in input mode, controlling the output circuit of the corresponding IO point so that the output circuit cannot output data; In some embodiments, when the corresponding IO point is determined to be in input mode, the control logic inside the digital quantity module will be activated. The control unit generates a control signal, which is transmitted to the control switch element in the output circuit, such as a transistor or a relay. Taking a transistor as an example, when the control signal reaches the base of the transistor, if it is an NPN transistor, the increase in the base voltage will turn on the transistor, which will short-circuit the key signal path in the output circuit, such as connecting the output signal to the ground potential, so that the output circuit cannot output a normal signal level, thereby achieving the purpose of being unable to output data. Alternatively, the control signal can also act on the driver chip in the output circuit, causing the driver chip to enter a dormant or disabled state, stop processing and amplifying the output signal, and thereby prevent data output.
[0033] See also Figure 2 and Figure 3 , Figure 2 is a circuit diagram of an input switch circuit in an embodiment of the present application; Figure 3 is a circuit diagram of an optocoupler circuit in an embodiment of the present application; In some specific embodiments, the circuit of the digital quantity module configurable input and output mode includes: Input switch circuit and optocoupler circuit; The input switch circuit includes a switch chip, a first pin of the switch chip is connected to an external first power supply providing a working voltage for the switch chip, a second pin of the switch chip is connected to an external control terminal, a third pin of the switch chip is connected to an external second power supply, and a fourth pin of the switch chip is connected to an internal control terminal; The optocoupler circuit comprises an optocoupler, a first pin of the optocoupler is connected to an internal control terminal, a second pin of the optocoupler is connected to an output signal terminal, a third pin of the optocoupler is connected to ground, and a fourth pin of the optocoupler is connected to an input signal terminal.
[0034] It can be seen that the input switch circuit and the optocoupler circuit work together. Under the instruction of the external control end, the switch chip changes the internal control end level through the connection relationship of the pins, thereby affecting the optocoupler circuit. The optocoupler circuit controls the input signal end level according to the change of the output signal end level, thereby realizing effective control of the output circuit. This circuit structure enables the output circuit to stop output in the input mode, and correctly judges that the input data is invalid in the output mode, which improves the accuracy and efficiency of the input and output mode switching, and ensures the stability and reliability of the entire digital module working in different modes.
[0035] See also Figure 2 and Figure 3 , Figure 2 is a circuit diagram of an input switch circuit in an embodiment of the present application; Figure 3 is a circuit diagram of an optocoupler circuit in an embodiment of the present application; In some specific embodiments, by transmitting an instruction to the external control terminal, the third pin of the switch chip and the fourth pin of the switch chip are turned on, so that the level of the internal control terminal is consistent with that of the external second power supply; In some embodiments, this step is performed when the IO point corresponding to a certain sensor is to be switched to input mode and the output circuit is to be ensured to stop outputting. Overall, in this process, the external control terminal receives an external command signal (this signal can be a level signal issued by the host computer according to a preset program or manual operation, etc.), and then transmits the command signal to the switch chip. After receiving this signal, the internal logic circuit of the switch chip will respond, so that a conductive state is formed between the third pin and the fourth pin. In this way, the internal control terminal, which was originally independent of the external second power supply, will be connected to the external second power supply due to the conduction of the pin, so that the level of the internal control terminal is consistent with the level of the external second power supply.
[0036] When a valid level is input to the output signal end, the first pin of the optocoupler and the second pin of the optocoupler are turned on, so that the third pin of the optocoupler and the fourth pin of the optocoupler are turned on; the input signal end outputs a low level, and the low level is used to disable the output of the output circuit, and the valid level is a level lower than the level of the external second power supply; Among them, the effective level refers to a level signal with a specific voltage range in the present circuit environment, which can trigger the corresponding components in the circuit (such as optocouplers, etc.) to produce expected actions such as conduction. It refers to a level value that meets the pre-set logic level requirements of the circuit and can enable the circuit to operate according to the established function. The level set here is lower than the level of the external second power supply.
[0037] In some embodiments, a valid level signal that meets the requirements is input at the output signal end. After this signal enters the optocoupler circuit, since its level meets the conduction condition of the optocoupler, the light-emitting diode inside the optocoupler will emit light due to the passage of current, so that the first pin and the second pin of the optocoupler are turned on. Based on the working principle of the optocoupler, the phototransistor inside it will be turned on due to receiving the light signal, thereby turning on the third pin and the fourth pin of the optocoupler. In this way, the input signal end will output a low level, and this low level signal is designed to prohibit the output of the output circuit, thereby ensuring that the output circuit will not output a signal to the outside in the input mode, avoiding interference with the input signal acquisition.
[0038] When an invalid level is input to the output signal end, the first pin and the second pin of the optocoupler are not conducting, so that the third pin and the fourth pin of the optocoupler are not conducting; the input signal end outputs a high level; the high level is used to allow the output of the output circuit, and the invalid level is a level lower than the level of the external second power supply.
[0039] In some embodiments, when the circuit is in input mode, and the level input at the output signal end does not meet the effective level requirement, since the output signal end inputs an invalid level, this level cannot meet the conduction condition of the optocoupler, and the light-emitting diode inside the optocoupler will not emit light due to insufficient current passing through, so the first pin and the second pin of the optocoupler will not be turned on. Based on the working principle of the optocoupler, the phototransistor inside it will not be turned on, that is, the third pin and the fourth pin of the optocoupler will not be turned on. In this way, the input signal end will output a high level, and this high level signal is designed to allow the output of the output circuit, but there is no output signal at this time.
[0040] It can be seen that in the input mode, the instruction is transmitted to the external control end, so that the switch chip pin is turned on to change the internal control end level. When there is a valid level input at the output signal end, the corresponding pin of the optocoupler circuit is turned on, so that the input signal end outputs a low level to prohibit the output circuit from outputting; the opposite is true when there is no valid level. Under the control of level logic, each component avoids the interference of output data under different input modes, improves the adaptability and response speed of the digital module to different working scenarios, and improves work efficiency.
[0041] S104: If the corresponding IO point is in output mode, determine that the input data of the corresponding IO point is invalid.
[0042] In some embodiments, when it is determined that the corresponding IO point is in output mode, the digital quantity module will process the input data that may be received. First, after the input data enters the receiving circuit of the digital quantity module, it will be intercepted by a data screening unit. The unit will judge the input data based on the output mode status information of the current IO point. If it is in output mode, the data screening unit will directly discard the input data without any storage or subsequent processing operations. Alternatively, the digital quantity module can cut off the power supply of the input data receiving circuit through internal control logic, so that the input data cannot be received and processed normally, thereby determining that the input data of the corresponding IO point is invalid, ensuring that the output function is not interfered with by the input data.
[0043] In some specific embodiments, with reference to the structure and principle of the above-mentioned input switch circuit and optocoupler circuit, an output switch circuit and an optocoupler circuit are designed for use in output mode. The output switch circuit uses a switch chip with the same functional logic as the input switch circuit, and its first pin is connected to an external first power supply optimized for output mode, which can provide a stable voltage that meets the output drive requirements, and a current limiting resistor with a specific resistance value is used to ensure that the switch chip works stably and prevents overcurrent. The second pin is connected to the external control terminal, which receives instructions in the output mode. The third pin is connected to the external second power supply, which provides a reference level for the output circuit, and the fourth pin is connected to the internal control terminal, which is connected to the first pin of the optocoupler of the optocoupler circuit. The first pin of the optocoupler circuit is connected to the internal control terminal, and a protection diode is provided on the connection line to prevent reverse voltage shock and a current limiting resistor to control the current size. The second pin is connected to the input signal terminal. The third pin is grounded, and the fourth pin is connected to the output signal terminal through a pull-up resistor. The pull-up resistor ensures that a stable high level state is maintained when there is no input signal, and a filter capacitor can be added as needed to filter out interference clutter that may exist at the input signal terminal, and ensure the purity of the input signal so as to accurately judge its effectiveness.
[0044] In some specific embodiments, the characteristics of the above-mentioned input switch circuit and the optocoupler circuit in the output mode are used to realize the invalid input data. When in the output mode, due to the lack of instruction transmission, the third pin and the fourth pin of the switch chip are not turned on, resulting in the inconsistency between the levels of the internal control terminal and the external second power supply, presenting a low level state. When the internal control terminal is at a low level, regardless of whether the output signal terminal inputs a valid level or an invalid level, the first pin and the second pin of the optocoupler are not turned on. According to the circuit logic, a signal 1 will be fed back at this time. Then, a signal conversion unit (such as a simple conversion circuit based on a NOT gate circuit) integrated in the digital quantity module is used to flip the signal 1 to obtain a signal 0. The system uses signal 0 as the basis for determining that the input data is invalid, thereby shielding the input data so that it cannot cause any interference to the output operation of the system in the output mode.
[0045] It can be seen that the circuit of the digital quantity module that can configure the input and output mode connects the IO point with the input circuit and the output circuit, and switches the input and output mode of the IO point according to the host computer instruction, so that a digital quantity module can be used for input and output at the same time. It avoids the situation where two modules need to be installed when the pure input and pure output modules need to perform digital input and output operations at the same time, thereby reducing the hardware procurement cost. In addition, the space occupied by only one module in the electrical cabinet is greatly reduced, which simplifies the wiring in the electrical cabinet and reduces the wiring cost and difficulty.
[0046] See also Figure 3 , Figure 3is a circuit diagram of an optocoupler circuit in an embodiment of the present application; In some embodiments, the optocoupler circuit further includes: Diode D1, resistor R2, resistor R3, resistor R4; The first pin of the optocoupler is connected to the internal control terminal specifically including: the anode of the diode D1 is connected to the internal control terminal, and the cathode is connected to one end of the resistor R2; the other end of the resistor R2, one end of the resistor R3, and the internal control terminal are connected together; The other end of the resistor R3 is connected to the output signal end; The fourth pin of the optocoupler is connected to the input signal terminal through the resistor R4.
[0047] The connection method of diode D1 and optocoupler forms an effective protection mechanism. When the input signal end reversely impacts the internal control end, diode D1 can prevent the reverse current from flowing into the internal control end circuit with its unidirectional conductivity, and avoid the electronic components of the internal control end from being damaged by the reverse current, thereby ensuring the stable operation of the entire internal control logic. Resistor R2 is the current limiting resistor of the first pin of the optocoupler. Its function is to control the current flowing into the optocoupler to prevent the light-emitting diode inside the optocoupler from burning out or the performance of the optocoupler from being degraded due to excessive current. Resistor R3 is the current limiting resistor of the output signal end, and works in conjunction with R2. The current of the internal control end is limited to the output signal end, and resistor R4 is used as a pull-up resistor to pull the input signal end up to signal 1. When the optocoupler circuit works according to the level change of the output signal end, this pull-up resistor can ensure that the input signal end remains in a high level state under certain circumstances.
[0048] It can be seen that diode D1 can prevent the current from flowing in the reverse direction and protect the internal control circuit. Resistor R2 is used as the current limiting resistor of the first pin of the optocoupler to effectively limit the current flowing into the optocoupler and prevent excessive current from damaging the optocoupler. Resistor R3 is used as the current limiting resistor of the output signal end and works together with R2 to prevent the output signal end from abnormal due to excessive current. Resistor R4 is used as a pull-up resistor to pull the input signal end up to signal 1, so that the optocoupler circuit can work more accurately according to the changes in the input and output signals, thereby improving the accuracy and stability of the circuit.
[0049] See also Figure 2 , Figure 2 is a circuit diagram of an input switch circuit in an embodiment of the present application; In some embodiments, the input switch circuit further includes: a resistor R1; The first pin of the switch chip is connected to an external first power source through a resistor R1.
[0050] Resistor R1 can effectively limit the inrush current flowing into the switch chip, preventing the circuit elements (such as transistors, integrated circuits, etc.) inside the switch chip from being broken down or damaged due to the instantaneous large current, and ensuring that the switch chip can stably enter the working state during the circuit startup phase.
[0051] It can be seen that the resistor R1 connects the first pin of the switch chip and the external first power supply in the input switch circuit. It can limit the current flowing into the switch chip, prevent excessive current from damaging the switch chip, and ensure stable operation of the switch chip.
[0052] See also Figure 3 , Figure 3 is a circuit diagram of an optocoupler circuit in an embodiment of the present application; In some embodiments, the optocoupler circuit further includes: a capacitor C1; The fourth pin of the optocoupler is connected to the input signal terminal through the capacitor C1.
[0053] In the optocoupler circuit, when the input signal enters the optocoupler circuit, capacitor C1 uses its own capacitance characteristics to form a low impedance path for these high-frequency clutter and interference components, bypassing them to the ground, thereby filtering out the interference components in the input signal. It can be seen that capacitor C1 is connected to the fourth pin of the optocoupler and the input signal end. It can filter the input signal, filter out the high-frequency clutter and interference components in the signal, and make the input signal purer and more stable.
[0054] See also Figure 4 , Figure 4 This is a circuit diagram of an IO point in an embodiment of the present application; In the figure, DO is output, DI is output, and DO / I is a pin that can be used to connect to output or output; you can see that an IO point has at least 2 DO / I pins, one of which is connected to input and the other needs to be connected to output.
[0055] In some embodiments, a first pin of the IO point is connected to an input circuit, and a second pin of the IO point is connected to an output circuit.
[0056] In the digital quantity module, connecting the input and output ends to the same IO point realizes the integration of input and output functions, which plays an important role in many aspects. From the perspective of hardware resource utilization, traditional designs often require multiple independent IO points to realize input and output functions, which not only increases the number of chip pins, but also requires more wiring space on the circuit board to connect these IO points and the corresponding input and output circuit components. The use of a single IO point fusion design greatly reduces the demand for chip pin resources, reduces the wiring complexity of the circuit board, and makes the design of the circuit board more compact and simple, which is conducive to reducing the size of the entire device and improving the integration of the device.
[0057] It can be seen that connecting the input end and the DO output end to the same IO point realizes the integration of input and output functions at the level of a single IO point, avoiding the waste of resources and space occupation caused by the need for multiple independent IO points to handle input and output separately in related designs.
[0058] The following introduces an exemplary digital quantity module configurable input and output mode system 500 provided in an embodiment of the present application. Figure 5 It is a schematic diagram of an exemplary hardware structure of a digital quantity module configurable input and output mode system 500 provided in an embodiment of the present application.
[0059] In some embodiments, the digital quantity module configurable input and output mode system 500 is a computer device or the digital quantity module configurable input and output mode system 500 includes a computer device. The computer device includes a processor, a memory and a network interface connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with other external terminals or servers through a network connection. In some embodiments, the network interface can be a wired network interface, and in some embodiments, the network interface can also be a wireless network interface. When the computer program is executed by the processor, the method in the embodiment of the present application is implemented.
[0060] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0061] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0062] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0063] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0064] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. A method for configuring input and output modes of a digital quantity module, characterized in that: The method is applied to a circuit in which a digital quantity module can configure an input-output mode, wherein the IO points of the circuit in which the digital quantity module can configure an input-output mode are respectively connected to an input circuit and an output circuit, and the method comprises: When receiving the command from the host computer, the corresponding IO point is changed to input mode or output mode; When receiving data from the host computer, determine whether the corresponding IO point is in input mode or output mode; If the corresponding IO point is in input mode, the output circuit of the corresponding IO point is controlled so that the output circuit cannot output data; If the corresponding IO point is in output mode, it is determined that the input data of the corresponding IO point is invalid.
2. The method according to claim 1, characterized in that The circuits of the digital module that can configure the input and output modes include: Input switch circuit and optocoupler circuit; The input switch circuit comprises a switch chip, a first pin of the switch chip is connected to an external first power supply providing a working voltage for the switch chip, a second pin of the switch chip is connected to an external control terminal, a third pin of the switch chip is connected to an external second power supply, and a fourth pin of the switch chip is connected to an internal control terminal; The optocoupler circuit includes an optocoupler, a first pin of the optocoupler is connected to the internal control end, a second pin of the optocoupler is connected to the output signal end, a third pin of the optocoupler is connected to the ground, and a fourth pin of the optocoupler is connected to the input signal end.
3. The method according to claim 2, characterized in that If the corresponding IO point is in input mode, the step of controlling the output circuit of the corresponding IO point so that the output circuit cannot output data specifically includes: By transmitting an instruction to the external control terminal, the third pin of the switch chip and the fourth pin of the switch chip are turned on, so that the level of the internal control terminal is consistent with that of the external second power supply; When a valid level is input to the output signal terminal, the first pin of the optocoupler and the second pin of the optocoupler are turned on, so that the third pin of the optocoupler and the fourth pin of the optocoupler are turned on; the input signal terminal outputs a low level, and the low level is used to disable the output of the output circuit, and the valid level is a level lower than the level of the external second power supply; When an invalid level is input to the output signal terminal, the first pin of the optocoupler and the second pin of the optocoupler are not conducting, so that the third pin of the optocoupler and the fourth pin of the optocoupler are not conducting; the input signal terminal outputs a high level; the high level is used to allow the output of the output circuit, and the invalid level is a level lower than the level of the external second power supply.
4. The method according to claim 2, characterized in that: The optocoupler circuit further includes: Diode D1, resistor R2, resistor R3, resistor R4; The first pin of the optocoupler is connected to the internal control terminal specifically including: the anode of the diode D1 is connected to the internal control terminal, and the cathode is connected to one end of the resistor R2; the other end of the resistor R2, one end of the resistor R3, and the internal control terminal are connected together; The other end of the resistor R3 is connected to the output signal end; The fourth pin of the optical coupler is connected to the input signal terminal through the resistor R4.
5. The method according to claim 2, characterized in that: The input switch circuit further includes: a resistor R1; The first pin of the switch chip is connected to an external first power source through the resistor R1.
6. The method according to claim 2, characterized in that The optical coupler circuit further includes: a capacitor C1; The fourth pin of the optical coupler is connected to the input signal terminal through the capacitor C1.
7. The method according to claim 1, characterized in that The first pin of the IO point is connected to the input circuit, and the second pin of the IO point is connected to the output circuit.
8. A digital quantity module configurable input and output mode system, characterized in that: The digital quantity module configurable input-output mode system includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the digital quantity module configurable input-output mode system to execute the method described in any one of claims 1-7.
9. A computer program product comprising instructions, characterized in that When the computer program product runs on a digital quantity module configurable input and output mode system, the digital quantity module configurable input and output mode system is enabled to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on a digital module configurable input-output mode system, the digital module configurable input-output mode system is enabled to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
GPIO (General Purpose Input / Output) circuit capable of configuring high-low effective level and switching input and output
CN118760638A
RS485 communication circuit, circuit board and industrial control equipment
CN220823090U
Digital quantity configurable input and output module and industrial control equipment
CN221200269U
Integrated circuit with programmable input / output module
US20210365325A1
Cited By
Self-adaptive IO channel control circuit, IO module and control method
CN121523196A