Ramp up down? Code ideas.


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    Did you find this post helpful? Yes | No

    Default Re: Ramp up down? Code ideas.

    if you were to use proper complementary numbers to represent your controller power then


    F(999) could be -999 and 0(345) would be 345

    ie actual = -999 desired = 345
    -999-345=-1344
    means desired is -1344 below required
    to get there in 100 x 10mS steps [1 second] just add 13.4 for the next 100 generations


    to go back
    345-(-999)=1344


    means desired is 1344 over required


    to get there in 100 x 10mS steps [1 second] just subtract 13.4 for the next 100 generations


    the controller can figure if its assist or regen simply by testing bit.15


    by rounding down the incrementor you will easily get within 10% will no fuss
    never underestimate the beauty of unsigned subtractions with complementary numbers


    to convert from pos to negative number n=~n+1
    to convert from negative to pos number n=~n+1



    ps never try to divide or multiply a negative number
    ie.
    inc = abs(difference)/100
    Last edited by richard; - 25th November 2023 at 05:47.
    Warning I'm not a teacher

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Ramp up down? Code ideas.

    Thanks for those.

Similar Threads

  1. Linear acceleration ramp
    By pxidr84 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th May 2012, 06:27
  2. Code optomization ideas...(link)
    By Heckler in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th February 2012, 16:07
  3. Making code more efficient, any ideas please?
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th July 2011, 13:28
  4. Make an acceleration/deceleration ramp : any ideas?
    By pxidr84 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 3rd April 2011, 23:19
  5. Ideas on ir-code for dimmer
    By tirithen in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th February 2009, 23:22

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