首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

请问C语言的软件复位方法

不知道是哪位大侠指点的,使用非法指令复位,有些芯片有支持,你可以试一试
#include /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */


void MCU_init(void); /* Device initialization function declaration */


volatile const char IllegaInstrct = 0x8D;

void main(void) {

/* Uncomment this function call after using Device Initialization
to use the generated code */
/* MCU_init(); */

EnableInterrupts; /* enable interrupts */

/* include your code here */



for(;;) {
__RESET_WATCHDOG(); /* feeds the dog */

asm
{
LDHX IllegaInstrct
JMP ,X
}


} /* loop forever */
/* please make sure that you never leave this function */
}
天剑
返回列表