This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Global Var

HI!!

I declared 3 global var, i call it inside diferent task and every execution this var should be updates but not to do it.
I have a 8051 under evaluation board.
Maybe can be a problem of my small micro?
What do u think about this?

Thanks

Parents
  • I understand your example.
    But in my code i have this:

    First iteraction
    SP=10 (setpint)
    PV=0 (value read from ADC)
    Kp=1
    P=KP*(SP-PV)=1*(10-0)=10
    
    Second iteraction
    SP=10 (setpint)
    PV=6 (value read from ADC)
    Kp=1
    P=KP*(SP-PV)=1*(10-6)=4
    
    but my pid->iState should be 10+4=14, and it is 4
    

    i dont know why dont save the old value in pid->iState

Reply
  • I understand your example.
    But in my code i have this:

    First iteraction
    SP=10 (setpint)
    PV=0 (value read from ADC)
    Kp=1
    P=KP*(SP-PV)=1*(10-0)=10
    
    Second iteraction
    SP=10 (setpint)
    PV=6 (value read from ADC)
    Kp=1
    P=KP*(SP-PV)=1*(10-6)=4
    
    but my pid->iState should be 10+4=14, and it is 4
    

    i dont know why dont save the old value in pid->iState

Children