Darrel's SPWM and LCDOUT


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Feb 2007
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Darrel's SPWM - stop/start SPWM

    Hi to all.

    I never stop to thaks Darrel for he very useful SPWM.

    Using it, I have found the necessity to stop and then later start or restart restart the SPWM having the same value for each SPWM channel.

    During the stop period all the channels/pin should be set high or low a desidered.

    Could you please suggest the best way to stop and start the SPWM.

    Ciao

    Leo

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I think you just need to start/stop Timer1
    Code:
    TMR1ON=0    ' Stop Timer1
    TMR1ON=1    ' Start Timer1
    OR, you disable/enable the TMR1 interrupt
    Code:
    @   INT_DISABLE TMR1_INT 
    @   INT_ENABLE  TMR1_INT
    and then, you set your pin the way you want.
    Last edited by mister_e; - 20th April 2008 at 11:56.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking

    Hi,

    Having a look to the listing ...

    line 2 : CLEAR ' Clear all variables to 0LED


    ... OLEDS are far slower than classical LCDs ...

    I think we already had this discussion on the Forum ...


    Cool ... this is not an OLED Display !!! .........LoL !


    May be DEFINE LCD_DATAUS could be a little bit raised ( 44 > 50 i.e. )

    Alain
    Last edited by Acetronics2; - 20th April 2008 at 13:22.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Wirecut View Post
    I never stop to thaks Darrel for he very useful SPWM.
    You are very Welcome Leo. Glad you could use it.

    Using it, I have found the necessity to stop and then later start or restart restart the SPWM having the same value for each SPWM channel.

    During the stop period all the channels/pin should be set high or low a desidered.

    Could you please suggest the best way to stop and start the SPWM.
    Well,
    Just stopping the Timer or Disabling the interrupt will leave everything in mid-cycle.
    Then turning the Timer back on later will cause all channels to finish the cycle it was in the middle of, and continue with the dutycycle last assigned.

    I think the best way is to set all the DutyCycles to either 0 or the Max Res +1. Which will give an orderly "Stop" at the end of the Cycle.

    If the DutyCycle variables are grouped in an array like shown in my original examples, then you can just do a FOR loop, to assign them all to the same value.

    Code:
    For i = 0 to 4
        DutyVars[i] = 0
    Next i
    <br>
    DT

  5. #5
    Join Date
    Feb 2007
    Posts
    37


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel,

    many thanks for your suggestion.

    I will try to implement both solution either 0 or the Max Res +1.

    Ciao

    Leo

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