SPWM_INT - Multiple Software PWM Question


Results 1 to 20 of 20

Threaded View

  1. #1

    Default SPWM_INT - Multiple Software PWM Question

    (I'm starting a new thread as none of the ones I searched which referenced 'SPWM_INT' seemed appropriate)

    I've implemented Darrel's excellent SPWM_INT include file together with ADCIN (reading a trim pot) to adjust the duty cycle for one pin (see my thread here). The problem is that (a) using 8-bit resolution (0-255) makes the LED brightness adjustment a little coarse, and (b) there's a delay in changing the duty cycle no matter how low I adjust the ADC_SAMPLEUS value. I'm willing to live with (b) but I'd like to move to 10-bit resolution to address (a).

    Is it just a matter of changing
    Code:
    DEFINE SPWM_RES 256
    to
    Code:
    DEFINE SPWM_RES 1024
    and then altering
    Code:
    DEFINE ADC_BITS 8
    to
    Code:
    DEFINE ADC_BITS 10
    and
    Code:
    ADCON1.7 = 1
    for right-justified values? Will that give me the finer control of LED brightness that I'm after?

    BTW, I'm using a PIC16F1825 with 16Mhz internal oscillator setting.

    Darrel's page (below) doesn't have the frequency range definitions like his earlier Multi-SPWM page, but I think this won't work with DC motors as the frequency needs to be greater than 16,000 Hz. Is that right?

    DT_INTS-14 (SPWM_INT - Multiple Software PWM)
    http://www.darreltaylor.com/DT_INTS-14/SPWM.html
    Last edited by RossWaddell; - 15th January 2013 at 20:14.

Similar Threads

  1. Darrel's Multiple Software PWM
    By passion1 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 15th October 2013, 15:21
  2. Replies: 1
    Last Post: - 4th March 2013, 21:57
  3. DT Multiple Software PWM and 18F2321 issue
    By microuser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2012, 08:23
  4. General Question About Multiple Interrupts
    By grzeh666 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 31st August 2008, 17:09
  5. Multiple HPWM question
    By Johan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th October 2007, 13:00

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