I used an Aun's SBC84500 motherboard (GEode's CPU), which could be customized with PB. There is an 8-channel digital IO port on the motherboard. The address is 0x123, and also has a function of watching the dog. I am planning to join the control of the digital IO port in my program, and the function of the watchdog. I first tried the function of controlling the digital IO port. I used the way to embed the assembly language in the VC. The code is as follows: void ciocontroldlg :: onbuttonset () {// Todo: add your control notification handler code here // All positions 1 __ASM {MOV DX, 0X123 MOV Al, 0xFF OUT DX, Al} Return;
Void CiocontrolDlg :: OnbuttonClR () {// Todo: add your control notification handler code here // All bit clear 0 __asm {MOV DX, 0X123 MOV Al, 0x0 OUT DX, Al}} The level of the IO port is detected. The test was successful.
Then, start the test of the door dog's function, first short to short the watchdog jumper on the motherboard, open the watchdog function, write code: // IO Output function void outportbyte (word addr, byte prnch) {_ASM { Push AX Push DX MOV DX, Addr Mov Al, PRNCH OUT DX, Al Pop DX POP AX}} // Start Doing Dog Void CWDTDLG :: OnbuttonenEnabletimer () {// Todo: Add Your Control Notification Handler Code Here // OUT 120H 0AH; ENTER WDT Function // OUT 120H 0BH; Enable WDT Function Outportbyte (0x120, 0XA); OUTPORTBYTE (0x120, 0XB); // OUT 120 0NH; N = 1, 2, 3 or 4 Outportbyte (0x120, 2 ); // OUT 121 0MH; M = 0, 1, 2, ... f Outportbyte (0x121, 0);
} // Reset Watch Dog Void CWDTDLG :: OnbuttonResetTimer () {// Todo: Add Your Control Notification Handler Code Here // OUT 121 0MH; M = 0, 1, 2, ... f Outportbyte (0x121, 0);} // Stop the watchdog void cwdtdlg :: onbuttondisabletimer () {// Todo: add your control notification handler code here // out 120 00h; Can be be disable at any time outputbyte (0x120, 0);} After running, discovery The watchdog does not work.
I suspect that I have a problem with the manual, there is a problem with the documentation of the door dog programming, and I have searched online, I saw a page at the website of Aifu, I saw a page http://www.axiottek.fr/faq.php, there is About the Narration of Watchdog Questions: How To Use Dos Command / "Debug /" To Trigger Watchdog Function Of SBC84600? Answer: Firstly, please set The Jumper To Reset Mode of Watchdog Function. And Use Dos Command / "Debug /" TO Trigger Watchdog Function AS Below.-O 120 0A-O 120 0B-O 120 02 (N = 2) -O 121 00 (m = 0) The System Will Reboot After 5 Seconds Automatic Or / 's Manual, IT Provides The detail information. I followed the entry DOS, using Debug, type the code, and found that the watchdog function is normal.
So I went online again, go shopping in the WINCE forum, inside the way to access the IO port to MMMapiospace, VirtualaLoc / VirtualCopy, map the physical address of the IO into the virtual address, and then operate the virtual address. So refer to the method, I used MMMapiospace, found in my PC, the program cannot be compiled, add #include
void OutPortFun (WORD wAddr, byte bValue) {PHYSICAL_ADDRESS IoAddress; IoAddress.LowPart = wAddr; // hardware address IoAddress.HighPart = 0; UCHAR * gpioPtr; gpioPtr = (UCHAR *) MmMapIoSpace (IoAddress, 1, FALSE); WRITE_PORT_UCHAR ( Gpioptr, bvalue);} // Start the door-door dog void cwdtdlg :: onbuttoneneniletimer () {// Todo: add your control notification handler code here // out 120h 0ah; enter wdt function // out 120h 0bh; enable WDT Function OUTPORTFUN (0x120, 0xa); OUTPORTFUN (0x120, 0xb); // OUT 120 0NH; N = 1, 2, 3 or 4 OUTPORTFUN (0x120, 2); // OUT 121 0MH; M = 0, 1, 2, ... f outputfun (0x121,0);} // Stop watchdog void cwdtdlg :: onbuttondsabletimer () {// Todo: add your control notification handler code here // out 120 00h; can be be disable at any time outputfun (0x120 , 0);} // Reset Watch Dog Void CWDTDLG :: OnButtonResetTimer () {// Todo: Add Your Control Notification Handler Code Here // OUT 121 0MH; M = 0, 1, 2, ... f OutportFun (0x121, 0);