Indicator lamp control method suitable for bare MCU

By setting the threshold T for the task of the naked MCU and adjusting the indicator state using the inverse function, the problem that the naked MCU indicator cannot reflect the busyness is solved, and more flexible indicator light control is achieved, enhancing the human-computer interaction perception effect, and Maintains the compactness and flexibility of resources.

CN119233497APending Publication Date: 2024-12-31GUANGDONG JATEN ROBOT & AUTOMATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310802351.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The indicator light of the naked MCU can only be simple to power on or flash regularly, which cannot effectively reflect the busyness of processing and reduce the human-computer interaction perception effect.

Method used

By setting the threshold T for each task and setting the inverse function in the main program, the task execution times are recorded, and the inverse function is executed when the threshold T is reached, the output signal is to adjust the status of the indicator light, so that the indicator light flashes the frequency reflects the busyness of the task , and adjust the threshold T according to the task weight and the data amount.

Benefits of technology

It realizes the judgment of the busyness of the MCU by the flashing frequency of the indicator light, enhances the human-computer interaction perception effect, and occupies small resources, does not use additional hardware resources, and has strong versatility and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119233497A_ABST
    Figure CN119233497A_ABST
Patent Text Reader

Abstract

The invention discloses an indicator light control method suitable for a bare MCU. The indicator light control method comprises the following steps: setting a threshold value T for each task; the main program is provided with a negation function used for controlling flicker of an indicating lamp, the number of times of execution of each task is recorded in a main loop, and when the number of times of each task reaches a threshold value T, the negation function is executed: a negation flag bit of each task is detected; when the negation flag bit is triggered, outputting a negation signal, and resetting the negation flag bit of the task; the indicating lamp circuit receives the negation signal and controls the indicating lamp to adjust the real-time state. Compared with the prior art, the method disclosed by the invention is small in occupied resource, does not additionally occupy any hardware resource of the MCU, and is convenient to transplant; the universality is good, and the expansibility is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of AGVs, and in particular to an indicator light control method suitable for a naked MCU. Background Art

[0002] With the vigorous development and wide application of robot technology, naked MCU has been increasingly used due to its flexible application, compact resources, no operating system, strong real-time performance and low cost. However, the indicator light reflecting the working status of the MCU can only be simple, such as long-on or timed flashing, because there is no resource manager of the operating system to do task statistics. It lacks flexibility and cannot effectively reflect the overall processing busyness of the naked MCU by flashing speed, which reduces the effect of human-computer interaction perception. Summary of the invention

[0003] The invention aims to solve the problem that the indicator light of the existing naked MCU can only be in a simple state of long light or timed flashing after power-on, and to provide an indicator light control method suitable for the naked MCU.

[0004] In order to achieve the above object, the present invention adopts the following technical solutions:

[0005] A method for controlling an indicator light of a naked MCU, comprising the following steps:

[0006] A threshold T is set for each task; the main program sets a negation function for controlling the flashing of the indicator light, and the number of times each task is executed is recorded in the main loop. When the number of times a task is executed reaches the threshold T, the negation function is executed: the negation flag of each task is detected; when the negation flag is triggered, a negation signal is output, and the negation flag of the task is reset; the indicator light circuit receives the negation signal, and the control indicator light adjusts the real-time state.

[0007] The method of the present invention sets a negation function and a corresponding threshold value T for each task. When a certain task reaches the corresponding threshold value T, the negation function is executed to adjust the state of the current indicator light. For example, if the indicator light state is originally off, the indicator light is lit once each time the negation function outputs a signal, or the original state of the indicator light is on, and the indicator light is turned off once each time a negation signal is received. The more tasks there are, the more times the indicator light flashes, so that the user can judge the busyness of the MCU by the flashing frequency of the indicator light. Compared with the prior art, the method of the present invention occupies less resources, does not occupy any additional hardware resources of the MCU, and is convenient for transplantation; it has good versatility and strong expansibility.

[0008] Furthermore, the threshold T of each task is set according to the weight of the task, and the threshold T of each task is inversely proportional to its weight. That is, the threshold T is set according to the importance of the task, and the greater the weight of the task, the smaller the threshold T, and vice versa. In this way, the more important the task, the greater the impact on the indicator light state change, while irrelevant tasks have little impact on the indicator light state.

[0009] Furthermore, each task is divided into levels according to weight, and a corresponding weight setting weight coefficient is set, and the threshold T=k / n, where K is a constant and n is a weight coefficient.

[0010] Furthermore, the threshold T of the task is adjusted according to the reference value m of the amount of data contained in the task. The larger the reference value m, the smaller the threshold T. The threshold T = k / nf / m, where f is a constant. It should be noted that the reference value in this solution is a reference value of the data contained in the task, and the actual value may be greater than or less than the reference value, while f is a constant obtained based on experimental data.

[0011] Furthermore, the tasks include tasks of the main program and tasks of the interrupt function. In this solution, the task of setting the threshold value includes all tasks executed by the MCU, including tasks of the main program and tasks in the interrupt function. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 The steps of the method of the present invention are briefly described as follows: Figure 1 ;

[0013] Figure 2 The steps of the present invention are as follows: Figure 2 . DETAILED DESCRIPTION

[0014] See also Figure 1 As shown, the present invention discloses an indicator light control method applicable to a naked MCU, comprising the following steps:

[0015] Set a threshold T for each task;

[0016] That is, a threshold T of the number of execution times is set for each task. The higher the frequency of execution of the task, the faster the threshold T is reached. Therefore, the MCU can judge the frequency of execution of a task by whether it reaches the threshold T.

[0017] The main program sets the inversion function used to control the flashing of the indicator light.

[0018] That is, by setting the negation function, each task will execute the negation function after reaching the threshold T to control the indicator light state;

[0019] In the main loop, the number of times each task is executed is recorded. When the number of times a task is executed reaches the threshold T, the inverse function is executed:

[0020] Check the inverted flag of each task;

[0021] When the inversion flag is triggered, the inversion signal is output and the inversion flag of the task is reset;

[0022] The indicator light circuit receives the inverted signal and controls the indicator light to adjust the real-time status.

[0023] See also Figure 2 As shown in the figure, after the device is initialized, the task times of each task are recorded. For example, when recording the task 1 of the main loop, when the main loop program is executed once, the count value is increased by 1. When the calculated value increases to the threshold a of task 1, the count value of task 1 is reset to 0, and a negation signal is output. For example, when recording the task 2 of the interrupt function, task 2 needs to send data to the MCU through serial port 2. Whenever serial port 2 receives data and the MCU enters the interrupt program, the MUC adds 1 to the count value of task 2 after processing the data. When the threshold e of task 2 is reached, the count value of task 2 is reset to 0, and a negation signal is output.

[0024] According to further optimization of the above scheme, the threshold T of each task is set according to the weight of the task, and the threshold T of each task is inversely proportional to its weight.

[0025] According to the further optimization of the above scheme, each task is divided into levels according to the weight, and the corresponding weight setting weight coefficient is set, and the threshold T = k / n, where K is a constant and n is a weight coefficient. If there are five tasks a, b, c, d, and e, and the weight order is a>b>c>d>e, then the weight coefficient is a>b>c>d>e, k is a constant obtained from experimental data, and is a positive integer, and the threshold obtained according to the formula should be a<b<c<d<e.

[0026] According to further optimization of the above scheme, the threshold T of the task is adjusted according to the data volume of the task. The larger the data volume, the smaller the threshold. In this scheme, the threshold of each task is adjusted according to the data volume contained in each task, so that its final value is more accurate.

[0027] According to the further optimization of the above scheme, the threshold T of the task is adjusted according to the benchmark value m of the amount of data contained in the task. The larger the benchmark value m, the smaller the threshold T. The threshold T = k / nf / m, where f is a constant. It should be noted that the benchmark value in this scheme is the reference value of the data contained in the task, and the actual value may be greater than or less than the benchmark value, while f is a constant obtained based on experimental data.

[0028] Furthermore, the tasks include tasks of the main program and tasks of the interrupt function.

[0029] The method of the present invention sets a negation function and a corresponding threshold value T for each task. When a task reaches the corresponding threshold value T, the negation function is executed to adjust the state of the current indicator light. For example, if the indicator light state is originally off, the indicator light is lit once each time the negation function outputs a signal, or the original state of the indicator light is on, and the indicator light is turned off once each time the negation signal is received. The more tasks there are, the more times the indicator light flashes, so that the user can judge the busyness of the MCU by the flashing frequency of the indicator light.

[0030] According to the disclosure and teaching of the above description, those skilled in the art to which the present invention belongs may also change and modify the above implementation mode. Therefore, the present invention is not limited to the specific implementation mode disclosed and described above, and some modifications and changes to the present invention should also fall within the protection scope of the claims of the present invention. In addition, although some specific terms are used in this specification, these terms are only for the convenience of description and do not constitute any limitation to the present invention.

Claims

1. A method for controlling an indicator light of a naked MCU, characterized in that: The following steps are involved: Set a threshold T for each task; The main program sets the negation function used to control the flashing of the indicator light; In the main loop, the number of times each task is executed is recorded. When the number of times a task is executed reaches the threshold T, the inverse function is executed: Check the inverted flag of each task; When the inversion flag is triggered, the inversion signal is output and the inversion flag of the task is reset; The indicator light circuit receives the inverted signal and controls the indicator light to adjust the real-time status.

2. The method according to claim 1, characterized in that: The threshold T of each task is set according to its weight, and the threshold T of each task is inversely proportional to its weight.

3. The method according to claim 1, characterized in that: The tasks are divided into levels according to weights, and corresponding weights are set to set weight coefficients, and the threshold T=k / n, where K is a constant and n is a weight coefficient.

4. The method according to claim 1, characterized in that: The threshold T of the task is adjusted according to the reference value m of the amount of data contained in the task. The larger the reference value m is, the smaller the threshold T is. The threshold T=k / nf / m, where f is a constant and m is a reference value.

5. The method according to claim 1, characterized in that: The tasks include main program tasks and interrupt function tasks.