PDA

View Full Version : Hardware PWM Question?



jhorsburgh
- 18th August 2008, 02:20
Hi All,
I have found the code below on the Rentron for Infrared Serial Communication;

<code>' Initialize hardware PWM - IRLED 40KHz drive

PORTB = %00000000 ' PortB = 0 : IRLED On PortB.1 Off
TRISB = %00000000 ' PortB = all outputs
CCPR1L = 62 ' Set PWM Duty-Cycle to 50%
PR2 = 124 ' Set PWM for 40KHz
CCP1CON = %00001100 ' Mode select = PWM
T2CON = %00000100 ' %00000100 = TMR2 ON 1:1 pre-scale</code>

How would i go about changing this to 50% Duty-Cycle at 38Khz?

Thanks,
Jeremy

skimask
- 18th August 2008, 03:07
A lifesaver for sure...

http://www.mister-e.org/pages/picmulticalcpag.html

Jeremy :D