A method, system, program product, and storage medium for configuring the input / output mode of a digital quantity module
The circuit of the input and output mode can be configured through the digital module, and the input switching circuit and the optocoupling circuit work together can realize the input and output of a module simultaneously, solving the problems of hardware cost and wiring complexity in the prior art, and improving work efficiency and stability.
Patent Information
- Application Number
- CN202510062743.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-07-04
- 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 to increase hardware procurement costs and wiring complexity in the electrical cabinet.
The input and output mode circuit can be configured through the digital module, and the input switching circuit and the optocoupler circuit can be used to switch the input and output mode of the IO point according to the command of the upper computer, so that a module can be used for input and output at the same time.
It reduces hardware procurement costs, simplifies wiring in electrical cabinets, improves the accuracy and stability of input and output mode switching, and enhances the adaptability and response speed of digital modules.
Smart Images

Figure CN119511916B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of control or regulation systems, and particularly to a method, system, program product, and storage medium for configurable input / output modes of digital quantity modules. Background Art
[0002] In the field of industrial automation control, digital quantity modules play a key role and are important components for realizing signal interaction and control between devices.
[0003] Currently, common digital quantity modules on the market are divided into pure input and pure output types. However, in some scenarios, when digital input and output operations need to be performed simultaneously, two modules must be installed. This not only increases the hardware procurement cost, but also the two modules occupy a large amount of space in the electrical cabinet, which may lead to more complex wiring in the electrical cabinet, increasing the wiring cost and difficulty. Summary of the Invention
[0004] This application provides a method, system, program product, and storage medium for configurable input / output modes of digital quantity modules, which can be used for a digital quantity module to be used for both input and output simultaneously, reducing costs and occupied space.
[0005] In a first aspect, this application provides a method for configurable input / output modes of digital quantity modules, which is applied to a circuit with configurable input / output modes of digital quantity modules. The IO points of the circuit with configurable input / output modes of digital quantity modules are respectively connected to an input circuit and an output circuit. The method includes: 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, determining whether the corresponding IO point is in an input mode or an output mode; if the corresponding IO point is in an input mode, controlling the output circuit of the corresponding IO point to make the output circuit unable to output data; if the corresponding IO point is in an output mode, determining that the input data of the corresponding IO point is invalid.
[0006] By adopting the above technical solution, the circuit with configurable input / output modes of digital quantity modules connects the IO points to the input circuit and the output circuit, and switches the input / output mode of the IO points according to the host computer instruction, realizing that a digital quantity module can be used for both input and output simultaneously. It avoids the situation where two modules need to be installed when digital input and output operations need to be performed simultaneously for pure input and pure output modules, thus reducing the hardware procurement cost. Moreover, only one module occupies much less space in the electrical cabinet, simplifying the wiring in the electrical cabinet and reducing the wiring cost and difficulty.
[0007] In some embodiments in combination with some embodiments of the first aspect, the circuit of the digital quantity module configurable for input / 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 a working voltage for the switch chip, the second pin of the switch chip is connected to an external control terminal, the third pin of the switch chip is connected to an external second power supply, and the fourth pin of the switch chip is connected to an internal control terminal; the optocoupler circuit includes an optocoupler, the first pin of the optocoupler is connected to the internal control terminal, the second pin of the optocoupler is connected to an output signal terminal, the third pin of the optocoupler is connected to ground, and the fourth pin of the optocoupler is connected to an input signal terminal.
[0008] By adopting the above technical solution, the input switch circuit and the optocoupler circuit work together. Under the instruction of the external control terminal, the switch chip changes the level of the internal control terminal through the connection relationship of the pins, thereby affecting the optocoupler circuit. The optocoupler circuit controls the level of the input signal terminal according to the change of the level of the output signal terminal, realizing the effective control of the output circuit. This circuit structure enables the output circuit to be controlled to stop output in the input mode, and can correctly determine that the input data is invalid in the output mode, improving the accuracy and efficiency of the input / output mode switching, and ensuring the stability and reliability of the entire digital quantity module in different modes.
[0009] In some embodiments in combination with some embodiments of the first aspect, if the corresponding IO point is in the input mode, the steps of controlling the output circuit corresponding to the IO point so that the output circuit cannot output data specifically include: by transmitting an instruction to the external control terminal, the third pin and the fourth pin of the switch chip are conducted, so that the level of the internal control terminal is consistent with the level of the external second power supply; when a valid level is input at the output signal terminal, the first pin and the second pin of the optocoupler are conducted, so that the third pin and the fourth pin of the optocoupler are conducted; a low level is output at the input signal terminal, 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 at the output signal terminal, the first pin and the second pin of the optocoupler are not conducted, so that the third pin and the fourth pin of the optocoupler are not conducted; a high level is output at the input signal terminal; 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, an instruction is transmitted to the external control terminal to conduct the pins of the switch chip to change the level of the internal control terminal. When a valid level is input at the output signal terminal, the corresponding pins of the optocoupler circuit are conducted, so that a low level is output at the input signal terminal to prohibit the output circuit from outputting; otherwise when there is no valid level. Under the control of the level logic, each component avoids the interference of output data in different situations in the input mode, improves the adaptability and response speed of the digital quantity module to different working scenarios, and enhances the working efficiency.
[0011] In some embodiments in combination with some embodiments of the first aspect, the optocoupler circuit further includes: diode D1, resistor R2, resistor R3, resistor R4; the connection of the first pin of the optocoupler to the internal control terminal specifically includes: the positive pole of diode D1 is connected to the internal control terminal, and the negative pole is connected to one end of resistor R2; the other end of resistor R2, one end of resistor R3, and the internal control terminal are commonly connected; the other end of resistor R3 is connected to the output signal terminal; the fourth pin of the optocoupler is connected to the input signal terminal through resistor R4.
[0012] By adopting the above technical solution, diode D1 can prevent reverse current flow and protect the internal control terminal circuit. Resistor R2, as the current-limiting resistor of the first pin of the optocoupler, effectively limits the magnitude of the current flowing into the optocoupler and prevents damage to the optocoupler caused by excessive current. Resistor R3, as the current-limiting resistor of the output signal terminal, acts together with R2 to avoid abnormalities at the output signal terminal due to excessive current. Resistor R4, as a pull-up resistor, pulls up the input signal terminal to signal 1, enabling the optocoupler circuit to work more precisely according to the changes in input and output signals, thereby improving the accuracy and stability of the circuit.
[0013] In some embodiments in combination with some embodiments of the first aspect, the input switch circuit further includes: resistor R1; the first pin of the switch chip is connected to the external first power supply through resistor R1.
[0014] By adopting the above technical solution, resistor R1 is connected between the first pin of the switch chip and the external first power supply in the input switch circuit. It can limit the magnitude of the current flowing into the switch chip, prevent damage to the switch chip caused by excessive current, and ensure the stable operation of the switch chip.
[0015] In some embodiments in combination with some embodiments of the first aspect, the optocoupler circuit further includes: capacitor C1; the fourth pin of the optocoupler is connected to the input signal terminal through capacitor C1.
[0016] By adopting the above technical solution, capacitor C1 is connected between the fourth pin of the optocoupler and the input signal terminal. It can filter the input signal, filter out high-frequency clutter and interference components in the signal, and make the input signal more pure and stable.
[0017] In some embodiments in combination with some embodiments of the first aspect, 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.
[0018] By adopting the above technical solution, the input terminal and the DO output terminal are connected to the same IO point, realizing the integration of input and output functions at the single IO point level. It avoids the resource waste and space occupation caused by the need for multiple independent IO points to separately process input and output in related designs.
[0019] Second aspect, the present application provides a digital quantity module configurable input / output mode system, and 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, and 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 the first aspect and any possible implementation manner in the first aspect.
[0020] Third aspect, the present application provides a computer program product containing instructions, when the computer program product runs on the digital quantity module configurable input / output mode system, enabling the digital quantity module configurable input / output mode system to execute the method described in the first aspect and any possible implementation manner in the first aspect.
[0021] Fourth aspect, the present application provides a computer-readable storage medium, including instructions, when the instructions run on the digital quantity module configurable input / output mode system, enabling the digital quantity module configurable input / output mode system to execute the method described in the first aspect and any possible implementation manner in 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:
[0023] 1. The circuit of the digital quantity module with configurable input / output mode realizes that a digital quantity module can be used for both input and output by connecting the IO points to the input circuit and the output circuit and switching the input / output mode of the IO points according to the host computer instructions. It avoids the situation where two modules need to be installed when pure input and pure output modules are required to perform digital input and output operations simultaneously, thus reducing the hardware procurement cost. Moreover, the space occupied by only one module in the electrical cabinet is greatly reduced, simplifying the wiring in the electrical cabinet and reducing the wiring cost and difficulty.
[0024] 2. The input switch circuit and the optocoupler circuit work together. Under the instruction 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 to effectively control the output circuit. This circuit structure enables the output circuit to be controlled to stop output in the input mode and correctly determines that the input data is invalid in the output mode, improving the accuracy and efficiency of the input / output mode switching and ensuring the stability and reliability of the entire digital quantity module in different modes.
[0025] 3. In the input mode, an instruction is transmitted to the external control terminal to turn on the pins of the switch chip and change the level of the internal control terminal. When there is a valid level input at the output signal terminal, the corresponding pins of the optocoupler circuit are turned on, causing the input signal terminal to output 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 interference in the output data under different situations in the input mode, improves the adaptability and response speed of the digital quantity module to different working scenarios, and enhances the working efficiency. Description of the Drawings
[0026] Figure 1 is a schematic flowchart of a method for a digitally configurable input / output mode of a digital quantity module according to an embodiment of the present application;
[0027] Figure 2 is a schematic circuit diagram of an input switch circuit according to an embodiment of the present application;
[0028] Figure 3 is a schematic circuit diagram of an optocoupler circuit according to an embodiment of the present application;
[0029] Figure 4 is a schematic circuit diagram of an IO point according to an embodiment of the present application;
[0030] Figure 5 is a schematic diagram of an exemplary hardware structure of a digitally configurable input / output mode system of a digital quantity module according to an embodiment of the present application. Detailed Embodiments
[0031] 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 limit the present application. As used in the specification and appended claims of the present application, the singular forms "a", "an", "the", "above", "said", "this" are intended to include the plural forms as well, unless the context clearly dictates otherwise. 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 of the listed items.
[0032] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality" is two or more.
[0033] A method for a digitally configurable input / output mode of a digital quantity module is applied to a circuit with a digitally configurable input / output mode of a digital quantity module. The IO points of the circuit with a digitally configurable input / output mode of a digital quantity module are respectively connected to an input circuit and an output circuit;
[0034] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of the method for configurable input / output mode of the digital quantity module in the embodiments of the present application;
[0035] S101: When receiving an instruction from the host computer, change the corresponding IO point to the input mode or the output mode;
[0036] Among them, the circuit of the configurable input / output mode of the digital quantity module represents a circuit architecture that can flexibly adjust the input / output function according to actual needs. It refers to a circuit system that can change the working mode of each IO point in the circuit by means of specific control means in the context of digital quantity signal processing. The IO point refers to the connection end point for data input or output in this circuit. The host computer refers to a computer device in the entire control system that can issue instructions to the digital quantity module and transmit data to achieve centralized management and control.
[0037] In some embodiments, after the host computer successfully establishes a communication link with the digital quantity module, the host computer generates an instruction according to the system operation requirements and transmits it. 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 to the input mode or the output mode.
[0038] In some specific embodiments, when the mode needs to be switched, directly obtain the mode information of the corresponding IO point from the table according to the current task, generate an instruction and send it to the digital quantity module. After receiving the instruction, the digital quantity module reads the local mode switching program code through the microcontroller and controls the mode switching circuit of the IO point according to the code logic to achieve mode switching, which is not limited here.
[0039] S102: When receiving data from the host computer, determine whether the corresponding IO point is in the input mode or the output mode;
[0040] In some embodiments, when the digital quantity module receives the data transmitted from the host computer, it will immediately start the mode judgment process. This unit will compare the extracted information with the mode configuration information stored locally according to the 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 matching item in the local mode identification list to determine whether the corresponding IO point is in the input mode or the output mode. This judgment method can quickly and accurately determine the working state of the IO point for subsequent corresponding processing operations.
[0041] S103: If the corresponding IO point is in the input mode, control the output circuit of the corresponding IO point to make the output circuit unable to output data;
[0042] In some embodiments, when it is determined that the corresponding IO point is in the input mode, the control logic inside the digital quantity module is 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-type transistor, the increase in the base voltage will turn on the transistor, and at this time, the key signal path in the output circuit will be short-circuited. For example, the output signal is connected to the ground potential, so that the output circuit cannot output a normal signal level, thus achieving the purpose of not being able to output data. Alternatively, the control signal can also act on the driver chip in the output circuit, causing the driver chip to enter the sleep or disabled state, stop processing and amplifying the output signal, and thus prevent data output.
[0043] Please refer to Figure 2 and Figure 3 , Figure 2 which is a schematic circuit diagram of the input switch circuit in the embodiments of the present application; Figure 3 which is a schematic circuit diagram of the optocoupler circuit in the embodiments of the present application;
[0044] In some specific embodiments, the circuit of the digital quantity module that can be configured with input and output modes includes:
[0045] an input switch circuit and an optocoupler circuit;
[0046] The input switch circuit includes a switch chip. The first pin of the switch chip is connected to the external first power supply that provides the working voltage for the switch chip. The second pin of the switch chip is connected to the external control terminal. The third pin of the switch chip is connected to the external second power supply. The fourth pin of the switch chip is connected to the internal control terminal;
[0047] The optocoupler circuit includes an optocoupler. The first pin of the optocoupler is connected to the internal control terminal. The second pin of the optocoupler is connected to the output signal terminal. The third pin of the optocoupler is connected to the ground. The fourth pin of the optocoupler is connected to the input signal terminal.
[0048] It can be seen that the input switch circuit and the optocoupler circuit work together. Under the instruction of the external control terminal, the switch chip changes the level of the internal control terminal through the connection relationship of the pins, thereby affecting the optocoupler circuit. The optocoupler circuit controls the level of the input signal terminal according to the change of the level of the output signal terminal, so as to realize the effective control of the output circuit. This circuit structure enables the output circuit to be controlled to stop output in the input mode, and can correctly determine that the input data is invalid in the output mode, improving the accuracy and efficiency of the input and output mode switching, and ensuring the stability and reliability of the entire digital quantity module in different modes.
[0049] Please refer to Figure 2 and Figure 3 , Figure 2It is a circuit schematic diagram of the input switch circuit in the embodiment of the present application; Figure 3 It is a circuit schematic diagram of the optocoupler circuit in the embodiment of the present application;
[0050] In some specific embodiments, by transmitting an instruction to the external control terminal, the third pin and the fourth pin of the switch chip are turned on, so that the internal control terminal is at the same level as the external second power supply;
[0051] In some embodiments, when it is necessary to switch the IO point corresponding to a certain sensor to the input mode and ensure that the output circuit stops outputting, this step will be executed. Generally speaking, in this process, the external control terminal receives an instruction signal from the outside (this signal can be a level signal sent by the host computer according to a preset program or manual operation, etc.), and then transmits this instruction signal to the switch chip. After receiving this signal, the internal logic circuit of the switch chip will respond, causing a conduction state to be 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 pins, so that the level of the internal control terminal is the same as the level of the external second power supply.
[0052] When a valid level is input at the output signal terminal, the first pin and the second pin of the optocoupler are turned on, so that the third pin 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 prohibit the output of the output circuit, and the valid level is a level lower than the level of the external second power supply;
[0053] Among them, the valid level refers to a level signal with a specific voltage range in this circuit environment and capable of triggering corresponding components (such as optocouplers, etc.) in the circuit to generate expected actions such as conduction. It refers to the level value that meets the pre-set logic level requirements of the circuit and can make the circuit operate according to the established functions. Here, it is set as a level lower than the level of the external second power supply.
[0054] In some embodiments, when a valid level signal that meets the requirements is input at the output signal terminal, 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, causing conduction between the first pin and the second pin of the optocoupler. Based on the working principle of the optocoupler, the photosensitive triode inside it will conduct due to receiving the optical signal, and then the third pin and the fourth pin of the optocoupler will also conduct. In this way, the input signal terminal will output a low level, and this low level signal is designed to prohibit the output of the output circuit, so as to ensure that the output circuit does not output signals externally in the input mode and avoid interfering with the acquisition of input signals.
[0055] When an invalid level is input at the output signal terminal, the first pin and the second pin of the optocoupler are not conducting, causing the third pin and the fourth pin of the optocoupler not to conduct; the input signal terminal outputs a high level; the high level is used to enable the output of the output circuit, and the invalid level is a level lower than the level of the external second power supply.
[0056] In some embodiments, when the circuit is in the input mode and the level input at the output signal terminal does not meet the requirement of the valid level, since the input at the output signal terminal is an invalid level, this level cannot satisfy the conduction condition of the optocoupler, and the light-emitting diode inside the optocoupler will not emit light because there is not enough current passing through it. Therefore, the first pin and the second pin of the optocoupler will not conduct. Based on the working principle of the optocoupler, the photosensitive triode inside it will not conduct either, that is, the third pin and the fourth pin of the optocoupler will not conduct. In this way, the input signal terminal will output a high level, and this high-level signal is designed to enable the output of the output circuit, but there is no output signal at this time.
[0057] It can be seen that in the input mode, an instruction is transmitted to the external control terminal to make the pin of the switch chip conduct and change the level of the internal control terminal. When a valid level is input at the output signal terminal, the corresponding pins of the optocoupler circuit conduct, causing the input signal terminal to output a low level to prohibit the output circuit from outputting; when there is no valid level, the opposite is true. Under the level logic control of each component, interference in output data in different situations of the input mode is avoided, the adaptability and response speed of the digital quantity module to different working scenarios are improved, and the working efficiency is enhanced.
[0058] S104. If the corresponding IO point is in the output mode, determine that the input data of the corresponding IO point is invalid.
[0059] In some embodiments, when it is determined that the corresponding IO point is in the output mode, the digital quantity module processes 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. This unit judges the input data according to the output mode status information of the current IO point. If it is in the output mode, the data screening unit directly discards the input data without any storage or subsequent processing operations. Or, the digital quantity module can cut off the power supply of the input data receiving circuit through the internal control logic, so that the input data cannot be normally received and processed, thereby determining that the input data of the corresponding IO point is invalid and ensuring that the output function is not interfered by the input data.
[0060] In some specific embodiments, referring to the structures and principles of the above input switch circuit and optocoupler circuit, an output switch circuit and an optocoupler circuit for the output mode are designed. The output switch circuit uses a switch chip with the same functional logic as the input switch circuit. Its first pin is connected to an external first power supply optimized for the output mode, which can provide a stable voltage that meets the output drive requirements. A current-limiting resistor with a specific resistance value is used to ensure the stable operation of the switch chip and prevent overcurrent. The second pin is connected to an external control terminal, and the instruction received by this control terminal in the output mode. The third pin is connected to an external second power supply, which provides a reference level for the output circuit. The fourth pin is connected to an internal control terminal, and the internal control terminal is connected to the first pin of the optocoupler circuit 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 impact and a current-limiting resistor is used to control the current magnitude. 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 a stable high-level state when there is no input signal, and a filter capacitor can be added as needed to filter out the interference clutter that may exist at the input signal terminal, ensuring the purity of the input signal for accurate judgment of its validity.
[0061] In some specific embodiments, the characteristics of the above input switch circuit and optocoupler circuit in the output mode are used to make the input data invalid. When in the output mode, since there is no instruction transmission, the third and fourth pins of the switch chip are not conducting, resulting in the inconsistent levels between 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 a valid level or an invalid level is input at the output signal terminal, the first and second pins of the optocoupler do not conduct. According to the circuit logic, a signal 1 will be fed back at this time. Then, a signal conversion unit integrated in the digital quantity module (such as a simple conversion circuit built based on a NOT gate circuit) performs a flipping operation on this signal 1 to obtain a signal 0. The system uses the 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.
[0062] It can be seen that the circuit of the digital quantity module with configurable input and output modes realizes that a digital quantity module can be used for both input and output by connecting the IO points to the input circuit and the output circuit and switching the input and output modes of the IO points according to the instructions from the host computer. It avoids the situation where two modules need to be installed when pure input and pure output modules are required to perform digital input and output operations simultaneously, thus reducing the hardware procurement cost. Moreover, the space occupied by only one module in the electrical cabinet is greatly reduced, simplifying the wiring in the electrical cabinet and reducing the wiring cost and difficulty.
[0063] Please refer to Figure 3 , Figure 3It is a circuit schematic diagram of the optocoupler circuit in the embodiment of the present application;
[0064] In some embodiments, the optocoupler circuit further includes:
[0065] Diode D1, resistor R2, resistor R3, resistor R4;
[0066] The connection of the first pin of the optocoupler to the internal control terminal specifically includes: the positive electrode of diode D1 is connected to the internal control terminal, and the negative electrode is connected to one end of resistor R2; the other end of resistor R2, one end of resistor R3, and the internal control terminal are commonly connected;
[0067] The other end of resistor R3 is connected to the output signal terminal;
[0068] The fourth pin of the optocoupler is connected to the input signal terminal through resistor R4.
[0069] The connection mode of diode D1 and the optocoupler forms an effective protection mechanism. When the input signal terminal impacts the internal control terminal reversely, due to the unidirectional conductivity of diode D1, it can prevent the reverse current from flowing into the internal control terminal circuit, avoiding the damage of the electronic components at the internal control terminal caused by the reverse current, thus ensuring the stable operation of the entire internal control logic. Resistor R2, as the current-limiting resistor of the first pin of the optocoupler, is used to control the magnitude of the current flowing into the optocoupler, preventing the light-emitting diode inside the optocoupler from burning out or the performance of the optocoupler from degrading due to excessive current. Resistor R3, as the current-limiting resistor of the output signal terminal, acts in cooperation with R2 to limit the current from the internal control terminal to the output signal terminal. Resistor R4, as a pull-up resistor, pulls up the input signal terminal to signal 1. When the optocoupler circuit works according to the level change of the output signal terminal, this pull-up resistor can ensure that the input signal terminal remains at a high level state under specific circumstances.
[0070] It can be seen that diode D1 can prevent the reverse flow of current and protect the internal control terminal circuit. Resistor R2, as the current-limiting resistor of the first pin of the optocoupler, effectively limits the magnitude of the current flowing into the optocoupler, preventing damage to the optocoupler caused by excessive current. Resistor R3, as the current-limiting resistor of the output signal terminal, acts together with R2 to avoid abnormalities at the output signal terminal due to excessive current. Resistor R4, as a pull-up resistor, pulls up the input signal terminal to signal 1, enabling the optocoupler circuit to work more precisely according to the changes in the input and output signals, thereby improving the accuracy and stability of the circuit.
[0071] Please refer to Figure 2 , Figure 2 It is a circuit schematic diagram of the input switch circuit in the embodiment of the present application;
[0072] In some embodiments, the input switch circuit further includes: resistor R1;
[0073] The first pin of the switch chip is connected to an external first power supply through a resistor R1.
[0074] The resistor R1 can effectively limit the inrush current flowing into the switch chip, preventing the circuit components (such as transistors, integrated circuits, etc.) inside the switch chip from being broken down or damaged due to instantaneous large current, and ensuring that the switch chip can stably enter the working state during the circuit startup phase.
[0075] It can be seen that the resistor R1 is connected between the first pin of the switch chip and the external first power supply in the input switch circuit. It can limit the magnitude of the current flowing into the switch chip, prevent excessive current from damaging the switch chip, and ensure the stable operation of the switch chip.
[0076] Please refer to Figure 3 , Figure 3 which is a circuit schematic diagram of the optocoupler circuit in an embodiment of the present application;
[0077] In some embodiments, the optocoupler circuit further includes: a capacitor C1;
[0078] The fourth pin of the optocoupler is connected to the input signal terminal through the capacitor C1.
[0079] In the optocoupler circuit, when an input signal enters the optocoupler circuit, the capacitor C1 uses its capacitance characteristic 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 the capacitor C1 is connected between the fourth pin of the optocoupler and the input signal terminal. It can filter the input signal, filter out the high-frequency clutter and interference components in the signal, and make the input signal more pure and stable.
[0080] Please refer to Figure 4 , Figure 4 which is a circuit schematic diagram of an IO point in an embodiment of the present application;
[0081] In the figure, DO is the output, DI is the output, and DO / I is the pin that can be used to connect the output or the input; it can be seen that an IO point has at least 2 DO / I pins, one of which is connected to the input and the other needs to be connected to the output.
[0082] In some embodiments, 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.
[0083] In the digital quantity module, connecting the input terminal and the output terminal to the same IO point realizes the integration of input and output functions, which has important functions in many aspects. From the perspective of hardware resource utilization, in traditional designs, if input and output functions are to be realized, multiple independent IO points are often required. This not only increases the number of pins on the chip, but also requires more wiring space on the circuit board to connect these IO points and the corresponding input circuit and output circuit components. By adopting the single-IO-point integration design, the demand for chip pin resources is greatly reduced, the wiring complexity of the circuit board is lowered, making the circuit board design more compact and concise, which is conducive to reducing the volume of the entire device and improving the integration of the device.
[0084] It can be seen that connecting the input terminal and the DO output terminal to the same IO point realizes the integration of input and output functions at the single-IO-point level. It avoids the resource waste and space occupation caused by the need for multiple independent IO points to separately process input and output in related designs.
[0085] The following introduces the exemplary digital quantity module configurable input / output mode system 500 provided by the embodiments of the present application. Figure 5 It is an exemplary hardware structure diagram of the digital quantity module configurable input / output mode system 500 provided by the embodiments of the present application.
[0086] In some embodiments, the digital quantity module configurable input / output mode system 500 is a computer device or the digital quantity module configurable input / output mode system 500 includes a computer device. The computer device includes a processor, a memory, and a network interface connected through 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. The computer program, when executed by the processor, realizes the method in the embodiments of the present application.
[0087] Those skilled in the art can understand that Figure 5 the structure shown in
[0088] 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 foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and 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 various embodiments of the present application.
[0089] As used in the above embodiments, depending on the context, the term "when..." can be interpreted to mean "if...", or "after...", or "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if detecting (the stated condition or event)" can be interpreted to mean "if determining...", or "in response to determining...", or "when detecting (the stated condition or event)", or "in response to detecting (the stated condition or event)".
[0090] 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 processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can 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 can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state drive), etc.
[0091] Those of ordinary skill in the art can understand all or part of the processes in the above embodiments of the method. This process can be completed by relevant hardware instructed by a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The foregoing storage medium includes: various media that can store program codes such as ROM or random access memory RAM, magnetic disks, or optical discs.
Claims
1. A method for configuring the input / output mode of a digital quantity module, characterized in that, A circuit applied to the configurable input / output mode of a digital quantity module, where the IO points of the circuit for the configurable input / output mode of the digital quantity module are respectively connected to an input circuit and an output circuit. The circuit for the configurable input / output mode of the digital quantity module 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 a working voltage for the switch chip. The second pin of the switch chip is connected to an external control terminal. The third pin of the switch chip is connected to an external second power supply. The fourth pin of the switch chip is connected to an internal control terminal; The optocoupler circuit includes an optocoupler. The first pin of the optocoupler is connected to the internal control terminal. The second pin of the optocoupler is connected to an output signal terminal. The third pin of the optocoupler is connected to ground. The fourth pin of the optocoupler is connected to an input signal terminal; The method includes: 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 a host computer, determining whether the corresponding IO point is in an input mode or an output mode; 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; If the corresponding IO point is in the input mode, controlling the output circuit of the corresponding IO point to make the output circuit unable to output data; where: by transmitting an instruction to the external control terminal, the third pin and the fourth pin of the switch chip are turned on, making the level of the internal control terminal consistent with the level of the external second power supply; When an effective level is input at the output signal terminal, the first pin and the second pin of the optocoupler are turned on, making the third pin and the fourth pin of the optocoupler turn on; a low level is output at the input signal terminal, and the low level is used to prohibit the output of the output circuit. The effective level is a level lower than the level of the external second power supply; When an invalid level is input at the output signal terminal, the first pin and the second pin of the optocoupler are not turned on, making the third pin and the fourth pin of the optocoupler not turn on; a high level is output at the input signal terminal; The high level is used to allow the output of the output circuit. The invalid level is a level lower than the level of the external second power supply; If the corresponding IO point is in the output mode, determining that the input data of the corresponding IO point is invalid.
2. The method according to claim 1, wherein The optocoupler circuit further includes: Diode D1, resistor R2, resistor R3, resistor R4; The connection of the first pin of the optocoupler to the internal control terminal specifically includes: the positive pole of the diode D1 is connected to the internal control terminal, and the negative pole 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 commonly connected; The other end of the resistor R3 is connected to the output signal terminal; The fourth pin of the optocoupler is connected to the input signal terminal through the resistor R4.
3. The method according to claim 1, characterized in that, The input switch circuit further includes: resistor R1; The first pin of the switch chip is connected to the external first power supply through the resistor R1.
4. The method according to claim 2, wherein The optocoupler circuit further includes: capacitor C1; The fourth pin of the optocoupler is connected to the input signal terminal through the capacitor C1.
5. A digital quantity module configurable input / 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 for storing computer program codes, the computer program codes include 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-4.
6. A computer program product comprising instructions, characterized in that, When the computer program product runs on the digital quantity module configurable input / output mode system, it enables the digital quantity module configurable input / output mode system to execute the method described in any one of claims 1-4.
7. A computer-readable storage medium, comprising instructions, characterized in that, When the instruction runs on the digital quantity module configurable input / output mode system, it enables the digital quantity module configurable input / output mode system to execute the method described in any one of claims 1-4.
Citation Information
Patent Citations
GPIO (General Purpose Input / Output) circuit capable of configuring high-low effective level and switching input and output
CN118760638A