CN114860052B - 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
CN114860052B
CN114860052B CN202210474719.3A CN202210474719A CN114860052B CN 114860052 B CN114860052 B CN 114860052B CN 202210474719 A CN202210474719 A CN 202210474719A CN 114860052 B CN114860052 B CN 114860052B
Authority
CN
China
Prior art keywords
reset
value
preset
power
executed
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.)
Active
Application number
CN202210474719.3A
Other languages
Chinese (zh)
Other versions
CN114860052A (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

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 judging method, a device, equipment and a readable storage medium for program execution, wherein the judging method for 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 set as an ineffective value when a preset program function is not executed after the electric control unit is powered on and reset, and is set as 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 power-on reset mark and the low voltage detection mark of the reset register are both first characters, and the preset program function is not executed, wherein the preset program function is a function which is executed only once in a single power-on period. The invention can ensure that the electric control unit reasonably executes the preset program function when the non-power-on reset occurs, and the speed of reading and writing the variable value of the preset area can be faster and more efficient when the preset area is arranged in the random access memory, and the failure rate can be 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
The electronic control unit in the electronic product can be reset due to software and hardware design defects or severe external environments in the use process, namely, the electronic product is suddenly re-executed from a starting-up function when executing a normal function. Wherein the reset type includes a power-on reset and a non-power-on reset. The initial state of the electronic product from shutdown and power down to restarting and powering up is power-on reset, and the power supply other than the power-on reset is non-power-on reset without power-off reset. And some functions of the electric control unit are executed once only when the electric control unit is powered on and reset to execute the initialization function in a single power-on period from the power-on to the power-off of the electronic product, and the functions are used as preset program functions.
However, the current situation is: in a single power-on period, when the electric control unit executes normal functions, reset occurs for whatever reasons, including power-on reset and non-power-on reset, the electric control unit can start to execute again from the initialized functions after starting up, i.e. whether the electric control unit has executed such preset program functions or not, the preset program functions are executed again. If the electronic control unit has executed such a preset program function, then executing the preset program function again will cause a problem. For example:
(1) Some sensors, such as current sensors, have zero bias characteristics and therefore require a zero-correction function to obtain a more accurate signal value, which is only required to be performed once during a single power-up 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 measured values of the current sensor is used as a current zero offset value of the power-on period under the condition that the measured values are reasonable, and when the input signal to be measured of the current sensor is in an effective state, the current zero offset value is subtracted as a final current effective value based on the measured values of the current sensor.
The power supply of the current sensor and the current signal to be measured comes from a key signal, the key signal is enabled to generate power-on reset of the electric control unit after being disconnected for a certain period of time, the power-on reset can cause power failure of the current sensor and the current signal to be measured, and the power-on reset can not cause power failure of the current sensor and the current signal to be measured.
When the electric control unit is in non-power-on reset, the electric control unit executes the current sensor zero calibration once no matter whether the current zero calibration function is executed or not. At this time, it cannot be distinguished whether the current zero calibration function is executed when the electric control unit generates non-power-on reset. If the current zero correction function has been performed once in this case, the actual value of the zero correction read may be the value of the current normally supplied by the current sensor, and the use of this erroneous value of the zero correction may lead to errors in the current value calculated later.
(2) The method is characterized in that the existing faults of the electronic product in each power-on period are required to be acquired, so that the fault change conditions of a controller, an actuator or a sensor and the like in the new power-on period are analyzed, and the program function of acquiring the existing faults of the electronic product only needs to be executed once in the single power-on period.
And when the electric control unit is in non-power-on reset, the electric control unit can execute the function of acquiring the existing fault of the electronic product once no matter whether the function of acquiring the existing fault of the electronic product is executed or not. If the function of acquiring the fault existing in the electronic product is performed once in this situation, when the fault change conditions of the controller, the actuator or the sensor and the like in the new power-up period are analyzed later, the fault condition acquired by the last reset before the power-down in the current power-up period is compared with the adjacent power-up period, the acquired fault is not the initial fault set in the current power-up period, but the fault set after the electric control unit runs for a period after the power-up, and new faults may be generated or some faults are recovered to be normal between the power-up and the reset. Namely, the fault set during the non-power-on reset in the single power-on period can be read again and cover the fault set during the power-on reset in the power-on period, and an error judgment result is caused.
Disclosure of Invention
The invention mainly aims to provide a judging method, device and equipment for program execution and a readable storage medium, and aims to solve the technical problems that in the prior art, an electric control unit is not powered on for resetting when normally executing functions, and some program functions cannot be reasonably executed.
In a first aspect, the present invention provides a program execution judging method, the program execution judging method including the steps of:
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 set as an ineffective value when a preset program function is not executed after the electric control unit is powered on and reset, and is set as 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 power-on reset mark and the low voltage detection mark of the reset register are both first characters, and the preset program function is not executed, wherein the preset program function is a function which is executed only 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 preset program function 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 a valid value, and the power-on reset flag of the reset register is a first character and the low voltage detection flag is a second character, the preset program function is not executed, and the low voltage detection flag is set to 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 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 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 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;
and setting a variable value in a preset area as a valid value, setting a power-on reset mark as a first character, and setting a low-voltage detection mark 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 a non-valid value, the power-on reset mark of the reset register is a first character, the preset program function 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 program execution judging device, including:
the judging module is used for judging whether the variable value in the preset area is an effective value or not when the electric control unit is reset, wherein the variable value is set as an ineffective value when the preset program function is not executed after the electric control unit is powered on and reset, and is set as an effective value when the preset program function is executed after the electric control unit is powered on and reset;
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 is only needed 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 preset program function 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 a valid value, and the power-on reset flag of the reset register is a first character and the low voltage detection flag is a second character, the preset program function is not executed, and the low voltage detection flag is set to 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 the 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;
and setting a variable value in a preset area as a valid value, setting a power-on reset mark as a first character, and setting a low-voltage detection mark as the first character.
Optionally, the control module is further specifically configured to:
if the variable value in the preset area is a non-valid value, the power-on reset mark of the reset register is a first character, the preset program function 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 also provides a program execution judging apparatus, the program execution judging apparatus including 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 as described above.
In a fourth aspect, the present invention also provides a readable storage medium having stored thereon a program-executed judging program, wherein the program-executed judging program, when executed by a processor, implements the steps of the program-executed judging method as described above.
The invention provides a judging method, a device, equipment and a readable storage medium for program execution, wherein the judging method for 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 set as an ineffective value when a preset program function is not executed after the electric control unit is powered on and reset, and is set as 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 power-on reset mark and the low voltage detection mark of the reset register are both first characters, and the preset program function is not executed, wherein the preset program function is a function which is executed only once in a single power-on period. The invention can ensure that the electric control unit reasonably executes the preset program function when the non-power-on reset occurs, and the speed is faster and more efficient when the variable value of the preset area is read and written when the preset area is arranged in the random access memory, and the failure rate is lower.
Drawings
Fig. 1 is a schematic hardware configuration diagram of a judging device for program execution according to an embodiment of the present invention;
FIG. 2 is a flowchart of a first embodiment of a determining method for executing a program according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a judging method for executing the program of the present invention;
FIG. 4 is a flowchart illustrating a third embodiment of a determining method for executing a program according to the present invention;
FIG. 5 is a flowchart illustrating a fourth embodiment of a determining method for executing a program according to the present invention;
FIG. 6 is a flowchart of a fifth embodiment of a judging method for executing the program of the present invention;
FIG. 7 is a flowchart of a sixth embodiment of a determining method for executing a program according to the present invention;
fig. 8 is a schematic functional block diagram of an embodiment of a determining apparatus for executing a program according to the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
In a first aspect, an embodiment of the present invention provides a program execution determination apparatus.
Referring to fig. 1, fig. 1 is a schematic hardware configuration of a program execution judgment device according to an embodiment of the present invention. In an embodiment of the present invention, the determining device for program execution may include a processor 1001 (e.g., a central processing unit Central Processing Unit, a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein the communication bus 1002 is used to enable connected communications between these 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., WIreless-FIdelity, WI-FI interface); the memory 1005 may be a high-speed random access memory (random access memory, RAM) or a stable memory (non-volatile memory), such as a disk memory, and the memory 1005 may alternatively be a storage device independent of the processor 1001. Those skilled in the art will appreciate that the hardware configuration shown in fig. 1 is not limiting of the invention and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
With continued reference to fig. 1, the memory 1005 in fig. 1, which is a computer storage medium, may include an operating system, a network communication module, a user interface module, and a program-executed determination program. The processor 1001 may call a program execution determination program stored in the memory 1005, and execute the program execution determination method provided in the embodiment of the present invention.
In a second aspect, based on the above-mentioned problems of the prior art in the background art, the present embodiment provides a method for determining program execution, considering whether such a preset program function needs to be re-executed when various resets occur if it can be determined whether such a preset program function has been executed once in a single power-up cycle.
By utilizing the characteristics of a Random Access Memory (RAM), a section of preset area for data storage is partitioned in the RAM. In general, when data is stored in a RAM area, whether power is lost or not, the data stored in the RAM area is cleared when a program is executed after reset whenever reset occurs. The start-up procedure is changed, and the data in the preset area is not cleared. And according to the characteristics of the RAM, the byte of the preset continuous address is taken by the segment of preset area, the value is random after the power-on is powered on, and the segment of value is written into a specific value, such as the asc code value of 'rept', after the normal execution of the preset program function once. That is, whenever the current power-on cycle is reset, if the variable value of the preset area is the effective value rept, the preset program function can be confirmed to be executed once, and the execution of the preset program function is not needed once again after the reset; if the variable value of the preset area is a random value of the non-valid value rept, the preset program function is confirmed to be executed once after the execution is not completed, and the execution is needed once after the reset. Meanwhile, compared with the variable value stored in a nonvolatile memory, the method has the advantages that the reading and writing speed is higher, the reading and writing efficiency is higher, and the failure rate is lower when the variable value is read and written from the preset area of the RAM.
Considering that the preset area is set 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, if the RAM has failure, the judgment of whether to execute the preset program function based on the variable value of the preset area will also be wrong. The power-on reset mark and the low voltage detection mark are stored in a reset register, and the program function execution is preset once in a single power-on period, namely after the asc code value of rept is written, the power-on reset mark is set as a first character by a software program, then the low voltage detection mark is set as a first character, and the first character can be zero equivalent.
Referring to fig. 2, in a first embodiment of the program execution judging method of the present invention, the program execution judging method includes:
step S1, when an electric control unit is reset, judging whether a variable value in a preset area is an effective value, wherein the variable value is set as an ineffective value when a preset program function is not executed after the electric control unit is powered on and reset, and is set as an effective value when the preset program function is executed after the electric control unit is powered on and reset;
step S2, if the variable value in the preset area is an effective value, the power-on reset mark and the low voltage detection mark of the reset register are both first characters, and the preset program function is not executed, wherein the preset program function is a function which is executed only once in a single power-on period.
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 a valid value. The variable value is set as an inactive value when the preset program function is not executed after the power-on reset of the electric control unit, and is set as an active value when the preset program function is executed after the power-on reset of the electric control unit.
If the variable value in the preset area is a valid value, the reset is a non-power-on reset, and the electric control unit has executed the preset program function once before the non-power-on reset occurs. Meanwhile, in order to ensure the accuracy of the result, whether the RAM error where the preset area is determined based on the power-on reset mark and the low-voltage detection mark of the reset register. If the power-on reset mark and the low voltage mark of the reset register are both 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 is not required to be executed again when the reset occurs at the time, and the preset program function is ensured not to be executed repeatedly when the reset occurs, thereby causing problems. Such as: if the preset program function is the zero-correction function of the current sensor, the reset can be distinguished by the variable value and the mark after the zero-correction function is executed once in a single power-on period, and the reset can not execute the zero-correction function again at the moment, so that the current value calculated later is wrong.
Further, referring to fig. 3, in the second embodiment, after the step S1, the method further includes:
step S3, 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 preset program function is not executed, and the time sequence error is recorded.
In this embodiment, if the variable value in the preset area is a valid value when the reset of the electronic control unit occurs, it is indicated that the reset is a non-power-on reset, and the electronic control unit has executed the preset program function once before the non-power-on reset occurs. Meanwhile, in order to ensure the accuracy of the result, whether the RAM error where the preset area is determined based on the power-on reset mark and the low-voltage detection mark of the reset register. When the execution completes the preset program function, 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 flag of the reset register is the second character and the low voltage detection flag is the first character, that is, the execution process sequence of setting the power-on reset flag and the low voltage detection flag 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 is not required to be executed, 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:
step S4, if the variable value in the preset area is an effective value, and 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.
In this embodiment, when the reset of the electronic control unit occurs, if the variable value in the preset area is a valid value, it is indicated that the reset is a non-power-on reset, and before the non-power-on reset occurs, the electronic control unit has executed the preset program function once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM error where the preset area is located is determined based on the power-on reset mark of the reset register and the low-voltage detection mark. If the power-on reset flag of the reset register is a first character and the low voltage detection flag is a second character, the RAM where 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 flag and the low voltage detection flag as the first character, and the action of setting the low voltage detection flag as the first character is not executed, so that the reset does not need to execute the corresponding preset program function once again, and the steps which are not executed in the normal execution sequence are sufficient, namely, the execution of the action of setting the low voltage detection flag as the first character is completed, so that the accuracy of the data 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:
and S5, 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 the first character.
In this embodiment, when the reset of the electronic control unit occurs, if the variable value in the preset area is a valid value, it is indicated that the reset is a non-power-on reset, and before the non-power-on reset occurs, the electronic control unit has executed the preset program function once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM error where the preset area is located is determined based on the power-on reset mark of the reset register and the low-voltage detection mark. If the power-on reset mark and the low voltage detection mark of the reset register are both second characters, the RAM where 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, so that the preset program function is not required to be executed when the reset occurs, and the steps which are not executed in the normal execution sequence are fully supplemented, namely, the execution of the action of setting the power-on reset mark and the low voltage detection mark of the reset register as the first characters is completed, so that the accuracy of the numerical value in the reset register is ensured, and the reasonable execution of the preset program function is further ensured.
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 second characters, executing a preset program function;
and S7, setting a variable value in a preset area as an effective value, setting a power-on reset mark as a first character, and setting a low-voltage detection mark 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 a non-valid value, it is indicated that the reset is a power-on reset, or that the non-power-on reset occurs before the completion of the preset program is performed after the power-on reset, that is, before the reset occurs, the electronic control unit has not performed the preset program function once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM error where the preset area is located is determined based on the power-on reset mark of the reset register and the low-voltage detection mark. If the variable value in the preset area is a non-valid value, the power-on reset flag and the low voltage flag of the reset register are both the second character, which indicates that the RAM in which the preset area is located is normal, and the electronic control unit determines that the preset program function has not been executed yet, and does not set the power-on reset flag and the low voltage detection flag as the first character, 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 as an effective value, the power-on reset mark is set as a first character, and the low-voltage detection mark is set as a first character, so that the preset program function is ensured not to be executed in a missing way when reset occurs. Such as: if the preset program function is the zero calibration function of the current sensor, the reset can be distinguished by the variable value and the mark after the zero calibration function is not executed once in a single power-on period, and the zero calibration function is executed again at the moment, so that the accuracy of the current value result calculated later is ensured based on the zero calibration value.
Further, referring to fig. 7, in the sixth embodiment, after the step S1, the method further includes:
step S8, 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, 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 a non-valid value, it indicates that the reset is a power-on reset, or that the non-power-on reset occurs before the completion of the preset program is executed after the power-on reset, that is, before the reset occurs, the electronic control unit has not executed the preset program function once. Meanwhile, in order to ensure the accuracy of the result, whether the RAM error where the preset area is determined based on the power-on reset mark and the low-voltage detection mark of the reset register. The method comprises the steps of setting a variable value in a preset area as a valid value only after a preset program function is executed, setting a power-on reset mark as a first character, and setting a 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, so that the RAM where the preset area is located is abnormal, and therefore, the variable value result obtained based on the preset area of the RAM cannot be ensured to be correct, the preset program function is not required to be executed again when the reset happens, the RAM, namely the random access memory, is recorded, and an operator is reminded to perform fault detection on the RAM for replacement or repair subsequently, so that the correctness of the variable value result obtained based on the preset area of the RAM is further ensured, and the reasonable execution of the preset program function 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-up period.
In this embodiment, the electronic control unit includes a new power-on state, an initialization state, a periodic execution state, a non-power-on reset state, a reset recovery state, an initialization state, a periodic execution state, and a power-off state. After all states of the electric control unit in the process from power-on to power-off in each power-on period are recorded, whether non-power-on reset occurs or not and the states of the electric control unit when the non-power-on reset occurs can be analyzed according to all recorded state sequences, so that the reset scene is restored. Therefore, the preset continuous addresses of the preset area can be allocated for storing the state of the electronic control unit in each power-up period.
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 set as an ineffective value when a preset program function is not executed after the electric control unit is powered on and reset, and is set as 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 power-on reset mark and the low voltage detection mark of the reset register are both first characters, and the preset program function is not executed, wherein the preset program function is a function which is executed only once in a single power-on period. The invention can ensure that the electric control unit reasonably executes the preset program function when non-power-on reset occurs, and compared with a nonvolatile memory, when the preset area is arranged in the random access memory, the speed is faster, the efficiency is higher, and the failure rate is lower when the variable value of the preset area is read and written.
In a third aspect, an embodiment of the present invention further provides a determining device for program execution.
Referring to fig. 8, a functional block diagram of an embodiment of a program execution judging device is shown.
In this embodiment, the program execution judging device includes:
the judging module 10 is configured to judge whether a variable value in a preset area is an effective value when the electric control unit is reset, where the variable value is set to be an ineffective value when a 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;
the control module 20 is configured to, if the variable value in the preset area is an effective value, not execute the preset program function if the power-on reset flag and the low voltage detection flag of the reset register are both the first character, where the preset program function is a function that needs to be executed only once in a single power-on period.
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 preset program function 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 a valid value, and the power-on reset flag of the reset register is a first character and the low voltage detection flag is a second character, the preset program function is not executed, and the low voltage detection flag is set to 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 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 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 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;
and setting a variable value in a preset area as a valid value, setting a power-on reset mark as a first character, and setting a low-voltage detection mark 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 a non-valid value, the power-on reset mark of the reset register is a first character, the preset program function 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 the non-power-on reset occurs in each power-on period.
The function implementation of each module in the judging device for program execution corresponds to each step in the judging method embodiment for program execution, and the function and implementation process of the function implementation are not described in detail herein.
In a fourth aspect, embodiments of the present invention also provide a readable storage medium.
The readable storage medium of the present invention stores a program execution judgment program, wherein when the program execution judgment program is executed by a processor, the steps of the program execution judgment method described above are realized.
The method implemented when the judging program executed by the program is executed may refer to various embodiments of the judging method executed by the program of the present invention, and will not be described herein.
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 one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising several instructions for causing a terminal device to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (7)

1. A program execution judging method, characterized in that the program execution judging method comprises:
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 set as an inactive value when a preset program function is not executed after the electric control unit is powered on and reset, is set as an effective value when the preset program function is executed after the electric control unit is powered on and reset, a power on reset mark is set as a first character, and a low voltage detection mark is set as a first character;
if the variable value in the preset area is an effective value, the power-on reset mark and the low voltage detection mark of the reset register are both first characters, and a preset program function is not executed, wherein the preset program function is a function which is executed only once in a single power-on period; after judging 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 a variable value in a preset area as an effective value, setting a power-on reset mark as a first character, and setting a low-voltage detection mark as the first character;
after judging 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 preset program function is not executed, and the time sequence error is recorded;
after judging 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, the power-on reset mark of the reset register is a first character, the preset program function is not executed, and the random access memory error is recorded;
in the random access memory, a section of preset area for data storage is divided, the value after the preset program function is normally executed once is written as a specific value, when the variable value of the preset area is a specific value of an effective value, the preset program function is confirmed to be executed once, the execution of the preset program function is not needed once after the reset, and when the variable value of the preset area is a random value of a specific value of a non-effective value, the execution of the preset program function is confirmed to be not executed once, and the execution of the preset program function is needed once after the reset.
2. The program execution judging method according to claim 1, wherein after judging whether the variable value in the preset area is a valid value:
if the variable value in the preset area is a valid value, and the power-on reset flag of the reset register is a first character and the low voltage detection flag is a second character, the preset program function is not executed, and the low voltage detection flag is set to the first character.
3. The program execution judging method according to claim 1, wherein after judging 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 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 the first character.
4. A program execution judging method according to any one of claims 1 to 3, wherein: the preset area is also specifically used for storing the state of the electric control unit in each power-on period.
5. A program execution judgment device, characterized in that the program execution judgment device comprises:
the judging module is used for judging whether the variable value in the preset area is an effective value or not when the electric control unit is reset, wherein the variable value is set as an ineffective value when the preset program function is not executed after the electric control unit is powered on and reset, and is set as an effective value when the preset program function is executed after the electric control unit is powered on and reset;
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 is only needed to be executed once in a single power-on period;
the control module is further configured to execute a preset program function if the variable value in the preset area is a non-valid value, and the power-on reset flag and the low voltage detection flag of the reset register are both second characters; setting a variable value in a preset area as an effective value, setting a power-on reset mark as a first character, and setting a low-voltage detection mark as the first character;
the control module is further configured to, if the variable value in the preset area is an effective value, reset the power-on reset flag of the register to a second character and the low voltage detection flag to a first character, not execute the preset program function and record a timing error;
the control module is further configured to, if the variable value in the preset area is a non-valid value, reset the power-on reset flag of the register to a first character, not execute the preset program function, and record a random access memory error.
6. A program execution judging device, characterized in that the program execution judging device includes 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, realizes the steps of the program execution judging method according to any one of claims 1 to 3.
7. A readable storage medium, wherein a program-executed judgment program is stored on the readable storage medium, wherein the program-executed judgment program, when executed by a processor, realizes the steps of the program-executed judgment method according to any one of claims 1 to 3.
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 CN114860052A (en) 2022-08-05
CN114860052B true 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 (6)

* 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
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
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

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7137026B2 (en) * 2001-10-04 2006-11-14 Nokia Corporation Crash recovery system
TWI243335B (en) * 2003-09-04 2005-11-11 Htc Corp Booting method for performing warm boot or cold boot when CPU is down, and its computer system

Patent Citations (6)

* 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
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
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
CN114860052A (en) 2022-08-05

Similar Documents

Publication Publication Date Title
US20070147150A1 (en) Nonvolatile memory
CN106803429B (en) Electronic device with fault monitoring for memory and associated method
CN103577332A (en) Control device for vehicle and error processing method in control device for vehicle
CN109556646B (en) Gas sensor calibration method and device, storage medium and terminal
JP5167936B2 (en) Information processing device
CN114860052B (en) Program execution judging method, device, equipment and readable storage medium
US20060206764A1 (en) Memory reliability detection system and method
JP2009187373A (en) Programmable controller
CN111400136A (en) Server-dedicated GPU fault protection device, method, equipment and medium
JP2008179144A (en) Method for counting event and image formation device implementing the method
CN116185777A (en) Method, device and system for monitoring power consumption of server and server
CN110442387B (en) Parameter self-adaption method and device of vehicle-mounted system and vehicle
US8145951B2 (en) Control device
CN110865906B (en) Motor initial position angle storage method and device, vehicle and storage medium
US20130055017A1 (en) Device and method for restoring information in a main storage unit
CN111445598A (en) Optical fiber attitude and heading reference system information processing method, device, equipment and storage medium
CN112863582A (en) Data power failure holding method and device, computer equipment and storage medium
JP5286831B2 (en) Measuring device
JP5447700B2 (en) Measuring device
JP5397667B2 (en) Data processing apparatus, information processing apparatus, image forming apparatus, and data processing program
JP2010198314A (en) Information management device
JP3314719B2 (en) Flash EEPROM and its test method
CN112685086B (en) Information processing method and electronic equipment
JP2005128613A (en) Image forming device
CN113625855B (en) Power supply control method, system, medium and equipment of server system

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