請先看『使用說明』
IO Device:81801
From LEXWiKi
(→Disable WDT Function) |
|||
Line 1: | Line 1: | ||
- | == The Sample code source you can download from == | + | [[Category:AllowPages]]== The Sample code source you can download from == |
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/Windows_Base/81801UWDTw_src_v10.rar 81801UWDTw_src_v10.rar] | Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/Windows_Base/81801UWDTw_src_v10.rar 81801UWDTw_src_v10.rar] |
Revision as of 14:06, 12 August 2010
== The Sample code source you can download from ==
Source file: 81801UWDTw_src_v10.rar
Binary file: 81801UWDTw_bin_v10.rar
Contents |
How to use the DEMO Application
- Step 1:Key-in the 1~255 value in Red number 1.
- Step 2:Press the "WDT Enable" button in Red number 2,the system will reboot after step 1 you key-in Sec.
- Step 3:Press the "WDT Disable" button in Red number 3,It will stop WDT function.
So you can make the loop with Enable and Disable to protection your system when crash.
SDK Reference Code Introduction
Define for 81801U register,in datasheet F81801U_V0.13P.pdf page 47 and page 60,The page 60 have mistake for Index,So that need to change to
- Configuration Register Index 00h to F0h
- Watchdog Timer Configuration Register 1 Index 05h to F5h
- Watchdog Timer Configuration Register 2 Index 06h to F6h
define ENTRYKEY 0x87
define INDEXPORT 0x2e
define DATAPORT 0x2f
define LDNSET 0x07
define WDTTDE 0x30
define WDTC 0xf6
define WDTUS 0xf5
Enable WDT Function
void CMy81801UWDTDlg::WDTenable(int timer)
{
DWORD dwPortVal; DWORD dwMemVal; bool bResult; bResult = InitializeWinIo(); if (bResult) { /*Enter configuration is write twice data 0x87 into Configuration Index Port.*/
SetPortVal(INDEXPORT, ENTRYKEY,1);
SetPortVal(INDEXPORT, ENTRYKEY,1);
SetPortVal(INDEXPORT, LDNSET, 1);
SetPortVal(DATAPORT, 0x07, 1);
SetPortVal(INDEXPORT, WDTTDE, 1);
SetPortVal(DATAPORT, 0x01, 1);
SetPortVal(INDEXPORT, WDTC, 1);
SetPortVal(DATAPORT, timer, 1);//System will reboot after timer sec.
SetPortVal(INDEXPORT, WDTUS, 1);
SetPortVal(DATAPORT, 0x31, 1);
ShutdownWinIo();}
else MessageBox(NULL,TEXT("Error for WinIO init error!!"));
}
Disable WDT Function
void CMy81801UWDTDlg::WDTDisable(void) {
DWORD dwPortVal; DWORD dwMemVal; bool bResult;
bResult = InitializeWinIo(); if (bResult) {
SetPortVal(INDEXPORT, WDTUS, 1);
SetPortVal(DATAPORT, 0x51, 1);
ShutdownWinIo();
} else MessageBox(NULL,TEXT("Error for WinIO init error!!"));
}