Need help with understanding PID control


Closed Thread
Results 1 to 12 of 12

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Need help with understanding PID control

    hex 324 = dec 804 , 804/256 = 3.14

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


    Did you find this post helpful? Yes | No

    Default Re: Need help with understanding PID control

    Hi,
    Richard covered the gain calculations, not much to add to that.
    Your problem is most likely the line
    Code:
    Drive_T=Drive_T+Drive_P '(I used DriveT=Drive_T+... to keep some level of drive)
    Drive_T will accumulate to very large numbers and you don't show what type variable it is. If it's BYTE then you'll be in even more trouble because it won't work properly adding Drive_P when that value is negative. For that to work both variables need to be the same size - which they might be, I don't know since you don't show the code. If you insist on keeping that line you should probably consider clamping Drive_T too so that it won't go higher than 255 in this case.

    With a gain of 9 ($0900) the output will be saturated whenver the error is 29 or more (because 29*9=261). To get more resolution I'd probably skip using HPWM and set the CCP module up manually, that way you can 10bit PWM resolution instead of 8.

    /Henrik.

Similar Threads

  1. PID help
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th November 2011, 06:32
  2. Replies: 0
    Last Post: - 27th March 2011, 20:10
  3. Re: PID control + radiant heating
    By Steve_88 in forum Off Topic
    Replies: 2
    Last Post: - 18th January 2011, 13:11
  4. Pid
    By colarsson in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd November 2005, 10:18
  5. PID control with Picbasicpro
    By swordman in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th August 2004, 14:37

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