First of all, i would like to thank Mr. Olsson for his great work.
Currently i'm working with the AC heater, driven by the SSR. This heater is very inertial and slow, in particular dropping the temperature.
In order to drive it, i implemented some sort of rude PWM, which looks as following:
---------------------------------------------------------
pid_Out_Clamp=200
' i also set the pid_Out value to 0 in case of direction flag is raised (pid_Sign = pid_Out.15 thing)
loop:
period=2000 'period of PWM in mS
time_on=pid_Out*10 ' i feed to pid filter the temperature, not the ADC value, therefore multiplication in order to scale to the period. Or this is wrong and i should use pid_Out value directly?'
HIGH portc.3
PAUSE time_on
time_off=period-time_on
LOW portc.3
PAUSE time_off
LCDOUT ...
GOTO loop
-----------------------------------------------------------------
Now, i have run a test and the filter seems to work, except it gives an overshoot on the beginning, but then stabilises 1-2 degrees below target.
Now i would have to tune the gains and i tried to understand the explanation of the HEX format, but unfortunately it is not completely clear for me. Are you using this representation in order to have floating point values?
I just can't get the inverse conversion algoritm from, let's say, 2.55 to HEX.
As i undersand, in this case it would be $02..<-- here should come 0.55 part.
So, using your example: "FF represents 1/256*255 or 0.996. If you'd feed it 102 from the ADConverter it would be the same as $0066 or a gain of 0.258."
1/256*x=0.55 --> x=0.55/(1/256) -->140 --> convert to HEX -->8C
Final result: $028C, or decimal 652 <--- is it correct??
Bookmarks