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
For Erik!!
What is your problem??????? I have no problem
Im a student and i work too hard to learn it why, then, does it upset you that I tell you HOW to learn it?
Erik
are you actually writing into the piece of memory pointed by iA? show that please...
In this funtion, i return pid->iState, first this var returned 10 and after returned 4 and should return 14.
Have you made sure that your function thinks pid->Ti is non-zero, so it has a reason to update pid->iState?
Thanks Per!!!
real is my data type, now is int but i created this for future changes.
The implementation is important Yeah!!! but i think that it is OK:
error = SP - PV; P = pid->Kp*error; if (pid->Ti){ I = pid->iState*(pid->Kp*(pid->Ts/pid->Ti)+ pid->Kwindup); pid->iState = pid->iState + error; }else I=0; if (pid->Td){ D = (pid->Kp*(pid->Td/pid->Ts)*(PV - pid->dState)); pid->dState = PV; }else D=0; v = P + I + D;
this is a piece of code. For example the pid->iState it is not updated!!!
I dont know where is the problem.
OK!!sorry.
Erik Did respond. He noted - as several others - that you supplied to little info for anyone to come with suggestions. He also noted that you seemed to be doing things you where not comfortable with, and I would think most other readers would agree.
I asked you for the function implementation, since it is the function that will assign any new values to your global variable. By the way - why a pointer to a global variable? Do you have multiple global variables of the same type, and sometimes send the address to one variable, and sometimes the address to another?
You said: "The funtion implementation i think that is not important to resolve my problem."
If the function does not perform any assign using the pointer, then your global variable will not be updated. Obviously the implementation of the function seems to be very, very relevant, don't you think?
Another thing - real is int? Is that your own data type, or an assumption about the Keil float? Every programmer who sees the name "real" will map into their brain the very obvious notation that real is NOT an integer. A real should be a floating point value - or in some situations maybe a fixed-point value. But when you work with finite-resolution fixed-point values, you normally name them according to their size, just so you always know how many decimals you have. This is very important when multiplying two fixed-point numbers which produces twice as many decimals as the original numbers had.
Tamir!
How you implement a PID in a task to controller a system?? Thanks
java,
you must be please excuse sir erac becasue he is sometimes makeing joke he thinking is funng but is not funny and is lokking very bad you be thinking!!!!!
pleaes remember he is very old and wise and he wanting respect from every one and he may be sometimes he giving good ansewr.
What is your problem??????? Im a student and i work too hard to learn it. If you dont want response my problem is not necesary your answer!!!!
Good luck!!
Hi Tamir,
My idea is: - I have a WRITE task that initialize the PID task:
os_create_task(A); os_create_task(B); os_create_task(C); os_wait(K_SIG, WAIT_FOREVER,0); /* Espera hasta que algun PID actualice el valor */ os_clear_signal(WRITE);
This 3 task should update my global var called iAiBiC respectly.
After i send the result of the PIDs to serial port for comunications with a simulator.
The data type is :
typedef struct { real dState; /* Ultima posicion */ real iState; /* Estado del integrador */ real uMax,uMin; /* Saturacion del actuador */ real Kp; /* Ganancia proporcional */ real Ti,Td; /* Cte, tiempo integral y derivativo */ real Ts,Tt; /* Periodo muestreo, Cte. tiempo tracking */ real Kwindup; /* Cte. antireset windup */ } SPid;
The funtion implementation i think that is not important to resolve my problem. This is the top of the funtion:
real UpdatePID (SPid *pid, real SP, real PV, unsigned int AUTO,real Uman) reentrant;
real is int data type
that is being wise words of wisdom from the very wise old man!!!!!!
I am not sure I understand what you are doing here: are you terminating the task that does your PID calculations just after one cycle? this is not the way to implemented a closed loop using a PID controller, of any controller whatsoever that is based on feedback.
You show a global variable of an unknown data type.
You show that you send the address of the variable to a function.
You do not show the function implementation
Exactly what do you think will be able to deduce from this?
View all questions in Keil forum