Application and Research of Single Chip Microcomputer Multi-interrupt Processing Technology

Publisher:文江桂青Latest update time:2012-05-25 Source: 维库开发网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

With the development of microelectronics technology and computer technology, the original electrical equipment, which was mainly based on strong electricity and electrical appliances and had simple functions, has developed into a new type of microelectronic equipment that combines strong and weak electricity, has digital characteristics and complete functions. In many occasions, more and more single-chip microcomputer products have replaced traditional electrical control products. The single-chip microcomputer that belongs to the stored program control realizes its control function through software instructions, and its hardware configuration is also variable and changeable. Therefore, once the production process changes, there is no need to redesign the line connection installation, which is conducive to product upgrading and order-based production.

Various control signals used in traditional electrical equipment must be converted into digital signals that match the input/output ports of the single-chip microcomputer. The user equipment must input various control signals to the single-chip microcomputer, such as limit switches, operating buttons, selection switches, travel switches, and other switch quantities output by sensors , etc., and convert them into signals that the single-chip microcomputer can receive and process through the input circuit. The output circuit should convert and amplify the weak current control signal sent by the single-chip microcomputer to the strong output signal required on site to drive the actuators of the controlled equipment such as power tubes, solenoid valves, relays, contactors, motors, etc., which can facilitate the use of actual control systems.

1 Input circuit design

Generally, the input signal will eventually be input to the single-chip microcomputer in the form of a switch. According to engineering experience, the switch input control command effective state is much better with a low level than a high level, as shown in Figure 1. When the switch S1 is pressed, the command signal issued is a low level, and when the switch S1 is not pressed, the level output to the single-chip microcomputer is a high level. This method has a strong noise resistance ability.

If we consider that the TTL level voltage is low and is easily interfered by the outside world during long-distance transmission, we can increase the input signal to +24 V and convert the high voltage signal into a TTL signal at the entrance of the microcontroller. This high voltage transmission method not only improves the noise resistance, but also makes the switch contact good and reliable, as shown in Figure 2. Among them, D1 is a protection diode with a reverse voltage of ≥50 V.

In order to prevent external spike interference and static electricity from damaging the input pins, pulse-proof diodes can be added to the input end to form a resistor bidirectional protection circuit, as shown in Figure 3. The forward conduction voltage drop UF≈0.7 V of diodes D1, D2, and D3, and the reverse breakdown voltage UBR≈30 V. No matter what polarity of the destructive voltage appears at the input end, the protection circuit can limit the amplitude of the voltage to the range that the input end can withstand. That is: when a positive pulse appears in VI~VCC, D1 conducts forward; when a negative pulse appears in V1~VCC, D2 breaks down in reverse; when a positive pulse appears between VI and ground, D2 breaks down in reverse; when a negative pulse appears between V1 and ground, D3 conducts forward, and the diode plays a clamping protection role. The buffer resistor RS is about 1.5~2.5kΩ, and forms an integral circuit with the input capacitor C, which delays the external induced voltage for a period of time. If the interference voltage exists for less than t, the effective voltage borne by the input end will be much lower than its amplitude; if the time is longer, D1 is turned on. The current forms a certain voltage drop on RS, thereby reducing the input voltage value.

In addition, a commonly used input method is to use an optocoupler isolation circuit. As shown in Figure 4, R is the input current limiting resistor, which limits the current of the light-emitting diode in the optocoupler to 10-20 mA. The input end is coupled by optical signals and is electrically completely isolated. At the same time, the forward impedance of the light-emitting diode is low, while the internal resistance of the external interference source is generally high. According to the voltage division principle, the interference noise that the interference source can feed to the input end is very small, and no ground interference or other crosstalk will be generated , which enhances the anti-interference ability of the circuit.

Under the premise of meeting the functional requirements, the simplest solution to improve the reliability of the microcontroller input terminal is to connect a capacitor in parallel between the input terminal and the ground to absorb interference pulses, or to connect a metal film resistor in series to limit the peak current flowing into the port.

2 Output circuit design

The output port of the microcontroller is limited by the driving capability, and generally requires a dedicated interface chip. Although its output varies greatly depending on the control object, it generally meets the requirements for output voltage, current, switching frequency, waveform rise and fall rate, and isolation and anti-interference. Here we discuss several typical circuit implementation methods from the output end of the microcontroller to the power end.

2.1 Direct coupling

In a direct-coupled output circuit, avoid the circuit shown in Figure 5.

[page]

During the period when T1 is turned off and T2 is turned on, in order to provide enough base current for T2, the resistance of R2 must be very small. Because T2 works in emitter follower mode, in order to reduce T2 loss, the voltage drop between collector and emitter must be controlled within a small range. In this way, the voltage between collector and base is also very small, and the resistance of resistor R2 is very small to provide enough base current. If the resistance of R2 is too large, it will greatly increase the voltage drop of T2, causing serious heating of T2. During the period when L2 is turned off, T1 must be turned on, and the high voltage +15 V will all drop on resistor R2, generating a large current, which is obviously unreasonable. In addition, the conduction of T1 will cause the high-level output of the microcontroller to be pulled down to near the ground potential, causing the output end to be unstable. The base of T2 is pulled to the ground potential by T1. If it is connected to an inductive load, due to the effect of the winding back electromotive force, the emitter of T2 may have a high level, which is easy to cause the base-emitter junction of T2 to reverse breakdown.

Figure 6 is a direct coupled output circuit, which is composed of T1 and T2 to form a coupling circuit to drive T3. When T1 is turned on, current is generated in the series circuit of R3 and R4. The voltage division on R3 is greater than the base-emitter junction voltage drop of the T2 transistor, which causes T2 to turn on. T2 provides the base current of the power tube T3, making T3 turn on. When the input of T1 is at a low level, T1 is turned off, the voltage drop on R3 is zero, T2 is turned off, and finally T3 is turned off. The role of R5 is: on the one hand, it acts as a load on the collector of T2, and on the other hand, when T2 is turned off, the charge stored in the base of T3 can be quickly released through the resistor R3, which speeds up the cut-off speed of T3 and helps to reduce losses.

2.2 TTL or CMOS device coupling

If the microcontroller outputs through TTL or CMOS chip, open collector devices are generally used, as shown in Figure 7(a). The open collector device is connected to the +15 V power supply through the collector load resistor R1, which increases the driving voltage. However, it should be noted that the switching speed of this circuit is low. If it is used to directly drive the power tube, when the subsequent circuit has an inductive load, due to the phase relationship of the power tube, it will affect the waveform rise time, resulting in increased dynamic loss of the power tube.

In order to improve the switching speed, two improved output circuits can be used, as shown in Figure 7(b) and Figure 7(c). Figure 7(b) is an improved circuit that can be turned on quickly. When the TTL output is high, the output point obtains voltage and current through transistor T1, and the charging capacity is improved, thereby speeding up the turning-on speed and reducing the power consumption of the collector open-circuit TTL device. Figure 7(c) is a push-pull improved circuit. The use of this circuit can not only increase the speed of turning on, but also increase the speed of turning off. The output transistor T1 works as an emitter follower and will not be saturated, so it does not affect the output switching frequency.

2.3 Pulse transformer coupling

The pulse transformer is a typical electromagnetic isolation component. The switching signal output by the microcontroller is converted into a high-frequency carrier signal, which is coupled to the output stage through the pulse transformer. Since there is no circuit connection between the primary and secondary coils of the pulse transformer, the output is a floating signal, which can be directly coupled with strong electrical components such as power tubes, as shown in Figure 8.

This circuit must have a pulse source. The frequency of the pulse source is the carrier frequency, which should be at least 10 times higher than the output frequency of the single-chip microcomputer. The output pulse of the pulse source is sent to the control gate G, and the output signal of the single-chip microcomputer is input into the G gate from the other end. When the single-chip microcomputer outputs a high level, the G gate opens, and the output pulse enters the transformer. The secondary coil of the transformer outputs a pulse with the same frequency as the primary side, which is filtered and restored to a switch signal after detection by the two-diode D1 and D2, and sent to the power tube. When the single-chip microcomputer outputs a low level, the G gate is closed, the pulse source cannot enter the transformer through the G gate, and the transformer has no output.

Here, the transformer transmits both signals and energy, which increases the frequency of the pulse source and helps reduce the weight of the transformer. Since the transformer can adapt to different driving power requirements by adjusting the inductance, the number of primary and secondary turns, etc., it is more flexible to use. More importantly, there is no electrical connection between the primary and secondary coils of the transformer, and the output signal of the secondary coil can float with the voltage of the power component and is not affected by the size of its power supply.

When the microcontroller outputs a higher frequency pulse signal, the pulse source and G gate can be omitted, and appropriate adjustments can be made to the primary and secondary circuits of the transformer.

2.4 Photoelectric coupling

Optocouplers can transmit linear signals as well as switching signals. They are mainly used to transmit switching signals when used at the output stage. As shown in Figure 9, the microcontroller output control signal is amplified by buffer 7407 and then sent to the optocoupler. R2 is the load resistor of the optocoupler output transistor. Its selection should ensure that: when the optocoupler is turned on, its output transistor is reliably saturated; and when the optocoupler is turned off, Tl is reliably saturated. However, due to the slow response speed of the optocoupler, the switch delay time is prolonged, which limits its frequency of use.

Conclusion

The single-chip microcomputer interface technology is introduced in detail in many documents, but in the modification and design of a large number of electrical control products, problems that cannot be solved by interface chips (such as large driving current, slow switching speed, poor anti-interference, etc.) are often encountered, so another circuit solution must be sought. The above-mentioned input/output circuits have been widely used and have shown that they have high engineering practical value for reasonably and reliably realizing the single-chip microcomputer electrical control system.

Reference address:Application and Research of Single Chip Microcomputer Multi-interrupt Processing Technology

Previous article:Reliability Design of Single Chip Microcomputer Reset Circuit
Next article:Design of peripheral circuit of single chip microcomputer based on frequency conversion control system

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号