Thank you very much Kurenai_ryu,
U1, U0 and error are parameters for the PI controller (Proportional, Integral)
PI Controller (proportional-integral controller) is a feedback controller which drives the plant to be controlled with a weighted sum of the error (difference between the output and desired set-point) and the integral of that value. It is a special case of the common PID controller in which the derivative (D) of the error is not used.
So: In this image I want to explain what I'm looking to do.
**broken link removed**
The digital control law is:
U(k) = U(k-1) + ([E (K)-E(K-1)] x kp) + (E(K) x ki)
U(k) present value
E(k) present value of error
U(k-1) previous value
E(k-1) previous value of error
E= Error, Input of PI controller
U=Output of PI controller
for example:
For k = 0, U (0) = (E(0) x kp) + (E(0) x ki)
For k = 1, U (1) = U (0) + ([E(1)-E(0)] x kp) + (E(1) x ki)
Etc ...
Example.
For k = 1, U(1) =U(0) + ([E(1)-E(0)] x kp) + (E(1) x ki)
U (1) = present value
U (0) = previous value
E(1) = present error
E(0) = previous error
Error = Input - Output
you get it in the picture
U(k) and U(k-1) int types are 16 bit
++++++++++++++++++++++++++++++++++++++++++++++++++ ++
So the project I'm achieving is to measure the output of our system and compare it with the input and the result is the error that is injected into the PI controller and calculates we'll have U (0). And we inject our system to adjust the system, and at each sampling step is done the same way, until the system becomes stable.
++++++++++++++++++++++++++++++++++++++++++++++++++ ++
At the programming level:
The PCF8591 will give us about AC analog output value of U(0)
to convert a PCF8591 8-bit, I test the high weight of U(0) ==> MSB
If there is a bit on the MSB, which equals 1
So: var = 0xFF
If there is not any MSB bit which equals 1 ==> MSB==0;
So: var = (char) U(0), that is to say, we will convert LSB (8 bits)
This value which is converted to digital from analog is injected into our system,
System (first order or second order)
And the output of our system we will get a voltage that is injected through the PIC18F PIN AN0 analog
And we calculate:
Error0 = Co - Ys or error0 = Input - Output
Then M = error0 - error1
Prop. = Kp x M;
Integ= Ki x Error;
U0 = U1 + + Prop + Integ;
And will proceed like this N times, until the system is stable.
*********************************************************
The ISIS file you gave me, on the winrar, it does not open
It appears a message at the opening, he told me that I must have the latest version of ISIS to open the file.
So what types of ISIS that you used ???
So what types of ISIS that you used ???[/b]