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

HCS08如何最简单的进行软件reset

有啊,非法指令复位,又快又简单。
海纳百川  有容乃大
#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 */
}
海纳百川  有容乃大
S12并没有非法指令复位,只有中断。但是如果S12的COP打开的话,只要写的不是0x55和0xAA,就会马上复位。
海纳百川  有容乃大
那需要等定时溢出。
海纳百川  有容乃大
返回列表