DT-Ints latency and other interrupt conciderations


Closed Thread
Results 1 to 40 of 59

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Hi,
    It "skips" 0 because when Position=Setpoint (ie. Error should be 0) neither of your < and > evaluations are true so it won't even calculate the error. Why it skips 65535 I haven't figured out though. Can you explain why you have those two comparison statements?

    All you really should need to do is pid_Error = Position - Setpoint or Setpoint - Position if you prefer it the other way around, it doesn't matter as far as the PID routine is concerned.

    Let's say pid_Error = Position - Setpoint (all three are 16bit variables):
    If Position is 10000 and setpoint is 9000 the error will be calculated to 1000
    If Position is 9000 and setpoint is 10000 the error will be calculated to 64536 (-1000)
    If Position is 1 and setpoint is 0 the error will be calculated to 1
    If Position is 0 and setpoint is 1 the error will be calculated to 65535 (-1)

    Just pass it to the PID-filter, it figures out the sign of the error.

    /Henrik.
    Last edited by HenrikOlsson; - 7th January 2010 at 20:52.

  2. #2
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    THAT FIXED IT!!

    man, thanks, and pardon my blindness. i did not know that the pid filter takes care of all the math! every little bit! the more reason of printing these pid filter code, framing it and hanging it on the wall next to the family portraits!!!

    i had it like that to fix a problem, when using two hpwm's the duty cycle would shift over to pwm2, from pwm1, and vice versa at position roll-over, no matter where setpoint was. that problem has dissapeared also.

    thats one hurdle over, and now over to implementing the power control on the same chip, to drive a h-bridge driver.

    this chip has 8 pwm outputs (4 complementary pairs) ill try as much as possible to implement full motor control from this same chip, as opposed to using a separate driver, like the lmd18200.

    thanks
    david m
    NAG CON WIFE!
    WIFE VAR MOOD

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    That's great!
    Yeah, the 18Fxx31 has some very cool features indeed. I intend to scale up as well once I get the basics going. My prototype uses the LMD18200 and I've abused it quite a bit, still haven't managed to let the smoke out of it though :-)

    Keep us posted on the progress!
    /Henrik.

  4. #4
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Cool Board design

    hi guys
    spent all weekend, maintaining the marriage, NFL playoffs and designing the board for the servo.
    attached is the board im trying to design. its nearly done, needs to be optimised, and copper flooded.
    im using eagle pcb pro.
    i decided to go the old school way; adjust pid variables using pots, and display them on a 20x2 lcd. later on, lcd will be replaced by serial communication, for serial lcd, or pc serial port.

    there are seven ports representing; i_term, output_clamp, integrator_clamp, minimum duty cycle, proportional, integral and derivative.

    i went to fire up my cnc pcb router, to make this board, and found out that my x-axis is completely dead. needs a new sla7078 unipolar driver. this is what im trying to replace with this servo project.

    ill probably order some 7078's, or use press and peel blue (thats how i was making boards before the router came along)

    im using the power control module on the 18f4431. its way much better than ccp pwm. its configured to use channels 0,1,2,3, in independent mode, so 0/1 produce same duty, and turn on at the same time, while 2/3 is off, and vice versa.
    the fet drivers are ncp5181, of which i could find at mouser.com, and has a bunch of application notes on the web.
    still optimising and trimming down the code, which is still undergoing extensive testing.
    have fun everyone....
    Attached Images Attached Images  
    NAG CON WIFE!
    WIFE VAR MOOD

  5. #5
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    cant figure out how to get a clearer image; wish we could post in .tiff format.
    Last edited by DDDvvv; - 10th January 2010 at 20:20. Reason: repeated

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Cool! The picture is fine!
    Personally I've been fighting with the serial buffer routines all weekend. I've got everything working in a separate program but when I tried to integrate it with the rest it started to act up.

    After to much trying this, trying that I decided to start over, deleted the current version and went back to an older one. Turns out it was older than I thought so now I have to redo a lot of stuff I thought I had backed up - stupid....

  7. #7
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default

    Hi Henrik,

    Discussion on the servo driver has been quiet for a while. I hope you haven't lost too much of your work!

    As far as the comm, are you just using it to adjust the PID or is the intent to feed data out frequently?

    Bo

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