gnupic: PWM in assembler
Subject:
Re: PWM in assembler
From:
Snail Instruments ####@####.####
Date:
19 Nov 2004 20:35:51 +0000
Message-Id: <6.1.2.0.0.20041119212533.03cc9250@pop.iol.cz>
>something improperly, Then I began to suspect other things. Having
>encountered the same problem with different simulators
Make sure the simulator supports the PWM function.
>reset ccp1con (17h)
>
>set bits 2,3 in 17h
>set the period of the PWM in PR2 (92h)
>
>set the duty cycle by writing to ccpr1l (15h)
> set the LSBs for duty cycle in bits 4,5 in ccpr1l (17h)
>
>clear trisC bit 2
>
>set t2con (12h) bit 2 for prescale value
>
>Now, the manual specifies enabling the CCP1 module.
Perhaps enable interrupt? But this is unnecessary for the function of PWM.
Only make sure the duty cycle is smaller then the period, otherwise the
output pin never goes low.
BTW, I think your ccp module is setup correct, have you tried it with the
real silicon? My experience comes from the 16F877 part, but I believe the
CCP module is very similar (if not identical).
Josef