How To Ensure Microcontroller Reliability In Software Design?

In microcontroller application systems, the reliability design of software/hardware is crucial for the stable operation of the entire system, especially in complex and harsh environments such as industrial control, where microcontrollers are easily subjected to various interferences and challenges. So, from the software perspective, how should engineers proceed?

How To Ensure Microcontroller Reliability In Software Design?

1. Instruction Redundancy

Insert two NOP instructions after double-byte and triple-byte instructions to prevent erroneous execution of subsequent instructions. For critical instructions such as RET, RETI, LCALL, LJMP, JC, etc., insert two NOP instructions afterwards to ensure correct program execution.

2. Designing Software Traps

Fill unused EPROM space with NOP instructions and the jump instruction LIMP 0000H to form software traps. Set software traps at the end and in the middle of program data tables to ensure that if the program runs off track into the data area, it can return to normal promptly. Set software traps between every two subroutines and in interrupt service routines to capture erroneous interrupts.

3. Software “Watchdog” Technology

Use timer interrupt service programs to periodically check the main program’s running status. By detecting the program’s loop time, determine if it has fallen into a “dead loop.” Choose a byte in the RAM area as a software watchdog register, where the main program and timer interrupt service program will respectively perform addition and subtraction operations to check for changes. Employ a circular interrupt monitoring system to enhance anti-interference performance.

4. Check RAM Area Flag Data

Select several fixed units in the RAM area and set fixed data during initialization. During program execution, periodically check the contents of these units; if changes are detected, force the microcontroller to reset.

5. Refresh Output Ports

Select several fixed units in the RAM area and set fixed data during initialization. During program execution, periodically check the contents of these units; if changes are detected, force the microcontroller to reset. 6. Perform multiple input signal sampling to avoid interference by using a weighted average method. Ensure the accuracy and reliability of the input signal.

This article is an original work by Fan Yi Enterprise Training. Please indicate the source when reprinting!

Submission/Recruitment/Advertisement/Course Cooperation/Resource Exchange; please add WeChat: 13237418207

Leave a Comment