Multi Slow speed PWM and Instant Interrupts


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94

    Default Multi Slow speed PWM and Instant Interrupts

    I am using a 18F14K50 with Instant Interrupts to refresh USB service. I want to use the slow speed PWM code Darrel Taylor has posted way back when.

    I am using PBP 2.6 MPLAB 8.33.

    The program excluding Slow Speed PWM compiles and works fine.

    When I add (Include "Multi_SPWM.pbp" ) I get these errors
    ERROR Line 23: Redefinition of VAR. (DT_INTS-18.bas)
    ERROR Line 24: Redefinition of VAR. (DT_INTS-18.bas)
    ERROR Line 25: Redefinition of VAR. (DT_INTS-18.bas)


    If I comment the wsave, ssave and bsave in Multi_SPWM.pbp I get these errors

    Duplicate macro name (int_return)
    Unmatched ENDM

    I assume it is a conflict between the multi slow speed PWM and the instant interrupt codes. I do not know if it is possible to run both at the same time.

    Thanks

    Dave

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,

    You can use the SPWM_INT version with DT_INTS-18.

    http://www.darreltaylor.com/DT_INTS-14/SPWM.html
    <br>
    DT

  3. #3
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel

    I will give it a try.

    Dave

  4. #4
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Darrel

    It worked great

    Thanks again

    Dave

  5. #5
    Join Date
    Dec 2007
    Location
    Paris
    Posts
    101


    Did you find this post helpful? Yes | No

    Default

    Trying to get that setup working too, PIC18F14K50 and these:

    Code:
    INCLUDE "cdc_desc.bas"
    INCLUDE "DT_INTS-18.bas"
    INCLUDE "ReEnterPBP-18.bas" 
    INCLUDE "SPWM_INT.bas"
    INCLUDE "USB_ASM_Service.pbp"
    
    ASM
    ;----[High Priority Interrupts]-------------------------
    INT_LIST  macro     ; IntSource,          Label,  Type, ResetFlag?
            INT_Handler     INT0_INT,   _ButtonPressed,   PBP,  Yes
            INT_Handler   TMR1_INT,  SPWMhandler,  ASM,  yes
            INT_Handler     USB_INT,  _DoUSBSERVICE,   PBP,  yes
        endm
        INT_CREATE ; Creates the High Priority interrupt processor
    ENDASM
    However I'm having a hard time to get a smooth PWM output that is not perturbed by the DoUSBSERVICE routine... So far the best results I got is by inserting INT_DISABLE USB_INT / INT_ENABLE USB_INT into the SPWMhandler, however the output still flicker quite a bit. I also tried to turn USB_INT into a lower priority interrupt but that doesn't work (the PIC does crash).

    Is there a particular solution to make them work together? any hint on this would be greatly appreciated.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    USB_INT should be an ASM "type" interrupt. I think we talked about that before.
    Make it low priority.

    How many SPWMints, what freq, what resolution.
    Not enough information, and I'd guess you are maxed out.

    Remember ... 25,600 interrupts per second for SPWM_RES 256 @ 100hz.
    DT

Similar Threads

  1. 18F2420, instant interrupts, and TMR0
    By dhickman in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 11th March 2009, 18:33

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