ProblemwithPWMfrequency


Results 1 to 38 of 38

Threaded View

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


    Did you find this post helpful? Yes | No

    Default Re: ProblemwithPWMfrequency

    Hi,
    No you need one RETURN at the end of the subroutine. That RETURN makes the code return to line after the GOSUB, the @INT_RETURN makes it return from the interrupt handler.

    Are you sure you have the scope connected to the correct output?


    The first thing you need to do i make sure that the PIC and that simulator of yours is running properly and that you're using it properly. Remove all the interrupt and PWM stuff and then make a simple program that just toggles that LED1 output. Connect your "scope" and make sure you can see the output toggle on the scope.

    When and only when you have that working put the interrupt stuff back in but move the TOGGLE command to the interrupt handler - EXACTLY as shown here. Don't try to add all your PWM stuff.

    When and only when you can see that LED1 output toggling on the scope try adjusting the interrupt frequency and see if that works the way you want.

    EDIT: Now make sure that you can setup and control the dutycycle of the PWM module in the main loop (still no interrupts). Just toggle the dutycycle between two values and make sure you can see that on the scope.

    Now, when you have THAT working you are ready to start adding the PWM stuff.

    Don't try to skip a step until you have the previous one working and understand why and how.
    Last edited by HenrikOlsson; - 29th February 2012 at 18:31.

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