How to setup 38kHz PWM with PIC18F1330


Results 1 to 15 of 15

Threaded View

  1. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: How to setup 38kHz PWM with PIC18F1330

    Hi,
    If you set PTPER to 51 with the prescaler set to 1:1 and 8MHz clock you'll get a PWM period of 26us which 38461Hz, set it to 52 and you'll get 37736Hz.

    Just remember that the resolution won't be 14 or even 10 bits at that PWM frequency and oscillator frequency. Forumla says you'll get 7.7bits which would be a dutycycle value of 0 to 246 or there abouts.

    /Henrik.

    EDIT: Oh, and the highest frequency possible would be when you set PTPER to 1 which would give you a PWM frequency of 1MHz. The resolution will be 2 bits.
    Last edited by HenrikOlsson; - 5th March 2015 at 18:31.

Similar Threads

  1. 38Khz Modulator
    By Gord11 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th September 2011, 08:14
  2. manual hardware PWM setup on 16F1824
    By comwarrior in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 31st January 2011, 18:34
  3. Use Button For setup
    By tump in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 21st November 2007, 19:43
  4. Generated square wave 19Khz and 38Khz
    By blinkstar88 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th August 2007, 16:40
  5. pic12f683 setup
    By erice1984 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th July 2007, 11:48

Members who have read this thread : 0

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