CN114860052A - Program execution judging method, device, equipment and readable storage medium - Google Patents

Program execution judging method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN114860052A
CN114860052A CN202210474719.3A CN202210474719A CN114860052A CN 114860052 A CN114860052 A CN 114860052A CN 202210474719 A CN202210474719 A CN 202210474719A CN 114860052 A CN114860052 A CN 114860052A
Authority
CN
China
Prior art keywords
reset
power
program
preset
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210474719.3A
Other languages
Chinese (zh)
Other versions
CN114860052B (en
Inventor
何英
沈成宇
曹楷
刘建永
侯敏
曹辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Ruipu Energy Co Ltd
Original Assignee
Shanghai Ruipu Energy Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Ruipu Energy Co Ltd filed Critical Shanghai Ruipu Energy Co Ltd
Priority to CN202210474719.3A priority Critical patent/CN114860052B/en
Publication of CN114860052A publication Critical patent/CN114860052A/en
Application granted granted Critical
Publication of CN114860052B publication Critical patent/CN114860052B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/24Resetting means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Abstract

The invention provides a method, a device and a device for judging program execution and a readable storage medium, wherein the method for judging program execution comprises the following steps: when the electric control unit is reset, judging whether a variable value in a preset area is an effective value, wherein the variable value is a non-effective value when the electric control unit is powered on and reset and does not execute the function of a preset program, and the variable value is an effective value when the electric control unit is powered on and reset and executes the function of the preset program; and if the variable value in the preset area is an effective value, and the power-on reset mark and the low-voltage detection mark of the reset register are both first characters, the preset program function is not executed, wherein the preset program function is a function which is only executed once in a single power-on period. The invention can ensure that the electric control unit reasonably executes the function of the preset program when the non-power-on reset occurs, and when the preset area is arranged in the random access memory, the speed of reading and writing the variable value of the preset area is faster and more efficient, and the failure rate is lower.

Description

Program execution judging method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for determining program execution.
Background
Various resets can occur to the electronic control unit in the electronic product because of software and hardware design defects or the external environment is bad in the use process, namely the electronic product is suddenly re-executed from the starting function when executing the normal function. The reset type comprises power-on reset and non-power-on reset. The initial state of the electronic product from shutdown and power failure to restart and power on is power-on reset, and the power-off reset of other power supplies except the power-on reset is non-power-on reset. Some functions of the electronic control unit are executed only once when the electronic control unit is powered on and reset to execute the initialization function in a single power-on period from power-on to power-off of the electronic product, and the functions are used as preset program functions.
But the current situation is: in a single power-on period, when the electronic control unit executes a normal function, the reset occurs for any reason, including power-on reset and non-power-on reset, the electronic control unit starts to execute again from an initialization function after starting, that is, the preset program function is executed again no matter whether the electronic control unit executes the preset program function. If the electronic control unit has executed such a predetermined program function, then executing the predetermined program function again may cause a problem. For example:
(1) some sensors, such as current sensors, have zero offset characteristics, and therefore require a zero calibration function to obtain a more accurate signal value, which needs to be performed only once during a single power-on cycle. When the input signal to be measured of the current sensor is in an initial state, a zero calibration function is executed, the average value of a plurality of times of measured values of the current sensor is used as the current zero offset value of the power-on period under the condition that the measured values are reasonable, and after the input signal to be measured of the current sensor is in an effective state, the current zero offset value is subtracted from the measured value of the current sensor to be used as the final current effective value.
The power supply of the current sensor and the current signal to be detected comes from a key signal, the power-on reset of the electronic control unit can occur only after the key signal is disconnected for a certain time, the power-on reset can cause the power failure of the current sensor and the current signal to be detected, and the power failure of the current sensor and the current signal to be detected can not be caused by the non-power-on reset.
When the electric control unit is reset without power supply, the electric control unit can execute the current sensor zero calibration once no matter whether the current zero calibration function is executed or not. And at the moment, whether the current zero calibration function is executed or not can not be distinguished when the non-power-on reset of the electric control unit occurs. If the current zero calibration function is executed once in this case, the actually read zero calibration value may be the current value of the current sensor normally supplying power, and using this wrong zero calibration value may cause a current value error calculated later.
(2) The existing faults of the electronic product in each power-on period need to be acquired so as to be used for analyzing the fault change conditions of a controller, an actuator or a sensor in a new power-on period, and the program function of acquiring the existing faults of the electronic product only needs to be executed once in a single power-on period.
When the electronic control unit is subjected to non-power-on reset, the electronic control unit executes the function of acquiring the fault of the electronic product once no matter whether the function of acquiring the fault of the electronic product is executed. If the function of acquiring the existing faults of the electronic product is executed once under the condition, when the fault change conditions of a controller, an actuator or a sensor and the like in a new power-on period are analyzed subsequently, the fault condition acquired by the last reset before the power failure in the power-on period is compared with the adjacent power-on period, the obtained faults are not the initial fault set in the power-on period, but the fault set after the electric control unit operates for a section after the power-on, and new faults or certain faults are possibly generated between the power-on period and the reset period and are recovered to be normal. That is, when non-power-on reset occurs in a single power-on cycle, the fault set will be read again and cover the fault set during power-on reset in the power-on cycle, resulting in an erroneous determination result.
Disclosure of Invention
The invention mainly aims to provide a method, a device and equipment for judging program execution and a readable storage medium, and aims to solve the technical problem that in the prior art, when an electronic control unit normally executes functions, non-power-on reset occurs, and reasonable execution of some program functions cannot be guaranteed.
In a first aspect, the present invention provides a method for determining program execution, including:
when the electric control unit is reset, judging whether a variable value in a preset area is an effective value, wherein the variable value is a non-effective value when the electric control unit is powered on and reset and does not execute the function of a preset program, and the variable value is an effective value when the electric control unit is powered on and reset and executes the function of the preset program;
and if the variable value in the preset area is an effective value, and the power-on reset mark and the low-voltage detection mark of the reset register are both first characters, the preset program function is not executed, wherein the preset program function is a function which is only executed once in a single power-on period.
Optionally, after determining whether the variable value in the preset area is a valid value:
if the variable value in the preset area is an effective value, the power-on reset mark of the reset register is a second character and the low-voltage detection mark is a first character, the function of the preset program is not executed, and the time sequence error is recorded.
Optionally, after determining whether the variable value in the preset area is a valid value:
if the variable value in the preset area is an effective value, the power-on reset mark of the reset register is a first character and the low-voltage detection mark is a second character, the function of the preset program is not executed, and the low-voltage detection mark is set as the first character.
Optionally, after determining whether the variable value in the preset area is a valid value:
if the variable value in the preset area is an effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both second characters, the function of the preset program is not executed, the power-on reset mark is set as a first character, and the low-voltage detection mark is set as a first character.
Optionally, after determining whether the variable value in the preset area is a valid value:
if the variable value in the preset area is a non-effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both second characters, executing a preset program function;
setting the variable value in the preset area as an effective value, setting the power-on reset mark as a first character, and setting the low-voltage detection mark as the first character.
Optionally, after determining whether the variable value in the preset area is a valid value:
and if the variable value in the preset area is a non-effective value and the power-on reset mark of the reset register is a first character, the function of the preset program is not executed, and the random access memory error is recorded.
Optionally, the preset area is further specifically configured to store a state of the electronic control unit in each power-on period.
In a second aspect, the present invention also provides a device for determining program execution, where the device for determining program execution includes:
the judging module is used for judging whether a variable value in a preset area is an effective value or not when the electric control unit is reset, wherein the variable value is an ineffective value when the electric control unit is powered on and reset and does not execute the preset program function, and the variable value is an effective value when the electric control unit is powered on and reset and executes the preset program function;
and the control module is used for not executing a preset program function if the variable value in the preset area is an effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both first characters, wherein the preset program function is a function which only needs to be executed once in a single power-on period.
Optionally, the control module is further specifically configured to:
if the variable value in the preset area is an effective value, the power-on reset mark of the reset register is a second character and the low-voltage detection mark is a first character, the function of a preset program is not executed, and the time sequence error is recorded.
Optionally, the control module is further specifically configured to:
if the variable value in the preset area is an effective value, the power-on reset mark of the reset register is a first character and the low-voltage detection mark is a second character, the function of the preset program is not executed, and the low-voltage detection mark is set as the first character.
Optionally, the control module is further specifically configured to:
if the variable value in the preset area is an effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both second characters, the preset program function is not executed, the power-on reset mark is set as a first character, and the low-voltage detection mark is set as a first character.
Optionally, the control module is further specifically configured to:
if the variable value in the preset area is a non-effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both second characters, executing a preset program function;
setting the variable value in the preset area as an effective value, setting the power-on reset mark as a first character, and setting the low-voltage detection mark as the first character.
Optionally, the control module is further specifically configured to:
and if the variable value in the preset area is a non-effective value and the power-on reset mark of the reset register is a first character, the function of the preset program is not executed, and the random access memory error is recorded.
Optionally, the preset area is further specifically configured to store a state of the electronic control unit in each power-on period.
In a third aspect, the present invention further provides a program execution judging device, which includes a processor, a memory, and a program execution judging program stored in the memory and executable by the processor, wherein when the program execution judging program is executed by the processor, the steps of the program execution judging method as described above are implemented.
In a fourth aspect, the present invention further provides a readable storage medium, which stores a judgment program for program execution, wherein the judgment program for program execution realizes the steps of the judgment method for program execution as described above when executed by a processor.
The invention provides a method, a device and a device for judging program execution and a readable storage medium, wherein the method for judging program execution comprises the following steps: when the electric control unit is reset, judging whether a variable value in a preset area is an effective value, wherein the variable value is a non-effective value when the electric control unit is powered on and reset and does not execute the function of a preset program, and the variable value is an effective value when the electric control unit is powered on and reset and executes the function of the preset program; and if the variable value in the preset area is an effective value, and the power-on reset mark and the low-voltage detection mark of the reset register are both first characters, the preset program function is not executed, wherein the preset program function is a function which is only executed once in a single power-on period. The invention can ensure that the electric control unit reasonably executes the function of the preset program when the non-power-on reset occurs, and when the preset area is arranged in the random access memory, the speed of reading and writing the variable value of the preset area is faster, more efficient and lower in failure rate.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of a program execution judgment device according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a method for determining program execution according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a method for determining program execution according to the present invention;
FIG. 4 is a flowchart illustrating a third embodiment of a method for determining program execution according to the present invention;
FIG. 5 is a flowchart illustrating a fourth embodiment of a method for determining program execution according to the present invention;
FIG. 6 is a flowchart illustrating a fifth exemplary embodiment of a method for determining program execution according to the present invention;
FIG. 7 is a flowchart illustrating a sixth exemplary embodiment of a method for determining program execution according to the present invention;
fig. 8 is a functional block diagram of a determining apparatus for determining program execution according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In a first aspect, an embodiment of the present invention provides a device for determining program execution.
Referring to fig. 1, fig. 1 is a schematic diagram of a hardware structure of a determining apparatus for program execution according to an embodiment of the present invention. In this embodiment of the present invention, the device for determining program execution may include a processor 1001 (e.g., a Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used for realizing connection communication among the components; the user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WI-FI interface, WI-FI interface); the memory 1005 may be a Random Access Memory (RAM) or a non-volatile memory (non-volatile memory), such as a magnetic disk memory, and the memory 1005 may optionally be a storage device independent of the processor 1001. Those skilled in the art will appreciate that the hardware configuration depicted in FIG. 1 is not intended to be limiting of the present invention, and may include more or less components than those shown, or some components in combination, or a different arrangement of components.
With continued reference to fig. 1, a memory 1005, which is one type of computer storage medium in fig. 1, may include therein an operating system, a network communication module, a user interface module, and a program execution judgment program. The processor 1001 may call a judgment program executed by the program stored in the memory 1005, and execute the judgment method executed by the program according to the embodiment of the present invention.
In a second aspect, based on the problems in the prior art in the background art, in view of that if it can be distinguished whether such a preset program function has been executed once in a single power-on cycle, it can be distinguished whether such a preset program function needs to be re-executed when various resets occur, an embodiment of the present invention provides a method for determining program execution.
By using the RAM (random access memory) characteristic, a preset area for storing data is divided in the RAM. In general, data stored in a RAM area is cleared when a program is executed after reset whenever reset occurs regardless of whether power is lost when the data is stored in the RAM area. The start program is changed, and the data in the preset area cannot be cleared. And according to the characteristics of the RAM, the bytes of preset continuous addresses are taken by the preset area, the values are random after the power-on, and the value of the area is written into a specific value, such as a rept asc code value, after the function of a preset program is normally executed once. No matter when the power-on cycle is reset, if the variable value of the preset area is the valid value rept, the function of the preset program can be confirmed to be executed once, and the reset program does not need to be executed once again; if the variable value of the preset area is a random value of the non-effective value rept, it can be confirmed that the function of the preset program is not executed once, and the program needs to be executed once after reset. Meanwhile, compared with the method of storing the variable value in the nonvolatile memory, the method has the advantages of higher reading and writing speed, higher reading and writing efficiency and lower failure rate when the variable value is read and written from the preset area of the RAM.
Considering that the preset area is arranged in the RAM, and the RAM area has life limitation and failure, at this time, whether the RAM has failure can be determined by means of the power-on reset flag and the low-voltage detection flag, and if the RAM has failure, the judgment of whether to execute the preset program function based on the variable value of the preset area is also wrong. The power-on reset mark and the low-voltage detection mark are stored in a reset register, the execution of the program function is preset once in a single power-on period, namely after the rept asc code value is written, the power-on reset mark is firstly set as a first character by a software program, then the low-voltage detection mark is set as the first character, and the first character can be zero and equivalent.
Referring to fig. 2, in a first embodiment of the judging method of the program execution of the present invention, the judging method of the program execution includes:
step S1, when the electric control unit is reset, judging whether the variable value in the preset area is effective value, wherein the variable value is non-effective value when the electric control unit is power-on reset and does not execute the preset program function, and is effective value when the electric control unit is power-on reset and executes the preset program function;
in step S2, if the variable value in the preset area is an effective value and the power-on reset flag and the low-voltage detection flag of the reset register are both first characters, the preset program function is not executed, where the preset program function is a function that needs to be executed only once in a single power-on cycle.
In this embodiment, when the reset of the electronic control unit occurs, it is necessary to determine whether the variable value in the preset area is an effective value. The variable value is set to be a non-effective value when the preset program function is not executed after the electric control unit is powered on and reset, and is set to be an effective value when the preset program function is executed after the electric control unit is powered on and reset.
If the variable value in the preset area is an effective value, the reset is a non-power-on reset, and before the non-power-on reset occurs, the electric control unit executes the preset program function once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM in which the preset area is located is erroneous or not needs to be determined based on the power-on reset flag and the low-voltage detection flag of the reset register. If the power-on reset mark and the low-voltage mark of the reset register are both the first characters, the RAM where the preset area is located is normal, the electronic control unit determines that the preset program function is executed, and normally sets the power-on reset mark and the low-voltage detection mark as the first characters, so that the corresponding preset program function does not need to be executed again when the reset occurs, and the preset program function is ensured not to be repeatedly executed when the reset occurs, and problems are caused. Such as: if the preset program function is the zero calibration function of the current sensor, if the reset can be distinguished through the variable value and the mark after the zero calibration function is executed once in a single power-on period, the reset can not execute the zero calibration function once again, and the current value calculated later is wrong.
Further, referring to fig. 3, in the second embodiment, after the step S1, the method further includes:
in step S3, if the variable value in the preset area is an effective value, the power-on reset flag of the reset register is a second character and the low voltage detection flag is a first character, the preset program function is not executed, and a timing error is recorded.
In this embodiment, if the variable value in the preset area is an effective value when the reset of the electronic control unit occurs, the reset is a non-power-on reset, and before the non-power-on reset occurs, the electronic control unit has already executed the function of the preset program once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM in which the preset area is located is erroneous or not needs to be determined based on the power-on reset flag and the low-voltage detection flag of the reset register. When the execution of the preset program function is completed, after the variable value of the preset area is set to be the effective value, the power-on reset mark of the reset register is set to be the first character, and then the low-voltage detection mark of the reset register is set to be the first character. If the power-on reset mark of the reset register is the second character and the low-voltage detection mark is the first character, that is, the execution process sequence for setting the power-on reset mark and the low-voltage detection mark of the reset register as the first character is wrong, the reset register is wrong at this time, and whether the preset area of the RAM is wrong cannot be determined. Therefore, when the reset occurs, the preset program function does not need to be executed again, the time sequence error is recorded, and the reasonable execution of the preset program function is further ensured based on the reading of the power-on reset mark and the low-voltage detection mark of the reset register.
Further, referring to fig. 4, in the third embodiment, after the step S1, the method further includes:
in step S4, if the variable value in the preset area is the valid value, and the power-on reset flag of the reset register is the first character and the low voltage detection flag is the second character, the preset program function is not executed, and the low voltage detection flag is set as the first character.
In this embodiment, when the reset of the electronic control unit occurs, if the variable value in the preset area is an effective value, the reset is a non-power-on reset, and before the non-power-on reset occurs, the electronic control unit has already executed the preset program function once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM in which the preset area is located is erroneous or not needs to be determined based on the power-on reset flag of the reset register being set to the low-voltage detection flag. If the power-on reset mark of the reset register is a first character and the low-voltage detection mark is a second character, the RAM in which the preset area is located is normal, the electronic control unit determines that the preset program function is executed, but the power-on reset mark and the low-voltage detection mark are reset in the process of normally setting the power-on reset mark and the low-voltage detection mark as the first character, and the action of setting the low-voltage detection mark as the first character is not executed yet, so that the corresponding preset program function does not need to be executed once again when the reset occurs, steps which are not executed in the normal execution sequence are sufficiently supplemented, that is, the action of setting the low-voltage detection mark as the first character is executed completely, so that the accuracy of a numerical value in the reset register is ensured, and the reasonable execution of the preset program function is further ensured.
Further, referring to fig. 5, in the fourth embodiment, after the step S1, the method further includes:
in step S5, if the variable value in the preset area is the valid value and the power-on reset flag and the low voltage detection flag of the reset register are both the second character, the preset program function is not executed, the power-on reset flag is set as the first character, and the low voltage detection flag is set as the first character.
In this embodiment, when the reset of the electronic control unit occurs, if the variable value in the preset area is an effective value, the reset is a non-power-on reset, and before the non-power-on reset occurs, the electronic control unit has already executed the preset program function once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM in which the preset area is located is erroneous or not needs to be determined based on the power-on reset flag of the reset register being set to the low-voltage detection flag. If the power-on reset mark and the low-voltage detection mark of the reset register are both the second characters, the RAM in which the preset area is located is normal, and the electronic control unit determines that the preset program function is executed, but the reset occurs in the process of normally setting the power-on reset mark and the low-voltage detection mark as the first characters, and the action of setting the power-on reset mark and the low-voltage detection mark of the reset register as the first characters is not executed yet, so that the preset program function does not need to be executed again when the reset occurs, and the steps which are not executed yet in the normal execution sequence are sufficiently supplemented, that is, the action of setting the power-on reset mark and the low-voltage detection mark of the reset register as the first characters is executed completely, so as to ensure the accuracy of the numerical value in the reset register, and further ensure the reasonable execution of the preset program function.
Further, referring to fig. 6, in the fifth embodiment, after the step S1, the method further includes:
step S6, if the variable value in the preset area is a non-effective value and the power-on reset mark and the low voltage detection mark of the reset register are both the second character, executing the function of the preset program;
step S7, the variable value in the preset area is set to a valid value, the power-on reset flag is set to a first character, and the low voltage detection flag is set to a first character.
In this embodiment, when the reset of the electronic control unit occurs, if the variable value in the preset area is an invalid value, it indicates that the reset is a power-on reset, or the reset is a non-power-on reset that occurs before the preset program is not executed after the power-on reset, that is, before the reset occurs, the electronic control unit does not execute the function of the preset program once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM in which the preset area is located is erroneous or not needs to be determined based on the power-on reset flag of the reset register being set to the low-voltage detection flag. If the variable value in the preset area is a non-effective value, the power-on reset flag and the low-voltage flag of the reset register are both second characters, which indicate that the RAM in which the preset area is located is normal, the electronic control unit determines that the preset program function has not been executed, and does not set the power-on reset flag and the low-voltage detection flag as first characters, so that the preset program function needs to be executed again when the reset occurs. After the preset program function is executed, the variable value in the preset area is set to be an effective value, the power-on reset mark is set to be a first character, and then the low-voltage detection mark is set to be the first character, so that the preset program function cannot be omitted to be executed when reset occurs. Such as: if the preset program function is the zero calibration function of the current sensor, the reset can be executed again if the reset can be distinguished through the variable value and the mark after the zero calibration function is not executed once in a single power-on period, so that the result of the current value calculated later is accurate based on the zero calibration value.
Further, referring to fig. 7, in the sixth embodiment, after the step S1, the method further includes:
in step S8, if the variable value in the preset area is a non-valid value and the power-on reset flag of the reset register is the first character, the preset program function is not executed and the random access memory error is recorded.
In this embodiment, when the reset of the electronic control unit occurs, if the variable value in the preset area is an invalid value, the reset is a power-on reset, or the non-power-on reset occurs before the preset program is not executed after the power-on reset, that is, before the reset occurs, the electronic control unit does not execute the function of the preset program once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM in which the preset area is located is erroneous or not needs to be determined based on the power-on reset flag and the low-voltage detection flag of the reset register. And only after the execution of the preset program function is completed, setting the variable value in the preset area as an effective value, setting the power-on reset mark as a first character, and setting the low-voltage detection mark as the first character. If the variable value in the preset area is a non-effective value, the power-on reset mark of the reset register is a first character, which indicates that the RAM in which the preset area is located is abnormal, so that the variable value result obtained based on the preset area of the RAM cannot be guaranteed to be correct, the function of the preset program does not need to be executed when the reset occurs, the error of the RAM, namely the random access memory is recorded, and an operator is subsequently reminded to perform fault detection on the RAM for replacement or repair, so that the correctness of the variable value result obtained based on the preset area of the RAM is further guaranteed, and the reasonable execution of the function of the preset program is achieved.
Further, in an embodiment, the preset area is further specifically configured to store a state of the electronic control unit in each power-on cycle.
In this embodiment, the electronic control unit includes new power-on states, initialization states, periodic execution states, non-power-on reset states, reset recovery states, initialization states, periodic execution states, and power-off states. After recording all the states of the electric control unit in the process from power-on to power-off in each power-on period, whether non-power-on reset occurs or not and the state of the electric control unit when the non-power-on reset occurs can be analyzed according to all the recorded state sequences so as to help restore the reset scene. Therefore, the preset continuous addresses of the preset area can be allocated for storing the state of the electronic control unit in each power-on cycle.
In this embodiment, a method for determining program execution is provided, including: when the electric control unit is reset, judging whether a variable value in a preset area is an effective value, wherein the variable value is a non-effective value when the electric control unit is powered on and reset and does not execute the function of a preset program, and the variable value is an effective value when the electric control unit is powered on and reset and executes the function of the preset program; and if the variable value in the preset area is an effective value, and the power-on reset mark and the low-voltage detection mark of the reset register are both first characters, the preset program function is not executed, wherein the preset program function is a function which is only executed once in a single power-on period. The invention can ensure that the electric control unit reasonably executes the function of the preset program when the non-power-on reset occurs, and compared with a nonvolatile memory, when the preset area is arranged in a random access memory, the speed of reading and writing the variable value of the preset area is higher, the efficiency is higher, and the failure rate is lower.
In a third aspect, an embodiment of the present invention further provides a device for determining program execution.
Referring to fig. 8, a functional block diagram of an embodiment of a device for determining program execution is shown.
In this embodiment, the program execution determination device includes:
the judging module 10 is configured to judge whether a variable value in a preset area is an effective value when the electronic control unit is reset, where the variable value is a non-effective value when the electronic control unit is powered on and reset and does not execute a preset program function, and is an effective value when the electronic control unit is powered on and reset and executes the preset program function;
and the control module 20 is configured to not execute a preset program function if the variable value in the preset area is an effective value and the power-on reset flag and the low-voltage detection flag of the reset register are both first characters, where the preset program function is a function that only needs to be executed once in a single power-on cycle.
Further, in an embodiment, the control module 20 is further specifically configured to:
if the variable value in the preset area is an effective value, the power-on reset mark of the reset register is a second character and the low-voltage detection mark is a first character, the function of the preset program is not executed, and the time sequence error is recorded.
Further, in an embodiment, the control module 20 is further specifically configured to:
if the variable value in the preset area is an effective value, the power-on reset mark of the reset register is a first character and the low-voltage detection mark is a second character, the function of the preset program is not executed, and the low-voltage detection mark is set as the first character.
Further, in an embodiment, the control module 20 is further specifically configured to:
if the variable value in the preset area is an effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both second characters, the function of the preset program is not executed, the power-on reset mark is set as a first character, and the low-voltage detection mark is set as a first character.
Further, in an embodiment, the control module 20 is further specifically configured to:
if the variable value in the preset area is a non-effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both second characters, executing a preset program function;
setting the variable value in the preset area as an effective value, setting the power-on reset mark as a first character, and setting the low-voltage detection mark as the first character.
Further, in an embodiment, the control module 20 is further specifically configured to:
and if the variable value in the preset area is a non-effective value and the power-on reset mark of the reset register is a first character, the function of the preset program is not executed, and the random access memory error is recorded.
Further, in an embodiment, the preset area is further specifically configured to store a state of the electronic control unit when a non-power-on reset occurs in each power-on period.
The function implementation of each module in the judgment device for program execution corresponds to each step in the judgment method embodiment for program execution, and the function and implementation process are not described in detail here.
In a fourth aspect, the embodiment of the present invention further provides a readable storage medium.
The readable storage medium of the present invention stores a judgment program for program execution, wherein the judgment program for program execution realizes the steps of the judgment method for program execution as described above when being executed by a processor.
The method for determining whether the program is executed can refer to various embodiments of the determining method for program execution of the present invention, and will not be described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for causing a terminal device to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for determining program execution, the method comprising:
when the electric control unit is reset, judging whether a variable value in a preset area is an effective value, wherein the variable value is a non-effective value when the electric control unit is powered on and reset and does not execute the function of a preset program, and the variable value is an effective value when the electric control unit is powered on and reset and executes the function of the preset program;
and if the variable value in the preset area is an effective value, and the power-on reset mark and the low-voltage detection mark of the reset register are both first characters, the preset program function is not executed, wherein the preset program function is a function which is only executed once in a single power-on period.
2. A program execution judging method according to claim 1, wherein after judging whether or not the variable value in the preset area is a valid value:
if the variable value in the preset area is an effective value, the power-on reset mark of the reset register is a second character and the low-voltage detection mark is a first character, the function of the preset program is not executed, and the time sequence error is recorded.
3. A program execution judging method according to claim 1, wherein after judging whether or not the variable value in the preset area is a valid value:
if the variable value in the preset area is an effective value, the power-on reset mark of the reset register is a first character and the low-voltage detection mark is a second character, the preset program function is not executed, and the low-voltage detection mark is set as the first character.
4. A program execution judging method according to claim 1, wherein after judging whether or not the variable value in the preset area is a valid value:
if the variable value in the preset area is an effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both second characters, the function of the preset program is not executed, the power-on reset mark is set as a first character, and the low-voltage detection mark is set as a first character.
5. A program execution judging method according to claim 1, wherein after judging whether or not the variable value in the preset area is a valid value:
if the variable value in the preset area is a non-effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both second characters, executing a preset program function;
setting the variable value in the preset area as an effective value, setting the power-on reset mark as a first character, and setting the low-voltage detection mark as the first character.
6. A program execution judging method according to claim 1, wherein after judging whether or not the variable value in the preset area is a valid value:
and if the variable value in the preset area is a non-effective value and the power-on reset mark of the reset register is a first character, the function of the preset program is not executed, and the random access memory error is recorded.
7. The program execution judgment method according to any one of claims 1 to 6, characterized in that: the preset area is further specifically used for storing the state of the electronic control unit in each power-on period.
8. A program execution judging device, comprising:
the judging module is used for judging whether a variable value in a preset area is an effective value or not when the electric control unit is reset, wherein the variable value is a non-effective value when the electric control unit is powered on and reset and does not execute the function of a preset program, and the variable value is an effective value when the electric control unit is powered on and reset and executes the function of the preset program;
and the control module is used for not executing a preset program function if the variable value in the preset area is an effective value and the power-on reset mark and the low-voltage detection mark of the reset register are both first characters, wherein the preset program function is a function which only needs to be executed once in a single power-on period.
9. A program execution judging device characterized by comprising a processor, a memory, and a program execution judging program stored on the memory and executable by the processor, wherein the program execution judging program, when executed by the processor, implements the steps of the program execution judging method according to any one of claims 1 to 7.
10. A readable storage medium having stored thereon a judgment program for program execution, wherein the judgment program for program execution, when executed by a processor, implements the steps of the judgment method for program execution according to any one of claims 1 to 7.
CN202210474719.3A 2022-04-29 2022-04-29 Program execution judging method, device, equipment and readable storage medium Active CN114860052B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210474719.3A CN114860052B (en) 2022-04-29 2022-04-29 Program execution judging method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210474719.3A CN114860052B (en) 2022-04-29 2022-04-29 Program execution judging method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN114860052A true CN114860052A (en) 2022-08-05
CN114860052B CN114860052B (en) 2024-04-02

Family

ID=82636075

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210474719.3A Active CN114860052B (en) 2022-04-29 2022-04-29 Program execution judging method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114860052B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000207066A (en) * 1999-01-18 2000-07-28 Nec Commun Syst Ltd Method for starting microcomputer and starting system
US20030070110A1 (en) * 2001-10-04 2003-04-10 Nokia Corporation Crash recovery system
US6591389B1 (en) * 1999-01-29 2003-07-08 Lucent Technologies Inc. Testing system for circuit board self-test
CN1540503A (en) * 2003-04-23 2004-10-27 华为技术有限公司 System of capable of identifying cold boot and warm boot, and method for quickenning speed of starting up system
US20050055598A1 (en) * 2003-09-04 2005-03-10 Jen-De Chen Booting method capable of executing a warm boot or a cold boot when a CPU crash occurs and computer system therefor
CN1776566A (en) * 2005-11-25 2006-05-24 港湾网络有限公司 Method for distinguishing system power-on reset and live-line reset
CN103299275A (en) * 2010-11-29 2013-09-11 汤姆逊许可公司 Method and device for distinguishing between cold boot and warm boot
CN103793032A (en) * 2012-11-02 2014-05-14 华为技术有限公司 Method and device for determining power-on reset

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000207066A (en) * 1999-01-18 2000-07-28 Nec Commun Syst Ltd Method for starting microcomputer and starting system
US6591389B1 (en) * 1999-01-29 2003-07-08 Lucent Technologies Inc. Testing system for circuit board self-test
US20030070110A1 (en) * 2001-10-04 2003-04-10 Nokia Corporation Crash recovery system
CN1540503A (en) * 2003-04-23 2004-10-27 华为技术有限公司 System of capable of identifying cold boot and warm boot, and method for quickenning speed of starting up system
US20050055598A1 (en) * 2003-09-04 2005-03-10 Jen-De Chen Booting method capable of executing a warm boot or a cold boot when a CPU crash occurs and computer system therefor
CN1776566A (en) * 2005-11-25 2006-05-24 港湾网络有限公司 Method for distinguishing system power-on reset and live-line reset
CN103299275A (en) * 2010-11-29 2013-09-11 汤姆逊许可公司 Method and device for distinguishing between cold boot and warm boot
CN103793032A (en) * 2012-11-02 2014-05-14 华为技术有限公司 Method and device for determining power-on reset

Also Published As

Publication number Publication date
CN114860052B (en) 2024-04-02

Similar Documents

Publication Publication Date Title
CN102016868B (en) Method for detecting improper removal of electronic equipment
JP5167936B2 (en) Information processing device
CN107451003B (en) Test method and device for storage system
US10261720B2 (en) Method for optimizing the use of a non-volatile memory in a motor vehicle computer for monitoring a functional member
CN105868047A (en) Repairing method and device of data partition, and terminal
CN110597601A (en) Controller task switching method, device, equipment and readable storage medium
CN113672306A (en) Server component self-checking abnormity recovery method, device, system and medium
CN113832663A (en) Control chip fault recording method and device and control chip fault reading method
CN114860052A (en) Program execution judging method, device, equipment and readable storage medium
JP5012548B2 (en) Programmable controller
JP2010102454A (en) Information processing apparatus and information processing program
CN111400136A (en) Server-dedicated GPU fault protection device, method, equipment and medium
CN113625957B (en) Method, device and equipment for detecting hard disk faults
CN110442387B (en) Parameter self-adaption method and device of vehicle-mounted system and vehicle
CN110865906B (en) Motor initial position angle storage method and device, vehicle and storage medium
JP5579257B2 (en) Apparatus and method for restoring information in main memory
JP4635993B2 (en) Startup diagnostic method, startup diagnostic method and program
CN111796571A (en) Equipment fault detection method and device, computer equipment and storage medium
CN111414590A (en) Consistency management method, device and equipment for Web service software component
JP5397667B2 (en) Data processing apparatus, information processing apparatus, image forming apparatus, and data processing program
CN113393891A (en) Nonvolatile memory detection method and device and electric vehicle
JP2005128613A (en) Image forming device
JP5799693B2 (en) Board-mounted circuit with sub-board connector
CN109408266B (en) Method and device for determining restart type
CN116991613A (en) Fault repairing method and device, user terminal, electronic equipment and readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant