beautypg.com

Wdt0 dos example – AAEON PFM-535S User Manual

Page 38

background image

P C / 1 0 4 C P U M o d u l e

P F M - 5 3 5 S

Appendix A Programming the Watchdog Timer A-5

WDT0 DOS Example

#include

#include

void main()

{

unsigned char c;

unsigned int lTime;

outp(0x22,0x13); // Lock register

outp(0x23,0xc5); // Unlock config. register

// 500 mini-second

lTime = 0x20L * 500L;

outp(0x22,0x3b);

outp(0x23,(lTime>>16)&0xff);

outp(0x22,0x3a);

outp(0x23,(lTime>> 8)&0xff);

outp(0x22,0x39);

outp(0x23,(lTime>> 0)&0xff);

// Reset system

outp(0x22,0x38);

c = inp(0x23);

c &= 0x0f;

c |= 0xd0; // Reset system. For example, 0x50 to trigger IRQ7

outp(0x22,0x38);

outp(0x23,c);

// Enable watchdog timer