CN-122028281-A - Antistatic false triggering three-color switch interface circuit with lamp and switch state detection method
Abstract
The application belongs to the technical field of embedded control and electromagnetic compatibility, in particular to an antistatic false-triggered three-color switch interface circuit with a lamp and a switch state detection method, which comprise an interface power supply and input protection module, a switch state isolation and shaping module and an RGB indicator lamp driving module; the application realizes signal purification through two-stage RC low-pass filtering and Schmidt trigger shaping of a switch state isolation and shaping module, combines a pull-up resistor to stabilize the level, eliminates false triggering, relies on ESD protection of an interface power supply and input protection module and filtering and discharging design of an RGB driving module, inhibits electrostatic coupling interference, ensures normal control of an indicator lamp, realizes electric isolation through an optocoupler, cuts off a ground loop coupling path, cooperates with a low-capacitance ESD clamping device to discharge static electricity, protects a system and peripheral equipment, and overcomes the defects of traditional single filtering and software debounce through a combined architecture of isolation, multistage anti-interference and hardware shaping, thereby improving the working stability under a strong interference environment.
Inventors
- LIU YUXIANG
Assignees
- 上海凌泽信息科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260224
Claims (6)
- 1. An antistatic false-triggering three-color switch interface circuit with a lamp is characterized by comprising an interface power supply and input protection module, a switch state isolation and shaping module and an RGB indicator lamp driving module; The interface power supply and input protection module provides stable direct current power supply for the external switch lamp panel, resists transient overvoltage and electrostatic impact on a power supply line and ensures the working stability of a circuit foundation; The switch state isolation and shaping module realizes electrical isolation between the wire harness side and the MCU side, suppresses common mode interference, performs shaping, deburring and antistatic treatment on the switch state input signal, avoids false triggering caused by triggering MCU external interrupt (EXTI), and ensures stable signal transmission to the MCU; the RGB indicator lamp driving module drives the red, green and blue indicator lamps to work independently, so that switching and control of three-color lamplight are realized, meanwhile, the working stability of the indicator lamps is ensured, and false lighting and flickering caused by static electricity or interference are avoided.
- 2. The three-color switch interface circuit with the lamp, which is triggered by an antistatic error, is characterized in that the interface power supply and input protection module comprises a direct current power supply unit, a transient suppression unit (TVS) and a filter network, wherein the direct current power supply unit outputs preset direct current voltage to supply power to the whole external switch lamp panel and related components of the interface circuit, the transient suppression unit (TVS) clamps transient overvoltage on a power supply line to avoid damaging a rear-end component, and the filter network filters clutter in a power supply line to optimize power supply waveforms and improve power supply stability.
- 3. The three-color switch interface circuit with a lamp for preventing electrostatic false triggering of claim 1, wherein the switch state isolation and shaping module comprises an input current limiting and shaping network, an optoelectronic isolation device (optocoupler), an MCU side pull-up network, a front RC low-pass network, a rear RC low-pass network, a low-capacitance ESD clamping device and a Schmidt trigger buffer; the input current limiting and shaping network limits the impact current at the wire harness side, avoids damaging subsequent devices by large current, performs preliminary shaping on the waveform of an input signal, and filters partial irregular interference signals; the photoelectric isolation device (optocoupler) electrically isolates the wire harness side from the MCU side, cuts off a coupling path of common-mode interference, and reduces the influence of interference on MCU signal identification; The MCU side pull-up network forms a stable default level through a pull-up resistor, so that false identification caused by level shift when no signal is input is avoided; the front-stage RC low-pass network is close to the optical coupler output node and is mainly used for inhibiting high-frequency burr signals from the wire harness side and primarily purifying the signals; the rear RC low-pass network is close to the input end/MCU side of the Schmidt trigger buffer, further passivates narrow pulse interference, limits current injected into the MCU, and protects MCU pins; The low-capacitance ESD clamp device discharges residual electrostatic energy to the ground, so that static electricity is prevented from invading the MCU through a signal path to cause system abnormality; The Schmidt trigger buffer performs hysteresis regulation and edge shaping on the signals subjected to the multistage processing and outputs regular digital signals to an external interrupt input end of the MCU, so that the MCU can accurately identify the switch state.
- 4. The three-color switch interface circuit with the lamp for preventing the false triggering of the static electricity according to claim 1 is characterized in that the RGB indicator lamp driving module comprises a driving topology, a basic driving assembly and a base bleeder resistor, the driving topology is used for independently controlling the on-off of each path of lamp light, the basic driving assembly comprises a base current limiting resistor, a switching device and a base filter capacitor, and the base bleeder resistor is used for ensuring that the switching device is turned off by default when the lamp is powered on, so that the indicator lamp is prevented from being turned on by mistake when the lamp is powered on.
- 5. The method for detecting the switch state of the antistatic false-triggered three-color-band lamp according to any one of claims 1 to 4, which is characterized by comprising the following specific steps: Step one, external interrupt initialization configuration, namely configuring external interrupt (EXTI) of an MCU into a rising edge triggering mode, adapting level change logic when a switch is closed, laying a foundation for triggering detection of a follow-up switch state, and synchronously starting interrupt response basic protection in the configuration process to avoid invalid interrupt caused by level shift in an initialization stage; step two, interrupt triggering preliminary processing, namely immediately entering an interrupt service routine when the MCU detects an external interrupt rising edge trigger signal; Step three, delay debounce and level subsampling verification, namely setting preset delay debounce time by depending on a periodic task of an MCU or a timer callback function after exiting an interrupt service program, and subsampling the input level of a switch after finishing delay, wherein the effective switch triggering is judged once only when the subsampling detects that the input level is stable to be high level; after judging that effective triggering is carried out, the system enters a switch waiting release state, continuously detecting the input level of the switch until the input level is detected to be stable to be low level, and after the input level is maintained to be stable to be low level for a period of time, re-enabling a corresponding EXTI interrupt line to resume an interrupt triggering function, and waiting for a next switch triggering signal to form a complete triggering-verifying-releasing-resetting closed loop; Setting a trigger interval window, namely presetting a minimum interval time window for effective triggering twice in a system, recording a current trigger time stamp after each effective triggering judgment, enabling a subsequently detected trigger signal to meet the condition that the time interval between the trigger signal and the last effective triggering is larger than or equal to the preset interval window, entering a secondary sampling verification link in the third step, directly judging that the continuous false triggering is caused by static electricity if the two trigger intervals are smaller than a preset value, and ignoring the trigger signal without executing any response operation.
- 6. The method for detecting the switch state of the antistatic false triggering three-color-band lamp according to claim 5, wherein in the second step, only two core operations are executed in the program, namely, recording the triggering time of the current interrupt, reserving a time stamp for subsequent interval judgment, and rapidly shielding the corresponding EXTI interrupt line to prohibit the interrupt line from triggering the interrupt again.
Description
Antistatic false triggering three-color switch interface circuit with lamp and switch state detection method Technical Field The invention relates to the technical field of embedded control and electromagnetic compatibility, in particular to an antistatic false-triggered three-color switch interface circuit with a lamp and a switch state detection method. Background Industrial equipment, air detection terminals and panel controllers often employ key/toggle switches with indicator lights as human-machine interaction components. The switch is generally connected with the main control board through a wire harness, the length of the wire harness is generally 10 cm-50 cm, and the switch panel can be made of metal or is in frequent contact with a human body. In the above scenario, human electrostatic discharge (ESD) is injected into the motherboard along the beam, resulting in the following problems: The switch state input generates narrow pulse and burr to trigger MCU external interrupt (EXTI) to generate false touch, the pilot lamp control line is coupled electrostatically to generate false lighting or flashing, the electrostatic energy is coupled through a ground loop to cause system reset or peripheral abnormality, and the traditional scheme which only depends on RC filtering or pure software to remove shake is still easy to trigger by mistake under the condition of strong ESD or high dv/dt. Therefore, an antistatic false-triggering three-color switch interface circuit with a lamp and a switch state detection method are provided to solve the above-mentioned problems. Disclosure of Invention The invention aims to provide an antistatic false-triggering three-color switch interface circuit with a lamp and a switch state detection method, so as to solve the problems in the background technology. In order to achieve the aim, the invention provides the technical scheme that the three-color switch interface circuit with the lamp, which is triggered by antistatic error, comprises an interface power supply and input protection module, a switch state isolation and shaping module and an RGB indicator lamp driving module; The interface power supply and input protection module provides stable direct current power supply for the external switch lamp panel, resists transient overvoltage and electrostatic impact on a power supply line and ensures the working stability of a circuit foundation; The switch state isolation and shaping module realizes electrical isolation between the wire harness side and the MCU side, suppresses common mode interference, performs shaping, deburring and antistatic treatment on the switch state input signal, avoids false triggering caused by triggering MCU external interrupt (EXTI), and ensures stable signal transmission to the MCU; the RGB indicator lamp driving module drives the red, green and blue indicator lamps to work independently, so that switching and control of three-color lamplight are realized, meanwhile, the working stability of the indicator lamps is ensured, and false lighting and flickering caused by static electricity or interference are avoided. The interface power supply and input protection module comprises a direct current power supply unit, a transient suppression unit (TVS) and a filter network, wherein the direct current power supply unit outputs preset direct current voltage to supply power to the whole external switch lamp panel and related components of an interface circuit, the transient suppression unit (TVS) clamps transient overvoltage on a power supply line to avoid damage of rear-end components due to overvoltage, and the filter network filters clutter in the power supply line to optimize power supply waveforms and improve power supply stability. Preferably, the switch state isolation and shaping module comprises an input current limiting and shaping network, an optoelectronic isolation device (optocoupler), an MCU side pull-up network, a front-stage RC low-pass network, a rear-stage RC low-pass network, a low-capacitance ESD clamping device and a Schmidt trigger buffer; the input current limiting and shaping network limits the impact current at the wire harness side, avoids damaging subsequent devices by large current, performs preliminary shaping on the waveform of an input signal, and filters partial irregular interference signals; the photoelectric isolation device (optocoupler) electrically isolates the wire harness side from the MCU side, cuts off a coupling path of common-mode interference, and reduces the influence of interference on MCU signal identification; The MCU side pull-up network forms a stable default level through a pull-up resistor, so that false identification caused by level shift when no signal is input is avoided; the front-stage RC low-pass network is close to the optical coupler output node and is mainly used for inhibiting high-frequency burr signals from the wire harness side and primarily purifying the signals; the rear RC low-pass netw