Generate Quadrature Signals with PIC16F1575

+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Junior Member gdesantis's Avatar
    Join Date
    Apr 2011
    Thumbs Up
    Received: 3
    Given: 0
    Total Downloaded
    4.71 GB

    0 Not allowed!

    Default Generate Quadrature Signals with PIC16F1575

    I had a requirement to generate two 100 KHz, 50% duty cycle signals that differed in phase by 90 degrees. Based on experience with the PIC16F1575, the solution involved using the MCU's PWM modules with its internal RC oscillator configured to operate at 32 MHz.

    A PWM frequency of 100 KHz corresponds to a period of 10 uSec and per the MCU datasheet we have:

    PWM Period = [(PWMxPR +1) * Prescale)] / (PWMxCLK)

    With a PWM period of 10 uSec, Prescale = 1 and PWMxCLK = 32 MHz, then 16-bit register PWMxPR must contain $0140 or 320 decimal.

    To achieve a PWM 50% duty cycle, 16-bit register 16-bit register PWMxDC must contain half of the Period register or 160 decimal. And, to achieve a 2.5 uSec PWM1 vs PWM2 offset, 16-bit register PWM1DC must contain 80 decimal.

    Based on the attached program, the following performance was noted.

    Frequency: PWM1 = PWM2 = 99.75 KHz

    Duty Cycle: PWM1 = PWM2 = 50% +/- 0.4%

    Phase Shift: PWM1 leads PWM2 by 2.5 microseconds
    Attached Thumbnails Attached Thumbnails Required_Quadrature_Output_1.jpg‎   Scope_Screenshot.jpg‎  
    Attached Files Attached Files

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.

    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues

    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


Similar Threads

  1. PIC16F1575 - PWM Output with Variabe Duty Cycle
    By gdesantis in forum Capture Compare / PWM Modules and Enhanced versions
    Replies: 0
    Last Post: 25th April 2016, 02:08
  2. Rotary/Quadrature Encoders .. yet again
    By Jessica in forum Projects discussion
    Replies: 33
    Last Post: 2nd October 2013, 00:10
  3. Quadrature encoder
    By See_Mos in forum Labcenter Proteus VSM
    Replies: 2
    Last Post: 21st November 2006, 16:22
  4. Built-in support for quadrature encoders
    By Eriond in forum Wish List / Product Feedback
    Replies: 10
    Last Post: 22nd March 2006, 13:02
  5. [SOLVED !] Inserting signals
    By cgriffin in forum Labcenter Proteus VSM
    Replies: 2
    Last Post: 17th November 2004, 13:36

Posting Permissions

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