PID-filter routine (2nd try).


Closed Thread
Results 1 to 40 of 132

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I'm not sure I understand....sorry....

    First of all, the SETPOINT variable you have - is it declared as a LONG or as a WORD? If declared as a WORD then I'm not sure how this...
    Code:
    select case setpoint ; Circular count for Setpoint condition
    case is > 65535 ; Circular count for Setpoint condition
    ...will work or what it'll evalute to. A word variable will "automatically" wrap around from 65535->0 and from 0 to 65535. If setpoint is declared as a LONG that seems not needed since you're trying to reset it 0 once it goes above 2^16.

    Then there's this line:
    Code:
    IF POSITION pid_Error = setpoint - position
    Does it really compile like that?

    If you have code that compiles correctly, please post it and I promise I'll do my best to help you. You may also be interested in this thread

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default

    thanks for the quick reply

    the setpoint is a word variable, and resets itself from 65535 to 0 and vice versa.
    there must have been an error when i copied and pasted, because the sentence reads:

    pid_error = setpoint - position

    this is a very buggy piece of code, and when i get it working, im going to rearrange and clean it up good.
    NAG CON WIFE!
    WIFE VAR MOOD

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, 02: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, 20:03
  3. Atod Digital Filter
    By GeoJoe in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd April 2008, 18:04
  4. PID controller in 16F737
    By joeri in forum mel PIC BASIC
    Replies: 8
    Last Post: - 24th June 2006, 12:39
  5. 2nd Order Digital Filter for 24-bit
    By sefayil in forum mel PIC BASIC
    Replies: 0
    Last Post: - 2nd December 2005, 22: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