A dual-terminal multiplexed software-switched communication interface control method and system
Patent Information
- Application Number
- CN202610892061.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-09-18
AI Technical Summary
[0004]针对上述的相关技术,现有双端子复用通信接口难以依靠软件实现互锁单路导通,大多需要依靠额外的硬件结构完成导通控制,无法灵活适配不同通信场景下的动态切换需求
1.解析互斥控制信号以软件方式管控两路通信支路通断,可按需工作在互锁单路导通、全通路连通、全通路断开三种工况,无需改动硬件即可适配RS232/RS485各类混合通信场景;
Smart Images

Figure CN122783104A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of serial communication interface control technology, and in particular to a software switching communication interface control method and system for dual-terminal multiplexing. Background Technology
[0002] RS232 and RS485 are two widely used serial communication interface standards in the field of industrial measurement and control. They have significant differences in electrical specifications and transmission distance. In equipment design, it is often necessary to have a single external terminal that is compatible with both communication protocols to achieve port multiplexing.
[0003] Reference Figure 1 In the existing communication interface architecture, the controller is electrically connected to the RS232 interface circuit and the RS485 interface circuit respectively. The RS232 interface circuit is connected to an independent RS232 external terminal, and the RS485 interface circuit is connected to an independent RS485 external terminal. The RS232 external terminal and the RS485 external terminal are equipped with manual switching components such as DIP switches and jumpers. The corresponding communication branch is selected by manually operating the switching components to complete the switching between RS232 mode and RS485 mode.
[0004] Regarding the aforementioned technologies, existing dual-terminal multiplexed communication interfaces cannot achieve interlocked single-channel conduction through software. Most of them require additional hardware structures to complete conduction control, which cannot flexibly adapt to the dynamic switching requirements of different communication scenarios. Summary of the Invention
[0005] To reduce reliance on additional hardware switching structures, this invention provides a software switching communication interface control method and system for dual-terminal multiplexing.
[0006] In a first aspect, the present invention provides a software switching communication interface control method for dual-terminal multiplexing, which adopts the following technical solution: A software-controlled communication interface switching method for dual-terminal multiplexing includes: Obtain the target port and the current mutex control signal corresponding to the target port; Analyze the current mutex control signal to determine the interlock status; If an interlocking state exists, determine the connected interface number and disconnected interface number based on the current mutual exclusion control signal; Perform path connection operations based on the connection interface number; Perform a path disconnection operation based on the disconnection interface number; If there is no interlocking state, determine the current port operating condition, which includes a fully disconnected operating condition and a fully connected operating condition; If the current port is in a fully connected state, perform a path connection operation; If the current port is in a fully disconnected state, perform a path disconnection operation.
[0007] By adopting the above technical solution, the mutual exclusion control signal is analyzed to determine the path switching logic, and the path conduction and disconnection control of the dual-terminal multiplexed interface is realized by software. This can adapt to the dynamic switching requirements of different communication scenarios and effectively improve the adaptability and flexibility of the dual-terminal multiplexed communication interface.
[0008] Optionally, it also includes a method for performing visualization operations, which includes: When an interlocking state exists, find the preset interlocking visualization scheme and perform visualization operations according to the interlocking visualization scheme based on the currently connected interface number and the currently disconnected interface number; When there is no interlocking state, the preset full connectivity visualization scheme and full disconnection visualization scheme are searched based on the current port operating conditions, and the visualization operation is executed.
[0009] By adopting the above technical solution, the real-time status of the interface can be understood by the staff through visual operation, which makes it easier to find problems in time when anomalies occur during switching and reduce the impact of interface failure on the equipment.
[0010] Optionally, specific methods for performing path connectivity operations include: Get the status of the inserted device corresponding to the connected interface number; When an inserted device is present, the connection interface number is defined as the detection interface number; Obtain the historical power supply information corresponding to the detection interface number; Historical power supply status is determined by historical power supply information; If there is a historical power-on state, all independent branch power supply branches and independent receiving signal paths corresponding to the control connection interface number are connected; If there is no historical power-on state, the output device will retain a reminder signal.
[0011] By adopting the above technical solution, the device access status is detected before the interface is connected, and the historical power supply information is verified. When it is detected that a device is connected to the interface even though the interface has never been powered, a reminder is output in time, which makes it easier for staff to check unauthorized devices in advance and reduce the security risks in the process of using the reused interface.
[0012] Optionally, a verification method for visual operations is also included, which includes: When an interlocking state exists, obtain the LED number corresponding to the connected interface number and define it as the current connected LED number; Get the connected lighting status corresponding to the currently connected LED number; If there is no connected luminous state, determine the number of the currently disconnected LED based on the number of the currently connected LED; Get the off-light status corresponding to the currently off LED number; If the light is off, perform an interlocked power supply operation based on the disconnected interface number and the connected interface number. If there is no disconnection of the light source, output a dual-power supply fault warning signal.
[0013] By adopting the above technical solution, the visual status is verified. When an abnormal situation occurs where the status light of the connected interface does not light up normally, while the status light of the disconnected interface lights up normally, the status indication can be restored by interlocking to assist power supply. If both status lights fail to light up normally, a fault reminder will be output in a timely manner, which will help staff to quickly locate the power supply fault and improve the efficiency of fault diagnosis.
[0014] Optionally, methods for performing interlocked assisted power supply operations include: The anti-backflow diode number is determined based on the disconnection interface number; Obtain the common terminal number corresponding to the anti-reverse flow diode number to determine the conduction direction; Interlocking assistance power supply operation is performed based on the conduction direction.
[0015] By adopting the above technical solution, the unidirectional conduction characteristic of the anti-backflow diode is utilized to guide the current from the connected branch to the status indicator circuit based on the determined conduction direction, ensuring that the connected LED can be powered and illuminated normally. The abnormal correction of the status indicator can be completed without the need to add an extra redundant power supply line, reducing the cost of hardware modification.
[0016] Optionally, specific methods for performing interlocked assisted power supply operations based on the conduction direction include: The current value of the currently disconnected branch is obtained in real time based on the disconnected interface number; Retrieve the current required current value corresponding to the connected interface number; The current deviation value is determined based on the current disconnected branch current value and the current demand current value. When the current deviation is positive, capacitor energy storage operation is performed; When the current deviation value is negative, a power adjustment operation is performed.
[0017] By adopting the above technical solution, it is determined whether the power supply requirements of the status lights of the connected interface can be met based on the current margin reserved in the current disconnected branch. When the current margin is sufficient, the excess power is stored in the energy storage capacitor for backup. When the current margin is insufficient, the output power of the connected branch is adjusted in time to ensure that the status indication and normal communication can be carried out synchronously.
[0018] Optionally, methods for performing power adjustment operations include: Obtain the energy storage capacity value of the connected interface number; The available supply duration is determined based on the energy storage capacity and current deviation. When the available supply time is less than the preset effective time threshold, peak control operation is performed and maintenance and repair signals are output.
[0019] By adopting the above technical solution and combining the storage capacity of the energy storage capacitor to predict the duration of normal supply status indication, when the supply duration is insufficient, peak control of communication power is performed in a timely manner to ensure that the status indication can be maintained normally. At the same time, maintenance and repair signals are output to remind staff to handle faults in a timely manner, reducing the probability of missing abnormal status.
[0020] Optionally, if a historical power-on state exists, the method for ensuring that all independent branch power supply lines and independent receiving signal paths corresponding to the control connection interface number are fully connected includes: Collect the current voltage level value corresponding to the shared terminal; The frequency group of the level value is determined according to a preset regular cycle based on the current level value; Determine the standard level frequency based on the level value frequency group; The reliable floating range is determined based on the standard level frequency, and the abnormal level frequency is determined based on the reliable floating range. When an abnormal frequency level is present, a faulty signal is output to the interface. When there is no abnormal level frequency, the independent branch power supply branch and independent receiving signal path corresponding to the control connection interface number are all connected.
[0021] By adopting the above technical solution, sampling and detecting the level and frequency of the common terminal before conduction can identify abnormal situations such as poor interface contact and line interference in advance, reducing the possibility of signal transmission errors after abnormal conduction and further improving the communication stability after interface switching.
[0022] Optionally, methods for determining a reliable fluctuation range based on a standard level frequency and for determining an abnormal level frequency using the reliable fluctuation range include: The frequency group of the level value is divided into multiple continuous sampling intervals, and the sampling start point and sampling end point of each continuous sampling interval are marked. The numerical reference centerline is determined based on the standard level frequency; Select a reference interval containing standard level frequencies, extract the maximum and minimum values of all frequencies within the interval based on the numerical reference midline, calculate the difference between the maximum and minimum values, and use it as the benchmark score. A one-sided floating range is generated by using the benchmark score and a preset margin coefficient, and a reliable floating range is determined by using the numerical benchmark midline and the one-sided floating range. Other intervals are determined based on the baseline interval, and the interval scores are determined based on the other intervals and the midline of the numerical baseline. The abnormal level frequency is determined based on the interval score, reliable floating range, and unilateral floating range.
[0023] By adopting the above technical solution and using segmented sampling comparison, unstable abnormal level fluctuations can be identified. Compared with direct detection of the whole signal, this effectively filters out interference caused by normal signal fluctuations, further improves the accuracy of abnormal level detection, and ensures the communication quality after connection.
[0024] Secondly, the present invention provides a software-switched communication interface control system for dual-terminal multiplexing, which adopts the following technical solution: A dual-terminal multiplexing software switching communication interface control system includes: The acquisition module is used to acquire the current mutex control signal; The memory is used to store the program for the software switching communication interface control method of dual-terminal multiplexing as described above; The processor loads and executes programs from memory.
[0025] By adopting the above technical solution, the path switching is completed by software parsing the mutual exclusion control signal. The dual-interface dynamic switching can be achieved without the need for additional manual operation of DIP switches or jumpers, adapting to the communication needs of different scenarios. At the same time, it can perform anomaly verification and correction on status indicators, improve the reliability of status display, and facilitate staff to troubleshoot and locate faults in a timely manner.
[0026] In summary, the present invention has at least one of the following beneficial technical effects: 1. The software analyzes the mutual exclusion control signal to control the on / off state of two communication branches. It can work as needed in three modes: interlocked single-path conduction, full path connection, and full path disconnection. It can adapt to various mixed communication scenarios of RS232 / RS485 without modifying the hardware. 2. Before powering on the equipment, the peripheral device plug-in identification and historical power supply record verification are completed in sequence. When an unfamiliar external device with no historical power supply is connected, an alarm is automatically triggered to prevent unauthorized access. Before powering on, the common terminal level is tested for timing segmented frequency self-calibration to identify terminal loose connection faults and lock power on, and output fault prompts in a timely manner. 3. Real-time verification of the working status of LED status indicators. When the power supply of the connected branch fails, the disconnected side is equipped with an intact branch and anti-backflow diode for unidirectional power supply. The backup power supply power is controlled in stages by current comparison, capacitor energy storage, and load peak current limiting. When the energy storage margin is insufficient, the operation and maintenance alarm is actively pushed to extend the standby time of the equipment after the fault. Attached Figure Description
[0027] Figure 1This is a schematic diagram of a dual-communication interface hardware connection architecture in the prior art; Figure 2 This is a flowchart of a software switching communication interface control method for dual-terminal multiplexing in an embodiment of this application; Figure 3 This is a schematic diagram of a software switching communication interface hardware architecture for dual-terminal multiplexing in an embodiment of this application. Detailed Implementation
[0028] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.
[0029] This invention discloses a software-controlled switching communication interface for dual-terminal multiplexing. (Refer to...) Figure 2 A software-controlled communication interface switching method for dual-terminal multiplexing includes: Step 1: Obtain the target port and the current mutex control signal corresponding to the target port.
[0030] One method for controlling a dual-terminal multiplexed software switching communication interface is applied to a hardware architecture for a dual-terminal multiplexed software switching communication interface. (Refer to...) Figure 3 A dual-terminal multiplexed software-switching communication interface hardware architecture includes a controller (with an integrated UART / TTL interface), a mode control unit, a power supply interlock unit, a receive channel selection unit, a first physical layer conversion unit (RS232 level conversion), a second physical layer conversion unit (RS485 differential transceiver), a common terminal, and a protection and bias unit. The controller's UART_TX / UART_RX pins are wired in two paths: one connects to the power supply interlock unit, and the other connects to the receive channel selection unit. The mode control unit sends a mode selection signal to the power supply interlock unit, which in turn drives the RS232 level conversion unit. The receive channel selection unit, in turn, drives the RS485 differential transceiver unit. The outputs of the RS232 and RS485 units are connected to the common terminal. A protection and bias unit is connected in series at the rear of the common terminal to provide lightning protection and current limiting. UART_TX refers to the data transmission pin of the controller's UART interface, used to output TTL data to the RS232 / RS485 hardware side; UART_RX refers to the data reception pin of the controller's UART interface, used to receive TTL data transmitted back to the main controller from external devices via RS232 / RS485.
[0031] The target port refers to a dual-terminal multiplexed communication port that integrates the RS232 interface corresponding to the first physical layer conversion unit and the RS485 interface corresponding to the second physical layer conversion unit, with the two interface outputs sharing the same common terminal.
[0032] The current mutual exclusion control signal refers to the signal used to indicate the port's operating mode. In this embodiment, the level-coded information output by the controller is used. The level-coded information includes two items: whether the port has enabled mutual exclusion constraint and the connected interface number. The mutual exclusion control signal is generated by the main controller of this solution based on the upper-layer software configuration instructions. The configuration instructions can be triggered in three ways: the host computer software remotely sends port mode configuration instructions via serial port, the device's local human-machine interaction buttons, and the automatic operating condition switching logic preset by the device's built-in application software.
[0033] If configured in interlocking mode, the software generates a level code with a valid mutual exclusion constraint identifier, and fills in the corresponding connection interface number according to the selected communication interface (RS232 or RS485) to generate the final mutual exclusion control signal, thereby realizing the two-to-one electrical interlock switching.
[0034] If configured to de-interlock mode, the mutual exclusion constraint flag in the level encoding is set to invalid, and the fixed connected interface number is no longer carried. Subsequently, the controller software will determine whether the port is fully connected or fully disconnected, and realize the software switching of the two interfaces being fully open or fully closed synchronously.
[0035] Among them, the mutual exclusion constraint identifier refers to the characteristic level bit in the level code used to mark whether the port has enabled the two-way forced mutual exclusion rule. The high and low levels of this characteristic level are used to distinguish whether the interlock is enabled or disabled.
[0036] The connection interface number refers to the identification code of the interface to be connected selected in the level encoding, corresponding to the RS232 interface and the RS485 interface respectively. RS232 and RS485 each have pre-set corresponding numbers.
[0037] After receiving the level-coded information, the software determines whether a mutual exclusion constraint flag exists. If a mutual exclusion constraint flag exists, the controller outputs control commands through the mode control unit, outputting a conduction drive level only to the interface switch corresponding to the connection interface number specified in the level-coded information, and an off drive level to the other interface switch. The power supply interlock unit manages the power supply to the RS232 branch, and the receive channel selection unit manages the signal reception of the RS485 branch. This forces one path to be connected and the other to be disconnected from both the power supply and signal paths, achieving electrical mutual exclusion and preventing both interfaces from being powered on simultaneously.
[0038] Step 2: Analyze the current mutex control signal to determine the interlock status.
[0039] Interlocking state refers to the working mode in which the port enables forced mutual exclusion constraint. This mode constrains that RS232 and RS485 within the same port cannot be connected at the same time, and only one can work. Specifically, the presence of a mutual exclusion constraint identifier in the level encoding information indicates that the interlocking state exists.
[0040] Step 30: If an interlocking state exists, determine the connected interface number and disconnected interface number based on the current mutual exclusion control signal.
[0041] The disconnected interface number refers to the remaining interface number that is matched with the power supply and signal path to be cut off under mutual exclusion constraints.
[0042] When an interlocking state exists, it means that the port must meet the constraint requirement of single-path connection and cannot have a situation where two paths are connected and powered at the same time. Therefore, it is necessary to automatically deduce the number of the other interface that needs to be disconnected based on the specified connection interface number.
[0043] Step 31: Perform path connection operation based on the connection interface number.
[0044] The path connection operation refers to connecting the independent branch power supply line corresponding to the connection interface number through the power supply interlock unit, and simultaneously connecting its independent receiving signal path through the receiving channel selection unit, so that the corresponding physical layer conversion unit is powered on and ready.
[0045] Step 32: Perform a path disconnection operation based on the disconnection interface number.
[0046] The path disconnection operation refers to cutting off the independent branch power supply corresponding to the disconnection interface number through the power supply interlock unit, and simultaneously shutting off its independent receiving signal path by the receiving channel selection unit, thereby de-energizing the corresponding physical layer conversion unit and isolating the signal link. Specifically, the signal path is permanently disconnected, while the power supply circuit can be controlled to conduct for short periods for fault assistance power supply, and the power supply is disconnected during normal operation.
[0047] Step 40: If there is no interlocking state, determine the current port status. The current port status includes fully disconnected status and fully connected status.
[0048] The current port status refers to the overall configuration state of the port without mutual exclusion constraints between hardware and software (RS232, RS485). The port status is obtained by the main controller based on the configuration instructions from the upper-layer software. The instructions carrying the current port status include a port status identifier field. When the port status identifier field is 1, it is determined to be a fully connected condition; when the port status identifier field is 0, it is determined to be a fully disconnected condition.
[0049] The "complete disconnection" condition refers to the condition where the power supply branches and receiving signal paths of both interfaces on the same port are completely cut off. The power supply interlock unit simultaneously cuts off the power supply of the two branches, and the receiving channel selection unit simultaneously shuts down the two receiving links.
[0050] The fully connected operating condition refers to the condition where the power supply branches and receiving signal paths of the two interfaces on the same port are all connected. The power supply interlock unit synchronously supplies power to the RS232 unit and RS485 unit, and the receiving channel selection unit synchronously conducts the two receiving signals.
[0051] When there is no interlocking state, it means that the mutual exclusion constraint between the software and hardware is released, and the two interfaces no longer work together to restrain each other, and can be opened or closed synchronously.
[0052] Step 41: If the current port is in a fully connected state, perform a path connection operation.
[0053] If the current port is in a fully connected state, it means there is no mutual exclusion restriction, and the path connection operation will be performed on both interfaces within the port.
[0054] Step 42: If the current port is in a fully disconnected state, perform a path disconnection operation.
[0055] If the current port is in a fully disconnected state, it means there is no mutual exclusion restriction, and the path disconnection operation will be performed on both interfaces within the port.
[0056] When interlocking is present, the corresponding on / off operation is performed only on a single interface; when there is no interlocking and it is in a fully connected state, the entire RS232 and RS485 interfaces in the target port are connected; when there is no interlocking and it is in a fully disconnected state, the entire two interfaces are disconnected.
[0057] This also includes a method for performing visualization operations, which includes: Step 50: When an interlocking state exists, find the preset interlocking visualization scheme and perform visualization operations according to the interlocking visualization scheme based on the currently connected interface number and the currently disconnected interface number.
[0058] The interlocking visualization scheme refers to a pre-configured LED lighting control logic strategy. In this embodiment, red and green LEDs are used to correspond to the two interfaces respectively, and the on / off status of the interfaces is distinguished by the constant on and off states of the different colored lights.
[0059] In the interlocking visualization scheme, when the RS232 interface is connected and the RS485 interface is disconnected, the LED corresponding to the RS232 interface will be constantly lit in green, and the LED corresponding to the RS485 interface will be constantly lit in red.
[0060] Visual operation refers to the operation of driving the corresponding LED indicator to light up or turn off according to the visualization scheme, so as to intuitively reflect the actual on / off status of the interface through the light status.
[0061] When an interlocking state exists, it indicates that one port interface is connected while the other is disconnected. Two different colored LEDs are used to identify the connected and disconnected interfaces, with one LED always on and the other off.
[0062] Step 51: When there is no interlocking state, search for the preset full connectivity visualization scheme and full disconnection visualization scheme based on the current port operating conditions, and execute the visualization operation.
[0063] The fully connected visualization solution refers to the LED control strategy when both interfaces within a port are fully connected.
[0064] Specifically, the fully connected visualization solution involves the LEDs corresponding to the two interfaces simultaneously maintaining a constant green light.
[0065] The full disconnect visualization scheme refers to the LED control strategy when both interfaces within a port are completely disconnected.
[0066] Specifically, the fully disconnected visualization solution involves both interfaces' corresponding LEDs simultaneously maintaining a constant red light. The LEDs are powered by an independent auxiliary power supply and are not controlled by the on / off state of the two branch power supplies.
[0067] When there is no interlocking state, it means that the port has released the mutual exclusion constraint, and there are only two working conditions: two paths are fully open or two paths are fully closed. The two working conditions can be distinguished by whether both lights are on or both lights are off.
[0068] The specific methods for performing path connectivity operations include: Step 310: Obtain the status of the inserted device corresponding to the connection interface number.
[0069] The device insertion status refers to the insertion status obtained by sampling the no-load level changes of the two terminals using the internal pull-up level of the main control I / O port. During the acquisition of the device insertion status, only voltage sampling is performed; the main control does not output operating power to the external terminals. Therefore, the external device cannot receive power and will not start. The status is divided into device insertion status and device not inserted status.
[0070] Step 311: When an inserted device is present, define the connectivity interface number as the detection interface number.
[0071] The detection interface number refers to the index code used to retrieve historical power supply data.
[0072] When a device is inserted, it means that an external communication device is plugged into the two terminals of the current interface. Historical power supply information needs to be retrieved to determine whether power-on is allowed.
[0073] Step 312: Obtain the historical power supply information corresponding to the detection interface number.
[0074] Historical power supply information refers to the power supply operation data of the corresponding interface stored in the controller's storage unit at the time of the last power failure of the entire machine.
[0075] Step 313: Determine the historical power supply status through historical power supply information.
[0076] Historical power status refers to the state in which the corresponding independent power supply branch of the interface was in a conductive state and the external equipment was energized before the last power failure of the whole machine.
[0077] Step 314: If a historical power-on state exists, control the connection of all independent branch power supply and independent receiving signal paths corresponding to the interface number.
[0078] Independent branch power supply refers to a dedicated power supply branch where the RS232 and RS485 interfaces are set up independently and controlled by switching elements, and the two power supply lines are isolated from each other.
[0079] Independent signal receiving paths refer to separate signal receiving lines laid out for each interface. The two interface signal lines are not connected to each other and can be independently controlled to open and close.
[0080] If a historical power-on state exists, it indicates that the currently plugged-in device is an existing in-use device that was not removed after the previous round of work was completed, and the interface is allowed to power on and work normally.
[0081] Step 315: If there is no historical power-on state, output a reminder signal from the device.
[0082] The device legacy alert signal refers to the light alarm signal that drives the corresponding port indicator light to flash red and green alternately.
[0083] If there is no historical power-on status, it means that there were no external devices connected to this interface when the whole machine was powered off last time. The currently connected device is a new, unfamiliar device added after the power outage. Power will not be connected and a reminder will be issued.
[0084] This also includes a method for verifying visual operations, which includes: Step 52: When an interlocking state exists, obtain the LED number corresponding to the connected interface number and define it as the current connected LED number.
[0085] The connected LED number refers to the indicator light code bound to the currently connected interface. Each interface is pre-configured with an independently numbered LED indicator light.
[0086] When an interlocking state exists, it indicates that the port is in an interlocking working mode of one being connected and the other being disconnected. According to the interlocking visualization scheme, the LED of the connected interface should be constantly green and the LED of the disconnected interface should be constantly red.
[0087] Step 53: Obtain the connected lighting status corresponding to the current connected LED number.
[0088] The "connected lighting state" refers to the LED corresponding to the connected interface being constantly lit green according to the rules, indicating that the power supply of the connected branch is working normally.
[0089] Step 54: If there is no connected light-emitting state, determine the number of the currently disconnected LED based on the number of the currently connected LED.
[0090] The currently disconnected LED number refers to the indicator number corresponding to another disconnected interface within the same port.
[0091] When there is no connected light-emitting state, it indicates that the power supply branch of the connected interface that should be powered on is faulty, and the corresponding LED cannot light up green normally.
[0092] Step 55: Obtain the off-light status corresponding to the currently off LED number.
[0093] The "disconnected illumination state" refers to the state where the LED on the disconnected side is constantly lit red under interlocking mode.
[0094] Step 56: If there is a disconnected light-emitting state, perform an interlocked power supply operation based on the disconnected interface number and the connected interface number.
[0095] Interlocked assisted power supply operation refers to the operation where, under normal interlocked working conditions, the independent branch power supply and signal path of the disconnected interface are completely disconnected. Only in abnormal conditions of power supply failure of the connected branch is the signal path of the disconnected interface itself permanently disconnected and the communication operation of the disconnected interface body not activated. The output terminal of the independent branch power supply corresponding to the disconnected interface is temporarily connected to the common terminal in a controllable manner and temporarily connected in parallel. The intact power supply of this line is used to supplement the power of the external load through the common terminal. After the fault is eliminated, the power supply of the disconnected branch is immediately turned off. The disconnected interface keeps the signal disconnected and the body does not start working throughout the process, while the connected interface continues to maintain the original path configuration.
[0096] Among them, the common terminal serves as a common output node for the two interfaces. During fault assistance power supply, the power output of the disconnected branch is connected in parallel to the common terminal through the anti-backflow diode. The disconnected interface receiving channel is still kept off by the receiving channel selection unit.
[0097] When the light is off, it indicates that the power supply of the connected branch is failed, the power supply of the disconnected branch is intact, and the auxiliary load is powered by the power supply of the disconnected branch. The disconnected interface body remains in the disconnected state.
[0098] Step 57: If there is no disconnected light state, output a dual-power supply fault reminder signal.
[0099] The dual power supply fault reminder signal is an alarm signal used to remind users that both independent power supply branches of the port have failed. Specifically, the LEDs corresponding to the two interfaces will flash red and green lights alternately at the same time.
[0100] When there is no disconnected light-emitting state, it indicates that the power supply branches corresponding to the LEDs of both interfaces have failed, so a dual power supply fault reminder signal is output.
[0101] The methods for performing interlocked assisted power supply operations include: Step 560: Determine the anti-backflow diode number based on the disconnection interface number.
[0102] The anti-backflow diode number refers to a unique component code bound to the independent branch power supply output terminal of the interface. Each interface is equipped with a unidirectional anti-backflow diode with a unique number. A dedicated anti-backflow diode is connected in series at the output terminal of each independent branch power supply circuit of RS232 and RS485. The anode of each anti-backflow diode is connected to the power output node of the corresponding independent branch power supply circuit, and the cathodes are collectively connected to the power supply node of the common terminal. Each anti-backflow diode is bound to a corresponding interface number, forming a one-to-one mapping relationship between interface numbers and anti-backflow diode numbers. The corresponding anti-backflow diode number can be directly determined by disconnecting the interface number.
[0103] Step 561: Obtain the common terminal number corresponding to the anti-backflow diode number to determine the conduction direction.
[0104] The shared terminal number refers to the marking code of a shared terminal used for external load wiring between two interfaces.
[0105] The conduction direction refers to the unidirectional conduction direction in which electrical energy can only flow from the independent branch power supply of the disconnected interface through the anti-backflow diode to the common terminal. Reverse current is blocked by the diode and cannot flow back. The anti-backflow diode is fixed with its anode connected to the power supply output terminal of the disconnected interface and its cathode connected to the common terminal. Therefore, the conduction direction is uniquely locked by the hardware wiring structure, and the unidirectional power transmission path can be determined without the need for additional circuitry.
[0106] Step 562: Perform interlocked assisted power supply operation based on the conduction direction.
[0107] When a conduction direction exists, it indicates that the anti-backflow diode hardware wiring matches the unidirectional power supply logic, which can prevent current backflow from damaging the intact power supply branch and meet the hardware execution conditions of auxiliary power supply.
[0108] The interlock-assisted power supply logic is as follows: when the interlock is working, the power supply and signal of the disconnect interface are both cut off, and the diode is cut off without forward voltage drop; after a power supply failure in the connected branch, the independent branch power supply circuit of the disconnect interface is only briefly controlled to conduct, keeping the signal path of the disconnect interface off. The forward voltage of the power supply output on the disconnect side is applied to the anode of the corresponding anti-reverse flow diode, and the diode conducts in the forward direction. The power is sent to the common terminal through the diode to supplement the external load; when the voltage on the common terminal side is higher than the output voltage on the disconnect side, the diode is reverse cut off to prevent the reverse voltage on the load side from damaging the power supply of the disconnect interface.
[0109] The specific methods for performing interlocked assisted power supply operations based on the conduction direction include: Step 5620: Obtain the current value of the currently disconnected branch based on the disconnected interface number in real time.
[0110] The current disconnected branch current value refers to the actual working current output by the power supply branch corresponding to the disconnected interface number during the assisted power supply operation phase.
[0111] Step 5621: Retrieve the current required current value corresponding to the connected interface number.
[0112] The current demand value refers to the rated operating current required for the external load connected to the power supply branch corresponding to the connection interface number to operate stably.
[0113] Step 5622: Determine the current deviation value based on the current disconnected branch current value and the current demand current value.
[0114] The current deviation value is the difference calculated by subtracting the current demand current value from the current disconnected branch current value.
[0115] Step 5623: When the current deviation value is positive, perform capacitor energy storage operation.
[0116] Capacitor energy storage operation refers to storing excess electrical energy from disconnected branches into a storage capacitor. When the load experiences a sudden surge in power consumption, the storage capacitor replenishes the energy through discharge. Once the storage capacitor is full, excess energy is channeled into the power discharge branch for consumption. The storage capacitor is an energy storage device specifically designed for fault-assisted power supply, connected in parallel between the common terminal and the system reference ground. One end is connected to the common terminal power supply node, and the other end is connected to the system reference ground. It is connected in parallel to the end of the common terminal to assist in charging the storage capacitor, thus achieving capacitor energy storage operation. When there is a power shortage in the load, the storage capacitor discharges in parallel to replenish the power. The system reference ground is the common power ground (GND) of the entire device, where all power supply circuits, controllers, and physical layer conversion circuits are connected together.
[0117] When the current deviation value is positive, it indicates that the actual output current of the power supply branch on the disconnected side is greater than the current required by the load, and there is a surplus of power in the power supply.
[0118] Step 5624: When the current deviation value is negative, perform a power adjustment operation.
[0119] Power adjustment operation refers to the operation of releasing pre-stored surplus electrical energy through a pre-set energy storage capacitor to supplement the output gap, and supplying the electrical energy stored in the energy storage capacitor and the current output electrical energy of the disconnected branch to the external load in parallel, so that the total output power meets the actual working needs of the external load.
[0120] When the current deviation value is negative, it indicates that the output current of the power supply branch on the disconnected side cannot meet the rated power demand of the load, and the power supply is insufficient.
[0121] The methods for performing power adjustment operations include: Step 56240: Obtain the energy storage capacity value of the connected interface number.
[0122] The energy storage capacity value refers to the quantitative value of the remaining electrical energy currently stored in the energy storage capacitor.
[0123] Step 56241: Determine the available supply duration based on the energy storage capacity and current deviation value.
[0124] The available supply duration refers to the estimated duration during which the current gap can be filled by the existing remaining power of the energy storage capacitor, and the load can be continuously supplied with power.
[0125] Step 56242: When the available supply time is less than the preset effective time threshold, perform peak control operation and output maintenance signal.
[0126] The effective duration threshold refers to the critical reference duration used to determine whether the backup power of the energy storage capacitor is sufficient. This value is determined in advance through experimental testing.
[0127] Peak current control refers to limiting the instantaneous peak current consumption of external loads, reducing short-term surge power consumption, and extending the overall power supply duration. The back-end load-side current limiting circuit is connected in series between the common terminal and the external load. It consists of a programmable current limiting chip and a controlled MOSFET. The control pins of the current limiting chip are connected one-to-one to the controller's general-purpose I / O ports. The controller internally stores the binding parameters of each connected interface number and the corresponding current limiting circuit. When peak current control is triggered, the controller retrieves the preset current limiting threshold parameter based on the current connected interface number and modifies the maximum output current limit value of the current limiting chip via the corresponding I / O pin output level command. This suppresses the instantaneous peak current and relies on the energy storage capacitor to supplement the portion of the energy exceeding the constant output during peak periods, preventing the load from shutting down due to power shortages. The current limiting threshold parameter refers to the maximum output current value allowed by the programmable current limiting chip. Different interfaces have different rated power for external loads, and the corresponding current limiting threshold parameters are pre-stored in the controller.
[0128] During the fault-assisted power supply phase, the power supply relies solely on the fixed power of the disconnected branch, with the maximum output current and output power of the branch set at their rated values. When the load experiences a sudden surge in instantaneous peak power consumption, the instantaneous power demand exceeds the continuous power supply limit of the disconnected branch. If the peak current is not limited, the instantaneous overload will lower the bus voltage, causing the load to lose power and shut down. By limiting the load's peak current, the steady-state power consumption of the load is constrained within the rated output range of the disconnected branch. The energy storage capacitor is only used to fill the short-term peak gap. This approach both smooths out instantaneous power fluctuations and prevents long-term power overload, effectively extending the backup power supply duration and allowing sufficient time for maintenance personnel to arrive for on-site repairs.
[0129] Maintenance and repair signals refer to prompt signals that remind maintenance personnel to inspect and repair faulty power supply branches at connection interfaces.
[0130] When the available supply time is less than the effective time threshold, it indicates that the remaining power of the energy storage capacitor is limited and cannot make up for the power supply gap in the long term. It is difficult to maintain the stable operation of the load for a long time by relying solely on the energy storage capacitor to make up for the power supply gap.
[0131] Among them, if there is a historical power-on state, the method for ensuring that all independent branch power supply branches and independent receiving signal paths corresponding to the control connection interface number are connected includes: Step 3140: Collect the current level value corresponding to the shared terminal.
[0132] Because there is a historical power-on state and this interface is a connected interface number, the circuit of the current interface is in a conducting state.
[0133] The current voltage level refers to the configuration of the general-purpose I / O pin of this system controller in high-impedance input mode. This I / O pin only electrically connects to the common terminal and does not output drive current or drive voltage to the common terminal. This step is performed after the communication interface branch is powered on, and the real-time voltage sampling value of the common terminal is collected using a high-impedance passive sampling method. High-impedance input sampling of the I / O is not constrained by whether the branch is powered on; in fact, it is easier to collect a valid voltage level when powered on. High-impedance input mode refers to the hardware configuration mode of the controller I / O. In this mode, the internal equivalent impedance of the I / O pin reaches the megaohm level. The pin neither outputs voltage to the outside nor draws current from the external common terminal. It is equivalent to a voltmeter connected in parallel to the common terminal, and the sampling will not cause load interference to the original voltage of the terminal or the power supply branch of the device. The I / O port does not output drive level to the outside, which means that the I / O has disabled push-pull output, pull-up or pull-down drive capability, and only retains the voltage detection function. The controller will not inject high or low levels into the common terminal through this I / O. The terminal voltage is entirely determined by the powered-on communication branch and the external device to ensure that the sampled voltage truly reflects the actual operating condition of the terminal.
[0134] Step 3141: Determine the frequency group of the level value according to the preset regular period based on the current level value.
[0135] Regular period refers to a pre-set fixed sampling interval, that is, the level of the common terminal is sampled once at fixed intervals.
[0136] A level value frequency group refers to a set of frequency data that is collected multiple times at a fixed sampling interval, and the number of times the level of the common terminal changes within each sampling period is counted. The frequency changes of all periods are then summarized into a set of frequency data.
[0137] Step 3142: Determine the standard level frequency and abnormal level frequency based on the level value frequency group.
[0138] Standard level frequency refers to the frequency jump that occurs most frequently and whose values converge in the level value frequency group. It is the normal level fluctuation frequency when the peripheral device is stably plugged in and there are no loose connections.
[0139] Step 3143: Determine the reliable floating range based on the standard level frequency, and determine the abnormal level frequency through the reliable floating range.
[0140] The reliable floating range refers to the maximum deviation range of normal level fluctuations from the standard level frequency, determined by analyzing the patterns of the standard level frequency.
[0141] Abnormal frequency levels refer to frequency jumps that deviate from the standard frequency level beyond the floating range and are scattered and isolated.
[0142] Step 3144: When an abnormal level frequency exists, output a faulty interface signal.
[0143] The interface malfunction signal is an alarm signal indicating a loose connection fault between the external device and the shared terminal. It is emitted by a red LED flashing at a high frequency.
[0144] When an abnormal voltage level frequency is present, it indicates that although the equipment has historical power-on records, the common terminals and external equipment are loosely connected, and the contacts are intermittently loose. The already connected branch power supply line is then cut off.
[0145] Step 3145: When there is no abnormal level frequency, the independent branch power supply branch and independent receiving signal path corresponding to the control connection interface number are all connected.
[0146] When there is no abnormal voltage level, it indicates that the shared terminal is in reliable contact with the external device, there is no loose connection fault, and the independent branch power supply and independent signal receiving path corresponding to the connection interface are continuously conducting.
[0147] Among them, the method of determining the reliable floating range based on the standard level frequency, and determining the abnormal level frequency through the reliable floating range, includes: Step 31430: Divide the level value frequency group into multiple continuous sampling intervals and mark the sampling start point and sampling end point of each continuous sampling interval.
[0148] A continuous sampling interval refers to a data segment consisting of several adjacent and uninterrupted sets of frequency data in time sequence. A single interval corresponds to a continuous actual sampling duration.
[0149] The sampling start point refers to the sampling identifier corresponding to the first sampling moment in the time sequence within a single continuous sampling interval. The sampling end point refers to the sampling identifier corresponding to the last sampling moment in the time sequence within a single continuous sampling interval.
[0150] Step 31431: Determine the numerical reference centerline based on the standard level frequency.
[0151] The numerical reference line is a horizontal reference line parallel to the timing axis in a two-dimensional coordinate system where the horizontal axis represents the sampling timing and the vertical axis represents the level frequency value. The vertical coordinate corresponding to this line is fixed at the standard level frequency. The frequency waveform of all sampling intervals is judged by referring to this horizontal reference line to determine the upper and lower fluctuation range.
[0152] Step 31432: Select a reference interval containing standard level frequencies, extract the maximum and minimum values of all frequencies within the interval based on the numerical reference midline, calculate the difference between the maximum and minimum values, and use it as the reference score.
[0153] The reference interval refers to any one of the consecutive sampling intervals after segmentation, where all frequencies are at the standard level.
[0154] The maximum value in an interval refers to the largest value among all frequency values within a single sampling interval.
[0155] The minimum value of an interval refers to the smallest value among all frequency values within a single sampling interval.
[0156] Step 31433: Generate a one-sided floating range using the benchmark score and a preset margin coefficient, and determine a reliable floating range using the numerical benchmark midline and the one-sided floating range.
[0157] The margin factor refers to a pre-set allowance coefficient used to reserve a reasonable deviation space based on the baseline fluctuation range. It is a factory-preset fixed parameter with a value greater than 1, used to compensate for normal frequency fluctuations caused by temperature drift and electromagnetic interference in industrial environments. The unilateral fluctuation range refers to the maximum permissible deviation value obtained by multiplying the baseline score by the margin factor.
[0158] The upper limit of the reliable floating range is equal to the numerical baseline midline plus the baseline score multiplied by the margin factor (plus the one-sided floating range), and the lower limit of the reliable floating range is equal to the numerical baseline midline minus the baseline score multiplied by the margin factor (minus the one-sided floating range).
[0159] Step 31434: Determine other intervals based on the baseline interval, and determine the interval score based on the other intervals and the midline of the numerical baseline.
[0160] Other intervals refer to all continuous sampling intervals remaining after segmentation, excluding the baseline interval.
[0161] Interval score refers to the difference between the maximum and minimum values within a single interval, representing the overall actual fluctuation range of the frequency during that sampling period.
[0162] Step 31435: Determine the abnormal level frequency based on the interval score, reliable floating range, and unilateral floating range.
[0163] The numerical baseline is set to 2Hz, the margin coefficient is set to 1.2, and the sampling frequencies for the baseline interval (from the 1st to the 5th second) are 2Hz, 2.3Hz, 1.8Hz, 2.1Hz, and 1.9Hz. Therefore, the maximum value of the baseline interval is 2.3Hz, the minimum value is 1.8Hz, the baseline score is 2.3 minus 1.8 equals 0.5Hz, and the unilateral fluctuation range is 0.5Hz multiplied by 1.2 equals 0.6Hz. The upper limit of the reliable fluctuation range is 2Hz plus 0.5Hz multiplied by 1.2 equals 2.6Hz, and the lower limit of the reliable fluctuation range is 2Hz minus 0.5Hz multiplied by 1.2 equals 1.4Hz.
[0164] Other intervals (from 6s to 10s) have the following frequencies: 3.2Hz, 2.9Hz, 1.1Hz, 0.8Hz, and 1.5Hz. Therefore, the maximum value of this interval is 3.2Hz, the minimum value is 0.8Hz, and the interval score is 3.2 - 0.8 = 2.4Hz. On the one hand, the interval score of 2.4Hz is greater than the single-sided fluctuation range of 0.6Hz; on the other hand, 3.2Hz and 2.9Hz within the interval are higher than the upper limit of the fluctuation range of 2.6Hz, and 1.1Hz and 0.8Hz are lower than the lower limit of the fluctuation range of 1.4Hz. Multiple sampling frequencies fall outside the reliable fluctuation range of 1.4Hz to 2.6Hz. Since both the interval score exceeding the single-sided fluctuation range and a single frequency falling outside the reliable fluctuation range are met, all sampling frequencies outside the range in this interval are marked as abnormal level frequencies, indicating poor contact.
[0165] Based on the same inventive concept, embodiments of the present invention provide a software switching communication interface control system for dual-terminal multiplexing.
[0166] A dual-terminal multiplexing software switching communication interface control system includes: The acquisition module is used to acquire the current mutex control signal; A memory for storing a program for a software-switched communication interface control method with dual-terminal multiplexing; The processor loads and executes programs from memory.
[0167] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0168] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A software switching communication interface control method for dual-terminal multiplexing, characterized in that, include: Obtain the target port and the current mutex control signal corresponding to the target port; Analyze the current mutex control signal to determine the interlock status; If an interlocking state exists, determine the connected interface number and disconnected interface number based on the current mutual exclusion control signal; Perform path connection operations based on the connection interface number; Perform a path disconnection operation based on the disconnection interface number; If there is no interlocking state, determine the current port operating condition, which includes a fully disconnected operating condition and a fully connected operating condition; If the current port is in a fully connected state, perform a path connection operation; If the current port is in a fully disconnected state, perform a path disconnection operation.
2. The software switching communication interface control method for dual-terminal multiplexing according to claim 1, characterized in that, It also includes methods for performing visualization operations, which include: When an interlocking state exists, find the preset interlocking visualization scheme and perform visualization operations according to the interlocking visualization scheme based on the currently connected interface number and the currently disconnected interface number; When there is no interlocking state, the preset full connectivity visualization scheme and full disconnection visualization scheme are searched based on the current port operating conditions, and the visualization operation is executed.
3. The software switching communication interface control method for dual-terminal multiplexing according to claim 1, characterized in that, The specific methods for performing path connectivity operations include: Get the status of the inserted device corresponding to the connected interface number; When an inserted device is present, the connection interface number is defined as the detection interface number; Obtain the historical power supply information corresponding to the detection interface number; Historical power supply status is determined by historical power supply information; If there is a historical power-on state, all independent branch power supply branches and independent receiving signal paths corresponding to the control connection interface number are connected; If there is no historical power-on state, the output device will retain a reminder signal.
4. The software switching communication interface control method for dual-terminal multiplexing according to claim 2, characterized in that, It also includes a method for verifying visual operations, which includes: When an interlocking state exists, obtain the LED number corresponding to the connected interface number and define it as the current connected LED number; Get the connected lighting status corresponding to the current connected LED number; If there is no connected luminous state, determine the number of the currently disconnected LED based on the number of the currently connected LED; Get the off-light status corresponding to the currently off LED number; If there is a disconnected light-emitting state, perform an interlocked power supply operation based on the disconnected interface number and the connected interface number; If there is no disconnection of the light source, output a dual-power supply fault warning signal.
5. The software switching communication interface control method for dual-terminal multiplexing according to claim 4, characterized in that, Methods for performing interlocked assisted power supply operations include: The anti-backflow diode number is determined based on the disconnection interface number; Obtain the common terminal number corresponding to the anti-reverse flow diode number to determine the conduction direction; Interlocking assistance power supply operation is performed based on the conduction direction.
6. The software switching communication interface control method for dual-terminal multiplexing according to claim 5, characterized in that, Specific methods for performing interlocked assisted power supply operations based on the conduction direction include: The current value of the currently disconnected branch is obtained in real time based on the disconnected interface number; Retrieve the current required current value corresponding to the connected interface number; The current deviation value is determined based on the current disconnected branch current value and the current demand current value. When the current deviation is positive, capacitor energy storage operation is performed; When the current deviation is negative, a power adjustment operation is performed.
7. The software switching communication interface control method for dual-terminal multiplexing according to claim 6, characterized in that, Methods for performing power adjustment operations include: Obtain the energy storage capacity value of the connected interface number; The available supply duration is determined based on the energy storage capacity and current deviation. When the available supply time is less than the preset effective time threshold, peak control operation is performed and maintenance and repair signals are output.
8. The software switching communication interface control method for dual-terminal multiplexing according to claim 3, characterized in that, If a historical power-on state exists, the methods for ensuring that all independent branch power supply lines and independent receiving signal paths corresponding to the control connection interface number are connected include: Collect the current voltage level value corresponding to the shared terminal; The frequency group of the level value is determined according to a preset regular cycle based on the current level value; Determine the standard level frequency based on the level value frequency group; The reliable floating range is determined based on the standard level frequency, and the abnormal level frequency is determined based on the reliable floating range. When an abnormal frequency level is present, a faulty signal is output to the interface. When there is no abnormal level frequency, the independent branch power supply branch and independent receiving signal path corresponding to the control connection interface number are all connected.
9. The software switching communication interface control method for dual-terminal multiplexing according to claim 8, characterized in that, The methods for determining a reliable floating range based on a standard level frequency, and for determining an abnormal level frequency based on the reliable floating range, include: The frequency group of the level value is divided into multiple continuous sampling intervals, and the sampling start point and sampling end point of each continuous sampling interval are marked. The numerical reference centerline is determined based on the standard level frequency; Select a reference interval containing standard level frequencies, extract the maximum and minimum values of all frequencies within the interval based on the numerical reference midline, calculate the difference between the maximum and minimum values, and use it as the benchmark score. A one-sided floating range is generated by using the benchmark score and a preset margin coefficient, and a reliable floating range is determined by using the numerical benchmark midline and the one-sided floating range. Other intervals are determined based on the baseline interval, and the interval scores are determined based on the other intervals and the midline of the numerical baseline. The abnormal level frequency is determined based on the interval score, reliable floating range, and unilateral floating range.
10. A software-switched communication interface control system with dual-terminal multiplexing, characterized in that, include: The acquisition module is used to acquire the current mutex control signal; A memory for storing a program for a software switching communication interface control method for dual-terminal multiplexing as described in any one of claims 1 to 9; The processor loads and executes programs from memory.