A slicker way to be constantly changing the duty cycle?


Results 1 to 15 of 15

Threaded View

  1. #12
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: A slicker way to be constantly changing the duty cycle?

    Hi Guys.

    Firstly Bert....apologies I didn't post the full code (ironically, I thought for simplicity's sake)....further up my program, I had exactly as you'd outlined, namely...

    Code:
     
    CCP2CON.4 =  duty.0
    CCP2CON.5 =  duty.1
    CCPR2L.0   =  duty.2 
    CCPR2L.1   =  duty.3
    CCPR2L.2  =   duty.4
    CCPR2L.3  =   duty.5
    CCPR2L.4  =   duty.6
    CCPR2L.5  =   duty.7
    in fact I tried Henrik's simpler way first, but when that didn't work (ie period register didn't update as I thought they should), I mapped them longhand as above.

    Apologies for not showing the full picture....and many thanks for helping me out (again!)

    Henrik,

    Sometimes I get so wrapped up that I lose sight of the obvious (I had many things on the go yesterday ....ultimately cracking a long standing coding issue (yay) ....but while doing so, I think my brain got fogged).....yep, my variable 'Duty' is not 'tracked' in real time as it were, which means I do need to update the period setting bits bt y pointing at my variable everytime I wish to change the duty...so yes, your sub routine is the order of the day.

    Many, many thanks

    ....thanks heavens for forums like this with people so willing to help.
    Last edited by HankMcSpank; - 24th April 2011 at 10:40.

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