Filename:w697hf.cpp – IBASE IB831 User Manual
Page 21
INSTALLATION
IB831 User’s Manual
17
bBuf = Get_W627DHG_Reg(0x2D);
bBuf &= (~0x01);
Set_W627DHG_Reg(0x2D, bBuf);
//Enable WDTO
}
//---------------------------------------------------------------------------
void WDTEnable(unsigned char NewInterval)
{
unsigned char bBuf;
Set_W627DHG_LD(0x08);
//switch to logic device 8
Set_W627DHG_Reg(0x30, 0x01);
//enable timer
bBuf = Get_W627DHG_Reg(0xF5);
bBuf &= (~0x08);
Set_W627DHG_Reg(0xF5, bBuf);
//count mode is second
Set_W627DHG_Reg(0xF6, NewInterval);
//set timer
}
//---------------------------------------------------------------------------
void WDTDisable(void)
{
Set_W627DHG_LD(0x08);
//switch to logic device 8
Set_W627DHG_Reg(0xF6, 0x00);
//clear watchdog timer
Set_W627DHG_Reg(0x30, 0x00);
//watchdog disabled
}
//---------------------------------------------------------------------------
Filename:W697hf.cpp
//---------------------------------------------------------------------------
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
//---------------------------------------------------------------------------
#include "W627DHG.H"
#include
//---------------------------------------------------------------------------
unsigned int W627DHG_BASE;
void Unlock_W627DHG (void);
void Lock_W627DHG (void);
//---------------------------------------------------------------------------
unsigned int Init_W627DHG(void)
{
unsigned int result;
unsigned char ucDid;
W627DHG_BASE = 0x4E;
result = W627DHG_BASE;
ucDid = Get_W627DHG_Reg(0x20);
if (ucDid == 0xA0)
//W83627DHG??
{
goto Init_Finish;
}
else if (ucDid == 0xB0)
//W83627DHG-P??
{
goto Init_Finish;
}
W627DHG_BASE = 0x2E;
result = W627DHG_BASE;
ucDid = Get_W627DHG_Reg(0x20);
if (ucDid == 0xA0)
//W83627DHG??
{
goto Init_Finish;
}
else if (ucDid == 0xB0)
//W83627DHG-P??
{
goto Init_Finish;
}
W627DHG_BASE = 0x00;
result = W627DHG_BASE;