• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PWM Code Help

Not open for further replies.


Active Member
I have a strange problem.If I comment the delay line the code works fine.With that delay line I cannot hear any sound.

Init_PWM	movlw	b'00001100'	; PWM Mode
		movwf	CCP1CON
		movlw	b'00000010'	; PS=1:16,T2=ON,Post=1:1
		movwf	T2CON
		bsf	STATUS,RP0	; b0
		movlw	.15
		movwf	PR2
		bcf	STATUS,RP0	; b0
		movlw	.8		; 125 = 50% duty cycle
		movwf	CCPR1L
		bsf	T2CON,2		; enable TMR2
		[COLOR="Red"]call	Del_1S[/COLOR]
		clrf	CCPR1L
;			;
Wait_Here	goto	Wait_Here
Last edited:
Not open for further replies.

EE World Online Articles