PID-filter routine (2nd try).


Closed Thread
Results 1 to 40 of 132

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Location
    Dallas, Texas, USA
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Thanks for the reply.

    Yes, makes sense to me. The process does accept a variable input, not on-off. It's a DC drive that I'm generating a reference voltage for using hardware PWM on a 18F2320 @ 40MHz. Sounds like this should work out fine.

    Once again, thanks!

    Mike

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Yes, what I meant with set the output to 0 was that if the ouput of the PID filter goes negative you "clamp" the dutycycle at 0 since you can't effectively have a negative drive with that system.

    In any case the second aproach should work better. Just a note though, in your first message you wrote:
    Likewise, I'll need to take the output of the PID include that gets passed back to the main process, and add/subtract the new output with the last output based on the direction bit, currently B.15.
    You don't add/subtract the PID filter output from the last output, you add/subtract it from the initial "steady state value". I guess you had that figured out but just in case.

    Let me know how it goes or if there's anything I can do.

    /Henrik.

  3. #3
    Join Date
    Nov 2009
    Location
    Dallas, Texas, USA
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    The routine works like a champ!

    Did the first trial run-up today. No problem at all with mono-polar operation. A few tweaks on the constants and it's working great. Need to make a small hardware change in external circuitry, and it'll be wound up.

    Again, thanks! A very handy tool to hang onto.

Similar Threads

  1. Darrel's latest 16 bit averaging routine?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 17th October 2009, 01:57
  2. 2nd order Low-pass passive RC filter on PWM
    By munromh in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th January 2009, 19:03
  3. Atod Digital Filter
    By GeoJoe in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd April 2008, 17:04
  4. PID controller in 16F737
    By joeri in forum mel PIC BASIC
    Replies: 8
    Last Post: - 24th June 2006, 11:39
  5. 2nd Order Digital Filter for 24-bit
    By sefayil in forum mel PIC BASIC
    Replies: 0
    Last Post: - 2nd December 2005, 21:55

Members who have read this thread : 2

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts