;File: pwm42w8.asm
 ; Author: Eckart Hartmann Date:17/10/2003
 ; Development progress: Pwm834.df
;
;PwmW8==========Write 8 bit:
;C Function prototype: char PwmW8(char cCh, char cValW, char cValC).
;Description of Function: Select mode and clock source and prescaler.
;User interface: Set parameter1 to 0 to write PWM?L or non zero to 
;		write PWM?H. Put the PWM0? value in parameter2 and the 
 ; PWM1? value in parameter3. See Description
;		for more details.
;		Call PwmW8. If in 8 bit mode or mode 0, writes values and  
;		returns 1 else just returns 0. 
;Robustness: Changes only become effective at the end of the current PWM 
;		cycle.
;Side effects: Overwrites a, P, c.
;
NAME PWMW8
$NOMOD51
 $IC(..kei842.inc) ; Parameter passing registers for Keil .
 $IC(..kei842.dat) ; SFR definition for Keil .
;
public _PwmW8

?PR?_PwmW8?PWMW8	SEGMENT CODE
	RSEG	?PR?_PwmW8?PWMW8

_PwmW8:	mov	a,PWMCON	;If 8 bit mode
	anl	a,#070h
	jz	Pw8Do
	cjne	a,#20h,Pw8Q5
	sjmp	Pw8Do
Pw8Q5:	cjne	a,#50h,Pw8R0	; {
Pw8Do:	mov	a,cP1l		; if(cCh==0)
	jnz	Pw8H		;  {
	mov	PWM0L,cP2lc	;  PWM0L = cP2lc;
	mov	PWM1L,cP3lcc	;  PWM1L = cP3lcc; }
	sjmp	Pw8R1		; else {
Pw8H:	mov	PWM0H,cP2lc	;  PWM0H = cP2lc; 
	mov	PWM1H,cP3lcc	;  PWM1H = cP3lcc; }
Pw8R1:	mov	cP1l,#1		; return 1;
	sjmp	Pw8R		; }
Pw8R0:	mov	cP1l,#0		;else return 0;
Pw8R:	ret
;
;Function End==========================================================Function End
END
;

