include "m8c.inc"
include "psocapi.inc"

export	_PRSPWM_WritePulseWidth
export	dur

area	bss(RAM)
dur:	blk	2


area	text(ROM,REL)
_PRSPWM_WritePulseWidth:
	mov		[dur],x
	mov		[dur+1],a

	
	mov		a,[dur]
	lcall	PWM8_C_WritePulseWidth
	mov		a,[dur]
	lcall	PWM8_D_WritePulseWidth
	mov		a,[dur+1]	
	mov		reg[PRS8_B_SEED_REG],a
	ret

;	if you want to write this asm file in C-language, you can write as follows
;
;	void PRSPWM_WritePulseWidth(WORD dur)
;	{
;		WORD tmp = (dur >> PRS_PWM_RES_BITS); 
;		BYTE pw = tmp;
;	
;		PWM8_A_WritePulseWidth(pw);
;		PWM8_B_WritePulseWidth(pw);
;	
;		PRS8_SEED_REG = dur;  
;	}