A programmable timer, micro control unit and vehicle

By introducing event collection selectors and executors into timers, combining multiple trigger events and response schemes, the existing timer response single and resource occupancy problems are solved, achieving more efficient timer response and more precise control.

CN118689155BActive Publication Date: 2025-01-10CCORE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411159067.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2025-01-10
Estimated Expiration
2044-08-22

AI Technical Summary

Technical Problem

The existing timers have single response and triggering functions in automotive control applications, resulting in frequent intervention of processors, occupancy of resources, and reduced response accuracy, which is unable to meet the needs of high-speed and complex timing signal processing.

Method used

Design a programmable timer, including n-channel timer channels, each channel has an event collection selector and an actuator. The event collection selector triggers the trigger situation according to multiple preset trigger event detection modules, and the actuator executes a preset response Solution to reduce processor intervention and improve response speed and accuracy.

Benefits of technology

The trigger event collection and response is completed through hardware, reducing processor resource usage, improving timer response speed and control accuracy, implementing a variety of complex functions, and enriching timer triggering and response functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689155B_ABST
    Figure CN118689155B_ABST
Patent Text Reader

Abstract

The present invention discloses a programmable timer, a microcontroller unit and a vehicle, and relates to the field of power electronics technology. The programmable timer comprises: n timer channels; each timer channel comprises an event collection selector and an executor; the event collection selector in the i-th timer channel is used to determine an output event collection result according to the triggering conditions output by corresponding at least two different types of preset trigger event detection modules; the executor in the i-th timer channel is used to determine and execute a target response scheme corresponding to the event collection result when the event collection result comprises an event occurrence signal; the present invention can complete the collection and response of trigger events in a hardware manner through the setting of the event collection selector and the executor in each timer channel, thereby improving the response speed of the timer, reducing the occupation of processor resources, improving the control accuracy of the response time, and enriching the triggering and response functions of the timer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power electronics, and in particular to a programmable timer, a micro control unit and a vehicle. Background Art

[0002] A timer (or timer) is an electronic component that can generate a pulse signal at a certain time interval. It is widely used in timing, speed measurement, clock control and other equipment. In the design of MCU (Microcontroller Unit), multiple timing units are also added to achieve more accurate timing functions. Common timer designs include Figure 1 As shown in the figure, it is usually completed by a counter, a comparator and an actuator. After the counter is started, the counter increments automatically. After the comparison with the preset comparison value is passed, the actuator is activated to notify other modules to implement subsequent work, such as triggering an interrupt signal to notify the processor to intervene.

[0003] However, the response and trigger functions of common existing timers are relatively simple. They can only respond to one event, that is, the comparison between the counter and the preset comparison value. The trigger can only send an interrupt signal for the processor to process. In automotive control applications, there are a large number of high-speed and complex timing signal processing requirements, which requires frequent processor intervention during processing. For example, after each timer interrupt, the timer is reset, a new counter preset value is set, and the output port of the driver chip is driven by software methods. This processing solution will not only occupy a large amount of processor resources, resulting in a decrease in processor efficiency, but also reduce the response accuracy due to the uncontrollable processor interrupt response time. Therefore, how to enrich the trigger function of the timer, improve the response speed of the timer, reduce the occupation of processor resources, and improve the control accuracy of the response time is an urgent problem to be solved today. Summary of the invention

[0004] The purpose of the present invention is to provide a programmable timer, a microcontroller unit and a vehicle, so as to enrich the triggering function of the timer, improve the response speed of the timer, reduce the occupation of processor resources, and improve the control accuracy of the response time.

[0005] In order to solve the above technical problems, the present invention provides a programmable timer, comprising: n timer channels; each of the timer channels comprises an event collection selector and an executor; wherein n is a positive integer;

[0006] The event collection selector in the i-th timer channel is used to determine the output event collection result according to the trigger conditions output by the corresponding at least two different types of preset trigger event detection modules; wherein the preset trigger event detection module includes at least one of a counting comparison event detection module, an input signal comparison event detection module and a software trigger event detection module; i is a positive integer less than or equal to n;

[0007] The executor in the i-th timer channel is used to determine and execute a target response scheme corresponding to the event collection result when the event collection result includes an event occurrence signal; wherein the target response scheme is a programmable scheme in a preset response scheme library.

[0008] On the other hand, the counting comparison event detection module is used to compare the counting value of the target counter with the preset comparison value, and output the corresponding trigger situation; the input signal comparison event detection module is used to compare the input signal of the target port with the preset signal state, and output the corresponding trigger situation; the software trigger event detection module is used to output the corresponding trigger situation according to the detection result of the target software instruction.

[0009] On the other hand, the event collection selector in each of the timer channels includes at least two different types of preset trigger event detection modules corresponding to each other;

[0010] The event collection selector in the i-th timer channel is used to determine the output event collection result according to the trigger situation output by the target detection module; wherein the target detection module is a preset trigger event detection module in an enabled state among all preset trigger event detection modules in the i-th timer channel.

[0011] On the other hand, the event collection selector in the i-th timer channel includes: the count comparison event detection module, the input signal comparison event detection module, the software trigger event detection module, a first AND gate device, a second AND gate device and a third AND gate device, a first controllable switch, a second controllable switch, a third controllable switch and an event collection module;

[0012] Among them, the first input end of the first AND gate device is connected to the output end of the counting comparison event detection module, and the second input end of the first AND gate device is connected to one end of the first controllable switch; the first input end of the second AND gate device is connected to the output end of the input signal comparison event detection module, and the second input end of the second AND gate device is connected to one end of the second controllable switch; the first input end of the third AND gate device is connected to the output end of the software trigger event detection module, and the second input end of the third AND gate device is connected to one end of the third controllable switch; the output ends of the first AND gate device, the second AND gate device and the third AND gate device are all connected to the event collection module, and the event collection module is used to output corresponding event collection results according to the outputs of the first AND gate device, the second AND gate device and the third AND gate device.

[0013] On the other hand, the event collection selector in the i-th timer channel is used to determine that the output event collection result includes the event occurrence signal when the trigger condition output by any of the target detection modules is a trigger state;

[0014] Among them, the event collection selector in the i-th timer channel also includes an OR gate device, the output ends of the first AND gate device, the second AND gate device and the third AND gate device are respectively connected to one input end of the OR gate device, and the output end of the OR gate device is connected to the event collection module.

[0015] On the other hand, the executor in the i-th timer channel is used to determine the target solution index when the event collection result includes an event occurrence signal; search for the target response solution corresponding to the target solution index from the preset response solution library; and execute the target response solution.

[0016] On the other hand, when the event collection result includes an event occurrence signal, determining the target solution index includes:

[0017] When the event collection result is the event occurrence signal, the target solution index is obtained; wherein the target solution index is the solution index corresponding to the i-th timer channel.

[0018] On the other hand, n is greater than or equal to 2;

[0019] The event collection selector of the first timer channel is used to determine and output an event occurrence signal to the actuator outputting the first timer channel when the trigger condition output by the count comparison event detection module in the enabled state is a trigger state output when the count value of the target counter reaches a first pre-designed value;

[0020] The executor of the first timer channel is used to obtain and use the scheme index corresponding to the first timer channel to find a first programmable scheme from the preset response scheme library when receiving the event occurrence signal; in the process of executing the first programmable scheme, drive the first chip output port to output a low level, and modify the index target of the scheme index corresponding to the first timer channel to the second programmable scheme;

[0021] The event collection selector of the second timer channel is used to determine and output an event occurrence signal to the actuator outputting the second timer channel when the trigger condition output by the count comparison event detection module in the enabled state is the trigger state output when the counter of the target counter reaches the second pre-designed value;

[0022] The executor of the second timer channel is used to obtain and use the scheme index corresponding to the second timer channel to find the second programmable scheme from the preset response scheme library when receiving the event occurrence signal; in the process of executing the second programmable scheme, drive the second chip output port to output a high level, modify the index target of the scheme index corresponding to the second timer channel to the first programmable scheme, and send an interrupt signal to the processor, so that the processor updates the first pre-designed value to a third pre-designed value according to the interrupt signal, and updates the second pre-designed value to a fourth pre-designed value; wherein the third pre-designed value is greater than the fourth pre-designed value, greater than the second pre-designed value, and greater than the first pre-designed value, and the difference between the second pre-designed value and the first pre-designed value and the difference between the third pre-designed value and the fourth pre-designed value are both dead times of the power switching device.

[0023] In another aspect, executing the target response scheme includes:

[0024] Reset the target counter corresponding to the counting comparison event detection module; and / or modify the preset comparison value of the counting comparison event detection module; and / or modify the preset signal state of the input signal comparison event detection module; and / or modify the target scheme index; and / or modify the startup status of the preset trigger event detection module; and / or drive the target chip output port to output the target level signal; and / or record the current count value of the target counter; and / or send an interrupt signal to the processor.

[0025] The present invention also provides a micro control unit, comprising: the programmable timer as described above.

[0026] In addition, the present invention also provides a vehicle, comprising: the programmable timer as described above

[0027] A programmable timer provided by the present invention comprises: n timer channels; each timer channel comprises an event collection selector and an executor; wherein n is a positive integer; the event collection selector in the i-th timer channel is used to determine the output event collection result according to the triggering conditions output by the corresponding at least two different types of preset trigger event detection modules; wherein the preset trigger event detection module comprises at least one of a counting comparison event detection module, an input signal comparison event detection module and a software trigger event detection module; i is a positive integer less than or equal to n; the executor in the i-th timer channel is used to determine and execute the target response scheme corresponding to the event collection result when the event collection result comprises an event occurrence signal; wherein the target response scheme is a programmable scheme in a preset response scheme library.

[0028] It can be seen that the present invention can complete the collection and response of trigger events in hardware through the setting of event collection selectors and actuators in each timer channel, reduce the intervention process of the processor, improve the response speed of the timer, reduce the occupation of processor resources, and improve the control accuracy of the response time; and through the combination of at least two trigger events of each timer channel and programmable response schemes, it can realize a variety of more complex and practical functions, enriching the triggering and response functions of the timer. In addition, the present invention also provides a micro control unit and a vehicle, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0030] Figure 1 It is a structural diagram of a timer in the related art;

[0031] Figure 2 A structural block diagram of a programmable timer provided by an embodiment of the present invention;

[0032] Figure 3 A schematic diagram of the structure of another programmable timer provided by an embodiment of the present invention;

[0033] Figure 4 A result schematic diagram of an event collection selector provided by an embodiment of the present invention;

[0034] Figure 5 A schematic diagram of the execution process of a solution of an actuator provided by an embodiment of the present invention;

[0035] Figure 6 A signal display diagram of dead time control of a power switch device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] Please refer to Figure 2 , Figure 2 This is a structural block diagram of a programmable timer provided by an embodiment of the present invention. The programmable timer may include: n timer channels 10; each timer channel 10 includes an event collection selector 11 and an executor 12; wherein n is a positive integer;

[0038] The event collection selector 11 in the i-th timer channel 10 is used to determine the output event collection result according to the trigger conditions output by the corresponding at least two different types of preset trigger event detection modules; wherein the preset trigger event detection module includes at least one of a counting comparison event detection module, an input signal comparison event detection module and a software trigger event detection module; i is a positive integer less than or equal to n;

[0039] The executor 12 in the i-th timer channel 10 is used to determine and execute a target response scheme corresponding to the event collection result when the event collection result includes an event occurrence signal; wherein the target response scheme is a programmable scheme in a preset response scheme library.

[0040] It is understandable that if Figure 3 As shown, the programmable timer provided in this embodiment can be set with n timer channels 10 (channels 1-n), such as corresponding to the n conventional timers in the related art. Each timer channel 10 can include two parts, namely, an event collection selector 11 and an executor 12, that is, the output end of the event collection selector 11 in each timer channel 10 can be connected to the input end of the executor 12; the event collection selector 11 can output the corresponding event collection result to the connected executor 12 according to the triggering situation of the preset trigger event output by each corresponding at least two different types of preset trigger event detection modules, so that the executor 12 can read the corresponding programmable solution (i.e., target response solution) from the preset response solution library after the preset trigger event occurs (i.e., triggered), thereby completing the response processing of the event.

[0041] Among them, the preset trigger event detection module in this embodiment can be a module set in the event collection selector 11 for detecting the triggering status (such as the occurrence status or the non-occurrence status) of the corresponding event (i.e., the preset trigger event). The specific type of the preset trigger event detection module in this embodiment can be set by the designer according to the practical scenario and user needs. For example, the preset trigger event detection module can include at least one of the counting comparison event detection module, the input signal comparison event detection module, and the software trigger event detection module; that is, the type of preset trigger event that can be detected by the preset trigger event detection module can include at least one of the counting comparison event, the input signal comparison event, and the software trigger event; the preset trigger event detection module can also include a module for detecting other types of preset trigger events. As long as it is ensured that the event collection selector 11 in each timer channel 10 can obtain the triggering status output by at least two different types of preset trigger event detection modules, this embodiment does not impose any restrictions on this.

[0042] Correspondingly, the above-mentioned counting comparison event detection module can be used to detect counting comparison events, that is, to compare the counting value of the target counter with the preset comparison value, and output the corresponding triggering situation. For example, when the counting value of the target counter is equal to the preset comparison value, the output occurs (such as a high level); when the counting value of the target counter is not equal to the preset comparison value, the output does not occur (such as a low level); wherein the target counter can be a counter corresponding to the counting comparison event detection module.

[0043] Correspondingly, the above-mentioned input signal comparison event detection module can be used for input signal comparison events, that is, comparing the input signal of the target port with the preset signal state, and outputting the corresponding trigger situation; wherein, the target port can be the chip port corresponding to the counting comparison event detection module, and the preset signal state can include high level, low level, rising edge and / or falling edge; for example, the input signal comparison event detection module can output the occurrence state when a rising edge or a falling edge appears in the input signal of the target port; and output the non-occurrence state when no rising edge or a falling edge appears in the input signal of the target port.

[0044] Correspondingly, the above-mentioned software trigger event detection module can detect software trigger events, that is, output corresponding trigger conditions according to the detection results of target software instructions; wherein, the target software instructions can be preset software instructions corresponding to the counting comparison event detection module; for example, the input signal comparison event detection module can output an occurrence status when it detects that the processor (such as the processor of the MCU) uses the target software instructions; when it does not detect that the processor uses the target software instructions, it outputs a non-occurrence status.

[0045] It should be noted that the i-th timer channel 10 in this embodiment can be any timer channel 10 among the n timer channels 10. This embodiment is demonstrated by taking the event collection selector 11 and the executor 12 in the i-th timer channel 10 as an example. The other timer channels 10 in the n timer channels 10 can be set in the same or similar manner, and this embodiment does not impose any restrictions on this. For example, in some embodiments, in order to facilitate the setting of programmable timers, the event collection selector 11 in each timer channel 10 can be set with the same two or more preset trigger event detection modules, that is, the number and types of preset trigger event detection modules in the event collection selector 11 in the n timer channels 10 are the same, such as Figure 4 As shown, the event collection selector 11 in each timer channel 10 can be provided with a count comparison event detection module, an input signal comparison event detection module and a software trigger event detection module. The types and quantities of the preset trigger event detection modules in the event collection selector 11 in each timer channel 10 can also be different, and this embodiment does not impose any limitation on this.

[0046] Further, in this embodiment, the event collection selector 11 in each timer channel 10 may include at least two different types of preset trigger event detection modules corresponding to each other; the event collection selector 11 in the i-th timer channel 10 is used to determine the output event collection result according to the triggering condition output by the target detection module; wherein the target detection module is the preset trigger event detection module in the enabled state among all the preset trigger event detection modules in the i-th timer channel 10. That is, the event collection selector 11 in each timer channel 10 may determine the output event collection result according to the triggering condition output by the preset trigger event detection module in the enabled state among all the preset trigger event detection modules (i.e., the target detection module) of each respective preset trigger event detection module.

[0047] That is to say, in this embodiment, by configuring the enabling status (i.e., the started state and the not started state) of each preset trigger event detection module in the event collection selector 11 in each timer channel 10, the event collection selector 11 can determine its own final output event collection result according to the output status of each part of the preset trigger event detection module, thereby realizing flexible selection of events to be collected in the event collection selector 11 in each timer channel 10.

[0048] Correspondingly, the specific structure of the event collection selector 11 in each timer channel 10 in this embodiment can be set by the designer, for example, in order to facilitate the configuration of the enabled state of the preset trigger event detection module, such as Figure 4As shown, the event collection selector 11 in the i-th timer channel 10 (channel n) preferably includes: a counting comparison event detection module, an input signal comparison event detection module, a software trigger event detection module, a first AND gate device (A1), a second AND gate device (A2) and a third AND gate device (A3), a first controllable switch (switch 1), a second controllable switch (switch 2), a third controllable switch (switch 3) and an event collection module;

[0049] Among them, the first input end of the first AND gate device is connected to the output end of the counting comparison event detection module, and the second input end of the first AND gate device is connected to one end of the first controllable switch; the first input end of the second AND gate device is connected to the output end of the input signal comparison event detection module, and the second input end of the second AND gate device is connected to one end of the second controllable switch; the first input end of the third AND gate device is connected to the output end of the software trigger event detection module, and the second input end of the third AND gate device is connected to one end of the third controllable switch; the output ends of the first AND gate device, the second AND gate device and the third AND gate device are all connected to the event collection module, and the event collection module is used to output corresponding event collection results according to the outputs of the first AND gate device, the second AND gate device and the third AND gate device. That is to say, by controlling the on and off of the first controllable switch, the second controllable switch and the third controllable switch, the startup conditions of the count comparison event detection module, the input signal comparison event detection module and the software trigger event detection module can be configured accordingly; for example, when the first controllable switch is turned on, the count comparison event detection module can be used as a target detection module, that is, the first controllable switch can output the high level input at the other end to the second input end of the first AND gate device when it is turned on, so that the output of the first AND gate device is consistent with the output of the count comparison event detection module (that is, the triggering condition), such as when the count comparison event detection module outputs a high level (triggering state), the first AND gate device outputs a high level; when the count comparison event detection module outputs a low level (untriggered state), the first AND gate device outputs a low level.

[0050] Accordingly, this embodiment does not limit the specific manner in which the event collection selector 11 in the above-mentioned i-th timer channel 10 determines the output event collection result according to the triggering condition output by the target detection module. For example, the event collection selector 11 can determine that the output event collection result includes an event occurrence signal when the triggering condition output by any target detection module is in a triggering state, that is, when any target detection module in the event collection selector 11 outputs a triggering state, the event collection result including the event occurrence signal is output to the connected executor 12, so that the executor 12 executes the corresponding target response plan. The event collection selector 11 can also determine that the output event collection result includes an event occurrence signal when the triggering conditions output by all target detection modules are in a triggering state. This embodiment does not impose any limitation on this.

[0051] For example, when the triggering condition output by any target detection module is in the triggering state, the event collection selector 11 determines that the output event collection result includes an event occurrence signal. In some embodiments, Figure 4 As shown, the event collection selector 11 in the i-th timer channel 10 may also include an OR gate device (O1), and the output ends of the first AND gate device, the second AND gate device, and the third AND gate device are respectively connected to one input end of the OR gate device, and the output end of the OR gate device is connected to the event collection module. For example, when any of the first AND gate device, the second AND gate device, and the third AND gate device outputs a high level, the OR gate device can output a high level to the event collection module, so that the event collection module can determine that there is a target detection module with a triggering condition as a trigger state, and can output a corresponding event occurrence signal (such as a high level) to the actuator 12. Correspondingly, in other embodiments, the event collection module in the event collection selector 11 can directly use an OR gate device, that is, the output end of the OR gate device can be directly used as the output end of the event collection selector 11 and connected to the input end of the corresponding actuator 12.

[0052] It can be understood that, in the present embodiment, the executor 12 in each timer channel 10 can output an event collection result including an event occurrence signal of the event collection selector 11 connected to the input end, that is, when the event collection selector 11 collects a triggered event, it executes a corresponding programmable scheme (that is, the target response scheme) in the preset response scheme library to complete the response processing of the event.

[0053] Among them, the preset response scheme library in this embodiment can be a scheme library that is pre-set to store various programmable response schemes (i.e., programmable schemes). In this embodiment, each programmable scheme in the preset response scheme library can include one or more programming instructions; in the initialization stage, it can be written into the preset response scheme library by the processor or controller and shared by the n-way timer channels 10; accordingly, during the operation of the chip (such as MCU) where the programmable timer is located, the processor or controller of the chip can adjust the instructions according to the acquired scheme, and correspondingly add, delete or modify the programmable scheme of the preset response scheme library.

[0054] Correspondingly, for the executor 12 in the i-th timer channel 10 in this embodiment, when the event collection result includes an event occurrence signal, the specific method of determining and executing the target response scheme corresponding to the event collection result can be set by the designer according to the practical scenario and user needs. For example, the target response scheme can be searched by index. When the event collection result includes an event occurrence signal, the executor 12 in the i-th timer channel 10 can determine the target scheme index; search for the target response scheme corresponding to the target scheme index from the preset response scheme library; and execute the target response scheme. The target scheme index can be a scheme index currently used by the executor 12.

[0055] For example, when the event collection result only includes a signal indicating the occurrence of an event, that is, when the event collection result is an event occurrence signal (such as a high level) or an event non-occurrence signal (such as a low level), the target solution index may be the solution index corresponding to the i-th timer channel 10. In other words, when the event collection result includes an event occurrence signal, the process of determining the target solution index may include: when the event collection result is an event occurrence signal, obtaining the target solution index; wherein the target solution index is the solution index corresponding to the i-th timer channel 10. In other words, Figure 5 As shown, in this embodiment, a corresponding scheme index can be set in advance for each timer channel 10, so that when the executor 12 in each timer channel 10 receives an event occurrence signal, it can use the corresponding scheme index to index and search for a corresponding programmable scheme from all programmable schemes (schemes 1-m) in the preset response scheme library.

[0056] Correspondingly, if the event collection result also includes trigger event information, such as the identifier of the triggered event, or the identifier of the preset trigger event detection module that outputs the trigger state, the target solution index can be the solution index corresponding to the trigger event information. For example, a solution index corresponding to each preset trigger event detection module is set in advance for each timer channel 10, that is, at least two solution indexes can be set for each timer channel 10; the above process of determining the target solution index when the event collection result includes an event occurrence signal can include: when the event collection result includes an event occurrence signal, according to the trigger event information in the event collection result, the target solution index corresponding to the trigger event information is searched from the solution index corresponding to the i-th timer channel 10.

[0057] It should be noted that the specific solution content of the target response solution in this embodiment, that is, the specific solution content of each programmable solution in the preset response solution library, can be set by the designer according to practical scenarios and user needs. For example, the programmable solution can include any one or more of the following combinations: resetting the target counter of the counting comparison event, modifying the preset comparison value of the counting comparison event, modifying the preset signal state of the input signal comparison event, modifying the solution index, modifying the startup status of the preset trigger event detection module (such as adjusting the on-off state of the above-mentioned first controllable switch to the third controllable switch), driving the target chip output port to output a target level signal (such as a high level or a low level), recording the current count value of the target counter of the counting comparison event, and sending an interrupt signal to the processor. That is to say, the above-mentioned process of executing the target response scheme may include: resetting the target counter corresponding to the counting comparison event detection module; and / or, modifying the preset comparison value of the counting comparison event detection module; and / or, modifying the preset signal state of the input signal comparison event detection module; and / or, modifying the target scheme index; and / or, modifying the startup status of the preset trigger event detection module; and / or, driving the target chip output port to output the target level signal; and / or, recording the current count value of the target counter; and / or, sending an interrupt signal to the processor.

[0058] That is to say, in this embodiment, through the combination of at least two trigger events and programmable response schemes of each timer channel 10, a variety of relatively complex and practical functions can be realized. For example, only the input signal comparison event detection module of the i-th timer channel 10 is started, and the preset signal state is set to a rising edge or a falling edge, then the event collection selector 11 in the i-th timer channel 10 can output an event occurrence signal when the input signal of the target port is a rising edge or a falling edge; the executor 12 in the i-th timer channel 10 can use the scheme index (i.e., the target scheme index) of the i-th timer channel 10 to find the target response scheme in the preset response scheme library when receiving the event occurrence signal; if the target response scheme is the first scheme, then when executing the first scheme process, the current count value of the target counter is recorded, and the scheme index of the i-th timer channel 10 is modified to point to the second scheme; if the target response scheme is the second scheme, then when executing the second scheme process, the current count value of the target counter is recorded, and the difference between the latest recorded count value and the last recorded count value is calculated to obtain the pulse length of the input signal of the target port this time, thereby realizing the function of calculating the pulse length.

[0059] Accordingly, in some embodiments, only the count comparison event detection module of the i-th timer channel 10 can be started, a preset comparison value of the count comparison event detection module can be set, and the scheme index of the i-th timer channel 10 can be set to point to a programmable event that outputs a low level or a high level at the target chip output port, so that the executor 12 of the i-th timer channel 10 can control the target chip output port to output a signal with a specified period and duty cycle.

[0060] For example, the programmable timer provided in this embodiment can be applied to a motor control system using an inverter. When controlling the power switch devices (such as insulated gate bipolar transistors IGBTs) in the inverter to perform switching, in order to prevent the power switch devices of the upper and lower bridge arms from being turned on at the same time and causing a direct short circuit, a period of no output time (i.e., dead time) is added to the driving signal of the power switch devices. During this period of time, the power switch devices of the upper and lower bridge arms are in the off state to ensure safe switching.

[0061] In order to achieve the control of dead time, the programmable timer provided in this embodiment can be set with 2 or more timer channels 10; wherein, the 1st timer channel 10 and the 2nd timer channel 10 of the programmable timer can both use the count comparison event as the only event source, that is, the 1st timer channel 10 and the 2nd timer channel 10 can both only start one count comparison event detection module of each, and the target counters of these two count comparison event detection modules can select the same internal counter, which is in the self-increment mode. The event collection selector 11 of the first timer channel 10 can be used to determine and output an event occurrence signal to the executor 12 of the output of the first timer channel 10 when the trigger condition output by the count comparison event detection module in the enabled state is the trigger state output when the count value of the target counter reaches the first pre-designed value; the executor 12 of the first timer channel 10 is used to obtain and use the scheme index corresponding to the first timer channel 10 when receiving the event occurrence signal, and search for the first programmable scheme from the preset response scheme library; in the process of executing the first programmable scheme, drive the first chip output port to output a low level, and modify the index target of the scheme index corresponding to the first timer channel 10 to the second programmable scheme. The event collection selector 11 of the second timer channel 10 can be used to determine and output an event occurrence signal to the executor 12 of the output second timer channel 10 when the trigger condition output by the count comparison event detection module in the enabled state is the trigger state output when the counter of the target counter reaches the second pre-designed value; the executor 12 of the second timer channel 10 is used to obtain and use the scheme index corresponding to the second timer channel 10 when receiving the event occurrence signal, and find the second programmable scheme from the preset response scheme library; in the process of executing the second programmable scheme, drive the second chip output port to output a high level, and turn on the second timer channel The index target of the scheme index corresponding to channel 10 is modified to the first programmable scheme, and an interrupt signal is sent to the processor, so that the processor updates the first pre-designed value to the third pre-designed value according to the interrupt signal, and updates the second pre-designed value to the fourth pre-designed value; wherein the third pre-designed value is greater than the fourth pre-designed value, which is greater than the second pre-designed value, which is greater than the first pre-designed value, the difference between the second pre-designed value and the first pre-designed value and the difference between the third pre-designed value and the fourth pre-designed value are both dead times of the power switching device, and the first timer channel 10 and the second timer channel 10 can be two timer channels 10 in the programmable timer.

[0062] That is to say, Figure 4As shown, in the initial state, the preset comparison value of the count comparison event detection module in the enabled state in the first timer channel 10 can be configured as the first pre-designed value t1, the index target of the scheme index (i.e., the target scheme index) corresponding to the first timer channel 10 can be configured as the first programmable scheme, the preset comparison value of the count comparison event detection module in the enabled state in the second timer channel 10 can be configured as the second pre-designed value (t1+S), the index target of the scheme index (i.e., the target scheme index) corresponding to the second timer channel 10 is the second programmable scheme, t1 can be the first switch switching time, and S can be the dead time of the switch switching; after the actuator 12 in the first timer channel 10 receives the event occurrence signal when the count value of the target counter reaches the first pre-designed value t1, it uses the scheme index corresponding to the first timer channel 10 to find the first programmable scheme in the preset response scheme library, and executes the first programmable scheme to drive a chip output port a (i.e., the first chip output port) corresponding to the first timer channel 10 in the chip where the programmable timer is located to output a low level to drive the inverter The power switch device of the upper bridge arm in the inverter is modified, and the index target of the scheme index corresponding to the first timer channel 10 is modified to the second programmable scheme; after the actuator 12 in the second timer channel 10 receives the event occurrence signal when the count value of the target counter reaches the second pre-designed value (t1+S), the scheme index corresponding to the second timer channel 10 is used to find the second programmable scheme in the preset response scheme library, and the second programmable scheme is executed to drive a chip output port b (i.e., the second chip output port) corresponding to the second timer channel 10 in the chip where the programmable timer is located to output a high level to drive the power switch device of the lower bridge arm in the inverter, and the index target of the scheme index corresponding to the second timer channel 10 is modified to the first programmable scheme, and an interrupt signal is sent to the processor; so that the processor can update the preset comparison value in the first timer channel 10 to the third pre-designed value t2+S, and update the preset comparison value in the second timer channel 10 to the fourth pre-designed value t2 according to the demand, so as to realize the dead time configuration of the next switch switching, and t2 can be the second switch switching time. The above process can provide accurate control signals for the power switch devices of the upper and lower bridge arms in the inverter, and can set appropriate dead time according to actual device parameters, thereby improving the stability of the motor control system and reducing the oscillation of the transition process.

[0063] Correspondingly, in the above process, the second programmable scheme sends an interrupt signal to the processor to trigger the processor to update the preset comparison values ​​in the first timer channel 10 and the second timer channel 10, so that the processor can control the operation of the power switch device according to the demand; correspondingly, the actuator 12 can also complete the update of the preset comparison values ​​in the first timer channel 10 and the second timer channel 10 during the execution of the second programmable scheme or the first programmable scheme and the second programmable scheme. For example, the actuator 12 in the second timer channel 10 can drive the second chip output port to output a low level during the execution of the second programmable scheme, modify the index target of the scheme index corresponding to the second timer channel 10 to the first programmable scheme, and update the first pre-designed value to the third pre-designed value, and update the second pre-designed value to the fourth pre-designed value. This embodiment does not impose any restrictions on this.

[0064] In this embodiment, the embodiment of the present invention can complete the collection and response of trigger events in hardware through the setting of the event collection selector 11 and the executor 12 in each timer channel 10, thereby reducing the intervention process of the processor, improving the response speed of the timer, reducing the occupation of processor resources, and improving the control accuracy of the response time; and through the combination of at least two trigger events of each timer channel 10 and a programmable response scheme, a variety of more complex and practical functions can be realized, enriching the triggering and response functions of the timer.

[0065] Corresponding to the above programmable timer embodiment, the embodiment of the present invention further provides a micro control unit. The micro control unit described below and the programmable timer described above can refer to each other.

[0066] A microcontroller unit (MCU) includes: a programmable timer as provided in the above embodiment.

[0067] Correspondingly, the micro control unit provided in this embodiment may further include a processor.

[0068] Corresponding to the above micro control unit embodiment, the embodiment of the present invention further provides a vehicle. The vehicle described below and the micro control unit described above can correspond to each other.

[0069] A vehicle includes: a micro control unit as provided in the above embodiment.

[0070] The vehicle provided in this embodiment may specifically be a car.

[0071] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other. For the micro control unit and the vehicle disclosed in the embodiment, since they correspond to the programmable timer disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the system part description.

[0072] The above is a detailed introduction to a programmable timer, a microcontroller unit and a vehicle provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the present invention.

Claims

1. A programmable timer, characterized in that: include: n timer channels; Each of the timer channels includes an event collection selector and an executor; wherein n is a positive integer; The event collection selector in the i-th timer channel is used to determine the output event collection result according to the trigger conditions output by the corresponding at least two different types of preset trigger event detection modules; wherein the preset trigger event detection module includes at least one of a counting comparison event detection module, an input signal comparison event detection module and a software trigger event detection module; i is a positive integer less than or equal to n; The executor in the i-th timer channel is used to determine and execute a target response scheme corresponding to the event collection result when the event collection result includes an event occurrence signal; wherein the target response scheme is a programmable scheme in a preset response scheme library; The executing the target response scheme includes: sending an interrupt signal to a processor; The counting comparison event detection module is used to compare the counting value of the target counter with the preset comparison value and output the corresponding trigger situation; the input signal comparison event detection module is used to compare the input signal of the target port with the preset signal state and output the corresponding trigger situation; the software trigger event detection module is used to output the corresponding trigger situation according to the detection result of the target software instruction.

2. The programmable timer according to claim 1, characterized in that: The event collection selector in each of the timer channels includes at least two different types of preset trigger event detection modules corresponding to each other; The event collection selector in the i-th timer channel is used to determine the output event collection result according to the trigger situation output by the target detection module; wherein the target detection module is a preset trigger event detection module in an enabled state among all preset trigger event detection modules in the i-th timer channel.

3. The programmable timer according to claim 2, characterized in that: The event collection selector in the i-th timer channel comprises: the count comparison event detection module, the input signal comparison event detection module, the software trigger event detection module, a first AND gate device, a second AND gate device and a third AND gate device, a first controllable switch, a second controllable switch, a third controllable switch and an event collection module; Among them, the first input end of the first AND gate device is connected to the output end of the counting comparison event detection module, and the second input end of the first AND gate device is connected to one end of the first controllable switch; the first input end of the second AND gate device is connected to the output end of the input signal comparison event detection module, and the second input end of the second AND gate device is connected to one end of the second controllable switch; the first input end of the third AND gate device is connected to the output end of the software trigger event detection module, and the second input end of the third AND gate device is connected to one end of the third controllable switch; the output ends of the first AND gate device, the second AND gate device and the third AND gate device are all connected to the event collection module, and the event collection module is used to output corresponding event collection results according to the outputs of the first AND gate device, the second AND gate device and the third AND gate device.

4. The programmable timer according to claim 3, characterized in that: The event collection selector in the i-th timer channel is used to determine that the output event collection result includes the event occurrence signal when the trigger condition output by any of the target detection modules is in the trigger state; Among them, the event collection selector in the i-th timer channel also includes an OR gate device, the output ends of the first AND gate device, the second AND gate device and the third AND gate device are respectively connected to one input end of the OR gate device, and the output end of the OR gate device is connected to the event collection module.

5. The programmable timer according to any one of claims 1 to 4, characterized in that: The executor in the i-th timer channel is used to determine the target solution index when the event collection result includes an event occurrence signal; and search the target response solution corresponding to the target solution index from the preset response solution library; The targeted response plan is executed.

6. The programmable timer according to claim 5, characterized in that: When the event collection result includes an event occurrence signal, determining the target solution index includes: When the event collection result is the event occurrence signal, the target solution index is obtained; wherein the target solution index is the solution index corresponding to the i-th timer channel.

7. The programmable timer according to claim 6, characterized in that: n is greater than or equal to 2; The event collection selector of the first timer channel is used to determine and output an event occurrence signal to the actuator outputting the first timer channel when the trigger condition output by the count comparison event detection module in the enabled state is a trigger state output when the count value of the target counter reaches a first pre-designed value; The executor of the first timer channel is used to obtain and use the solution index corresponding to the first timer channel to find the first programmable solution from the preset response solution library when receiving the event occurrence signal; In the process of executing the first programmable scheme, the first chip output port is driven to output a low level, and the index target of the scheme index corresponding to the first timer channel is modified to the second programmable scheme; The event collection selector of the second timer channel is used to determine and output an event occurrence signal to the actuator outputting the second timer channel when the trigger condition output by the count comparison event detection module in the enabled state is the trigger state output when the counter of the target counter reaches the second pre-designed value; The executor of the second timer channel is used to obtain and use the solution index corresponding to the second timer channel to find a second programmable solution from the preset response solution library when receiving the event occurrence signal; During the execution of the second programmable scheme, the second chip output port is driven to output a high level, the index target of the scheme index corresponding to the second timer channel is modified to the first programmable scheme, and an interrupt signal is sent to the processor, so that the processor updates the first pre-designed value to a third pre-designed value according to the interrupt signal, and updates the second pre-designed value to a fourth pre-designed value; wherein the third pre-designed value is greater than the fourth pre-designed value, greater than the second pre-designed value, greater than the first pre-designed value, and the difference between the second pre-designed value and the first pre-designed value and the difference between the third pre-designed value and the fourth pre-designed value are both dead times of the power switching device.

8. The programmable timer according to claim 6, characterized in that: The executing the target response scheme further includes: Reset the target counter corresponding to the counting comparison event detection module; and / or modify the preset comparison value of the counting comparison event detection module; and / or modify the preset signal state of the input signal comparison event detection module; and / or modify the target scheme index; and / or modify the startup status of the preset trigger event detection module; and / or drive the target chip output port to output the target level signal; and / or record the current count value of the target counter.

9. A micro control unit, characterized in that: include: A programmable timer as claimed in any one of claims 1 to 8.

10. A vehicle, characterized in that: include: A programmable timer as claimed in claim 9.

Citation Information

Patent Citations

  • Interrupt control method, interrupt controller, computer equipment and storage medium

    CN110851259A