??? 10/30/09 21:15 Read: times |
#170262 - 89s52 PID controller Responding to: ???'s previous message |
Hello Everyone,
Thank you to all those who replied, I may have initially come over abit brash and big headed, that was'nt my intention, so if I offended anyone I apologise. Let me give a quick summary of my controller design. I am using Microchip's mcp3302 sar adc operated in 13 bit with sign in differential mode. The thermocouple in use is a type J, which is fed into an opamp with gain of about 30dB which is then fed into the adc channel A. A TO92 LM35 temperature sensing ic(used for cold junction comp.) is fed into the alternative adc channel via a gain of 12dB. In software, both channels are fed through IIr filters and then the cold junction rate is computed to be the same as the thermocouples rate(deg.c/adc_counts) and then they summed together, this operation is the same as what would have been done had I designed the cold junction compensation in analogue. The next stage passes the reading(in software) through a linearisation cubic polynomial giving a final range of 0 to 1000deg.c, however the adc can swing to -1000deg.c, -273 is the absolute limit though. In addition to this, the end user can 'zero' the thermocouple when idling at ambient, I have quite a few MCP3302 chips in stock and the zero variation from chip to chip is about 10 to 20 adc counts, remembering there is a 30dB amplifier after it. The controller as it stands is working satisfactory, the end user can adjust time of day, integral(1-250repeats/sec), prop. band(1-99), differential time(1-250 secs), set point, auto/manual, output adjust when setin in manual 0.1-99.9%, forward/reverse acting and as already mentioned "zero". Save all parameters to eeprom (24lc64).The CPU is overclocked with 32MHz crystal and cpu PID algorithm/update time is 50mSec giving twenty passes per sec.(fast enough for motor pid control perhaps?). As already mentioned, I'm using an 89S52 with 8kbyte and I've clocked up about 7.9Kbyte so I've run out of flash rom? Every 50mSec, the mpu sends the process variable through rs232 to the pc where I can and have been doing graphing the response with a 1kW heater band. The relay output pwm is generated in software and has a period of 2000 mSec with resolution step of 2mSec. I hope this gives a little more insight into my adventures. Cheers for now |