Hardware PWM Question?


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007
    Posts
    34

    Default Hardware PWM Question?

    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

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

Similar Threads

  1. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 07:03
  2. Inverting the o/p of hardware PWM
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th August 2008, 20:36
  3. PWM: Vernacular/Function (Newbee)
    By TerryN in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd July 2008, 17:58
  4. FREQOUT - PWM question
    By Etcho in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 26th February 2007, 00:51
  5. pics with 3 hardware PWM ports
    By CBUK in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th August 2004, 01:14

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts