Linear acceleration ramp


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Linear acceleration ramp

    Quote Originally Posted by SteveB View Post
    Thanks for mentioning that Charlie! (I forgot too)

    It would certainly simplify the code. I went with the non-LONG method in the case that Pxidr84 might not have PBP3, and so no LONG variables. But yes, I would definitely use them if available. Either way, hopefully the methodology of the example is instructive in learning to scale integers to fit into the given variable space.

    Also, there is a correction I need to make to the code. I forgot an ENDIF:

    Code:
         IF mSec_Ticks > (cacc * cacc_div) THEN
            IF freq < ref THEN freq = freq + 1
            mSec_Ticks = mSec_Ticks - (cacc * cacc_div)
            IF freq >= ref THEN
               GOSUB StopTimer
               GOSUB ResetTime
            ENDIF
         ENDIF
    Sorry about that.
    I think that my PBP 2.6 support LONGs... I can't exceed 65s, but right now it's not important.

    I've maybe find an another way (only for make a timer without PAUSE):

    -Use a "fixed" frequency low priority interrupt
    -Increment a value at each interrupt execution (for exemple, incr=incr+1)
    -And execute the ramp code if "incr" as reached a certain calculated value (actually it's "cacc" and "cdec"), and then reset "incr" to zero.

    Really, I don't need a nanosec precision for this ramp.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Linear acceleration ramp

    PBP 2.6 suppoerts LONGS with 18F devices. You just need to select "Use PBPL" for the compiler.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Linear acceleration ramp

    Quote Originally Posted by pxidr84 View Post
    -Use a "fixed" frequency low priority interrupt
    -Increment a value at each interrupt execution (for exemple, incr=incr+1)
    -And execute the ramp code if "incr" as reached a certain calculated value (actually it's "cacc" and "cdec"), and then reset "incr" to zero.
    Did you see post # 8?

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Linear acceleration ramp

    Quote Originally Posted by SteveB View Post
    Did you see post # 8?
    Yes I've see your post, but I've not tried it yet, I will do that today.

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