請先看『使用說明』
IO Device:852DioNTDriver version
From LEXWiKi
(Difference between revisions)
(→How to install the NT driver) |
(→Enable WDT) |
||
Line 20: | Line 20: | ||
=== Enable WDT === | === Enable WDT === | ||
- | DWORD WdtEnableBuffer[2] = { WDT_ENABLE , | + | DWORD WdtEnableBuffer[2] = { WDT_ENABLE , 5 }; //set 5 seconds to WDT enable port, system will reboot after 5 seconds |
DeviceIoControl(hDevice, WRITE_PORT, WdtEnableBuffer , sizeof(WdtEnableBuffer), NULL, 0, &dwOutput, NULL); | DeviceIoControl(hDevice, WRITE_PORT, WdtEnableBuffer , sizeof(WdtEnableBuffer), NULL, 0, &dwOutput, NULL); | ||
Revision as of 14:20, 3 August 2009
Contents |
Introduction
Define Pin Address
#define WDT_ENABLE 0x600 #define WDT_DISABLE 0x604 #define DO 0x60C #define DI 0x608
Set DO
DWORD dwOutput; //write data 1 to DO port DWORD DoCheckLowBuffer[2] = { DO , 1 }; DeviceIoControl( hDevice , WRITE_PORT , DoCheckLowBuffer , sizeof(DoCheckLowBuffer) , NULL , 0 , &dwOutput , NULL);
Read DI/DO
DWORD DiCheckLowOutBuffer; //read DI data DWORD DiCheckLowInBuffer[1] = { DI }; DeviceIoControl( hDevice , READ_PORT , DiCheckLowInBuffer , sizeof(DiCheckLowInBuffer) , &DiCheckLowOutBuffer , sizeof(DiCheckLowOutBuffer) , &dwOutput , NULL);
Enable WDT
DWORD WdtEnableBuffer[2] = { WDT_ENABLE , 5 }; //set 5 seconds to WDT enable port, system will reboot after 5 seconds DeviceIoControl(hDevice, WRITE_PORT, WdtEnableBuffer , sizeof(WdtEnableBuffer), NULL, 0, &dwOutput, NULL);
Disable WDT
//set 1 sec to WDT disable port , the disable signal will break off WDT enable signle DWORD WdtDisableBuffer[2] = { WDT_DISABLE , 1 }; DeviceIoControl(hDevice, WRITE_PORT, WdtDisableBuffer, sizeof(WdtDisableBuffer), NULL, 0, &dwOutput, NULL);
The Sample code source you can download from
How to install the NT driver
1. Download the installer DriverInstaller.rar
2. Double click the DriverInstaller.exe file.
3. After install the driver , OS will reboot automatically.
4. After reboot , you can check if the driver install success or not by following steps.
Open Device Manager,choose "show hidden devices"
If there are 852Dio in Non-Plug and Play Drivers , the driver is installed success.
How to use this Demo Application
1. Press the "Start" button to test DIO function
2. Press the "Enable" button to test WDT function
3. Press the "Disable" button when WDT enable to disable WDT