;File: wdt42cfg.a51
;Author: Eckart Hartmann Date:17/10/2003
;Development progress: Wdt834.df
;
;WdtCfg==========Initialise watchdog
;C Function prototype: char WdtCfg(char cCon);
;Description of Function: Writes cCon to the watchdog SFR WDCON.
;User interface: Put required value cCon in parameter1 then call WdtCfg.
;		Returns 0 if cCon invalid else 1.
;Robustness: cCon bit 0 may be 1 without problem.
;Side effects: Uses 2 stack levels.
;		Disables interrupts for 4 instruction cycles.
;		Overwrites a, p, c.
;
NAME	WDTCFG
$NOMOD51
 $IC(..kei842.inc) ; Parameter passing registers for Keil .
 $IC(..kei842.dat) ; SFR definition for Keil .
;
public	_WdtCfg
;
?PR?_WdtCfg?WDTCFG   SEGMENT CODE
	RSEG  ?PR?_WdtCfg?WDTCFG
	USING	0
;
_WdtCfg:
	mov	a,cp1l		;If cCon invalid
	jnb	ACC.7,WdIDo
	jb	ACC.6,WDIBad
	jnb	ACC.5,WdIDo
WdIBad:	mov	cp1l,#0		; return with 0.
	sjmp	WdCfR
WdIDo:	mov	c,EA		;Save EA for later.
	clr	EA		;Write cp1
	setb	WDWR
	mov	WDCON,cp1l	; to WDCON.
	mov	EA,c
	mov	cp1l,#1		;Return success.
WdCfR:	ret
;
;Function End==========================================================Function End
END

