beautypg.com

Appendix a, Programming watchdog timer – Lanner LEC-7100 User Manual

Page 32

background image

29

Programming Watchdog Timer

Embedded and Industrial Computing

Appendix A

temp |= 0x04;
write_w83627_reg(0, 0x2b, temp); //set watchdog pin
write_w83627_reg(0x8, 0xf6, 0); //LDN=8, CRF6, stop

timer first
write_w83627_reg(0x8, 0xf5, read_w83627_reg(0x8, 0xf5)

& 0xf7); //;set
second
write_w83627_reg(0x8, 0xf7, read_w83627_reg(0x8, 0xf7)

& 0xef); //;clear
status
write_w83627_reg(0x8, 0x30, read_w83627_reg(0x8,

0x30) | 0x01); //;enable
LDN8
temp = time;
write_w83627_reg(0x8, 0xf6, temp); //LDN=8, CRF6, set
watchdog timer time-out value
outportb(INDEX_PORT, 0xaa); //Exit W83627HF
Configuration
return 0;
}
int read_w83627_reg(int LDN, int reg)
{
outportb(INDEX_PORT, 0x07); //LDN register
delay(1);
outportb(DATA_PORT, LDN);
delay(1);
outportb(INDEX_PORT, reg);
delay(1);
return inportb(DATA_PORT);
}int write_w83627_reg(int LDN, int reg, int value)
{
outportb(INDEX_PORT, 0x07); //LDN register
delay(1);
outportb(DATA_PORT, LDN);
delay(1);
outportb(INDEX_PORT, reg);
delay(1);
outportb(DATA_PORT, value);
return 0;
}

{For sample watchdog code, see watchdog folder on the

Driver and Manual CD