INSTALLATIONS
printf("System will reset after %d seconds\n", bTime);
EnableWDT(bTime);
return 0;
}
//======================================================================= void copyright(void)
{
printf("\n======== Winbond 83627EHF Watch Timer Tester (AUTO DETECT)
========\n"\
"Usage : W627E_WD reset_time\n"\
"Ex : W627E_WD 3 => reset system after 3 second\n"\
"W627E_WD 0 => disable watch dog timer\n");
}
//======================================================================= void EnableWDT(int interval)
{
unsigned char bBuf;
bBuf = Get_W627EHF_Reg( 0x2D); bBuf &= (!0x01); Set_W627EHF_Reg( 0x2D, bBuf);
Set_W627EHF_LD( 0x08);
Set_W627EHF_Reg( 0x30, 0x01);
bBuf = Get_W627EHF_Reg( 0xF5); bBuf &= (!0x08); Set_W627EHF_Reg( 0xF5, bBuf);
Set_W627EHF_Reg( 0xF6, interval);
//Enable WDTO
//switch to logic device 8 //enable timer
//count mode is second
//set timer
}
//======================================================================= void DisableWDT(void)
{
Set_W627EHF_LD(0x08); | //switch to logic device 8 |
Set_W627EHF_Reg(0xF6, 0x00); | //clear watchdog timer |
Set_W627EHF_Reg(0x30, 0x00); | //watchdog disabled |
}
//=======================================================================
MB898 User’s Manual | 25 |