;File: wdt42kk.a51
;Author: Eckart Hartmann Date:17/10/2003
;Development progress: Wdt834.df
;
;WdtKk==========Kick watchdog.
;C Function prototype: char WdtKk(void);
;Description of Function: Restarts watchdog timeout if watchdog on.
;User interface: Call WdKk. Returns 1 if watchdog was running else 0.
;Robustness: No known issues.
;Side effects: Disables interrupts for 4 instruction cycles.
;		Overwrites a, p and c.
;
NAME	WDTKK
$NOMOD51
 $IC(..kei842.inc) ; Parameter passing registers for Keil .
 $IC(..kei842.dat) ; SFR definition for Keil .
;
public	_WdtKk
;
?PR?_WdtKk?WDTKK   SEGMENT CODE
	RSEG  ?PR?_WdtKk?WDTKK
	USING	0
;
_WdtKk:	mov	a,WDCON		;If watchdog condition wrong
	jnb	ACC.1,WdKBad
	jnb	ACC.7,WdKDo
	jb	ACC.6,WdKBad
	jnb	ACC.5,WdKDo
WdKBad:	mov	cp1l,#0		; return 0.
	sjmp	WdKR
WdKDo:	mov	c,EA		;Save EA for later.
	clr	EA		;Write 1 to WDE.
	setb	WDWR
	orl	WDCON,#2
	mov	EA,c
	mov	cp1l,#1		;Return success.
WdKR:	ret
;
;Function End==========================================================Function End
END


