Problem with comparison.
/Designs/Tools/reflow2/SW/reflow.c
0,0 → 1,286
#include "reflow.h"
#include "process.h"
#include <math.h>
 
// nastaveni teplot a casu
#define TEPLOTA_PREDEHREVU 120
#define DOBA_PREDEHREVU 60
 
#define TEPLOTA_VRCHOLU 210
#define DOBA_VRCHOLU 5
 
// CPU IO rozhrani
#define LCD_RS PIN_C1 // rizeni registru LCD displeje
#define LCD_E PIN_C2 // enable LCD displeje
#define LCD_DATA_LSB PIN_D0 // data LCD
#include "lcd.c"
 
#define TL1 PIN_B3 // tlacitko S1
#define TL2 PIN_B2 // tlacitko S2
#define TL3 PIN_B1 // tlacitko S3
#define TL4 PIN_B0 // tlacitko S4
 
#define POWER_T3 PIN_C4 // ovladani optotriaku T3
#define POWER_T4 PIN_C5 // ovladani optotriaku T4
#define POWER_T5 PIN_C6 // ovladani optotriaku T5
 
#define ADC_PIN PIN_A0 //info, nelze menit - pin pouzit jako input analog
#define ADC_PIN_NC PIN_A1 //info, nelze menit - pin pouzit jako input analog
#define REF_PIN PIN_A3 //info, nelze menit - pin pouzit jako input reference 2.5V
 
// interni
#define PowerOn() output_low(POWER_T4);output_low(POWER_T5)
#define PowerOff() output_high(POWER_T4);output_high(POWER_T5)
 
// globalni promenne
struct time
{
volatile unsigned int8 hod;
volatile unsigned int8 min;
volatile unsigned int8 sec;
}cas;
 
unsigned int top_heat_power=0; // range 0-200% nad 100% je ale teleso jiz pretizene
unsigned int bottom_heat_power=0; // contains heating power range 0-100%
unsigned int period;
 
float temp_last=0;
float temp_slope=0;
 
 
void GeneralCpuInit() // inicializace
{
output_high(POWER_T4);
output_high(POWER_T5);
port_b_pullups(true);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); //nepouzit
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); // rizeni
setup_timer_2(T2_DIV_BY_16,249,10); //rtc 40ms
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(GLOBAL);
enable_interrupts(INT_TIMER2);
enable_interrupts(INT_TIMER1);
setup_adc_ports(AN0_AN1_VSS_VREF); //A0 vstup cidla, A1 nepozit, A3 - ref. 2.5V
setup_adc(ADC_CLOCK_DIV_8);
SET_ADC_CHANNEL(0); //AN0, PIN_A0
}
 
void heat_failure() // exception in case of heating fail
{
top_heat_power=0;
bottom_heat_power=0;
 
lcd_gotoxy(1,2);
printf(lcd_putc,"HEATING FAILURE!");
while(true);
 
}
 
unsigned int16 adc(void) // adc read and filtering
{
unsigned int16 analog;
unsigned int8 a;
 
analog = 0;
for (a=0;a<32;a++)
{
analog += read_adc();
delay_us(50);
}
return (analog >> 5 ); // prumer = analog/32
}
 
float teplota(void) // temperature measuring
{
return (0.674201*adc() - 294.35); // temperature calculaton (linear aproximation)
}
 
void top_heating()
{
if (period < top_heat_power){
output_low(POWER_T4);
output_low(POWER_T5);
}
else{
output_high(POWER_T4);
output_high(POWER_T5);
}
}
 
void bottom_heating()
{
 
if (period < 2*bottom_heat_power){
output_low(POWER_T3);
}
else{
output_high(POWER_T3);
}
 
}
 
#int_TIMER1
void heating_control() //rizeni topnych teles pri preteceni casovace
{
float temp;
 
top_heating();
bottom_heating();
temp=teplota();
temp_slope=(temp - temp_last)*100.0; ///(4000000.0/65536.0); // vypocet strmosti narustu teploty ve stupnich/s
temp_last = temp;
 
if (period < 200) period++;
else period=0;
}
 
#int_TIMER2
void Rtc(void) //40ms
{
static unsigned int8 ms40=0;
struct time* time;
time=&cas;
if ( ++ms40 < 25) return;
ms40=0;
if (++(time->sec) >= 60)
{
time->sec=0; //1min
if (++(time->min) >= 60)
{
time->min = 0; //1hod
(time->hod)++;
}
}
}
 
void slope_control(float ramp, unsigned int balance) // P proporcionalni rizeni narustu teploty predpoklada periodicke volani 1x/s
{
float slope_deviation;
 
slope_deviation = temp_slope - ramp; // vypocet strmosti a odchylky od pozadovane strmosti
 
if(slope_deviation < 0)
{
top_heat_power= 80 + balance;
bottom_heat_power= 90;
}
else{
top_heat_power=0;
bottom_heat_power=0;
}
}
 
void level_control(float level) // P proporcionalni rizeni teploty
{
if (teplota() > level)
{
top_heat_power=0;
bottom_heat_power=0;
}
else
{
top_heat_power=70;
bottom_heat_power=80;
}
}
 
 
void nullcas(struct time* time)
{
disable_interrupts(INT_TIMER2);
time->sec=0;
time->hod=0;
time->min=0;
enable_interrupts(INT_TIMER2);
}
 
void reflow_solder()
{
 
struct time process_time;
 
// preheat
 
nullcas(&cas);
lcd_gotoxy(1,2);
printf(lcd_putc,"PREHEAT");
 
do {
slope_control(PREHEAT_SLOPE, 0); // hlida strmost predehrevu
 
lcd_gotoxy(1,1);
printf(lcd_putc,"%3.1f\21C ",teplota());
 
lcd_gotoxy(12,1);
printf(lcd_putc,"%02u:%02u",cas.min,cas.sec);
 
lcd_gotoxy(10,2);
printf(lcd_putc,"%1.1f\21C/s ",temp_slope);
 
delay_ms(1000);
if (cas.min>3) heat_failure();
}
while (teplota() < SOAK_TEMP);
 
// soak
nullcas(&cas);
process_time.min = SOAK_TIME/60;
process_time.sec = SOAK_TIME - process_time.min*60;
lcd_gotoxy(1,2);
printf(lcd_putc,"SOAK ");
 
while (process_time.sec!=0 || process_time.min!=0)
{
level_control(SOAK_TEMP);
 
lcd_gotoxy(1,1);
printf(lcd_putc,"%3.1f\21C ",teplota());
 
if ((process_time.sec = process_time.sec - cas.sec)<0) process_time.sec=59;
 
process_time.min = (SOAK_TIME - cas.min*60 - cas.sec)/60;
process_time.sec = (SOAK_TIME - cas.min*60 - cas.sec) - process_time.min*60;
 
lcd_gotoxy(9,1);
printf(lcd_putc,"%2u:%02u:%02u",cas.hod, process_time.min, process_time.sec);
delay_ms(1000);
}
// solder
}
 
 
void main() // main loop
{
GeneralCpuInit();
PowerOff();
lcd_init();
lcd_define_char(1,LCD_CHAR_STUPEN);
nullcas(&cas);
while(true)
{
delay_ms(300);
reflow_solder();
}
}
/Designs/Tools/reflow2/SW/reflow.hex
0,0 → 1,309
:1000000008308A0000280000FF00030E8301A100D1
:100010000A08A0008A010408A2007708A300780853
:10002000A4007908A5007A08A600831383128C30F7
:100030008400001C1D280C1834288C308400801C7F
:1000400023288C183728220884002308F700240866
:10005000F8002508F9002608FA0020088A00210E79
:100060008300FF0E7F0E09008A110A12892A8A1165
:100070000A12042B0A108A100A11820728340C3441
:1000800001340634C822412A49274710C620492690
:100090005529C5100000DE01DD01DF015F081F3CAE
:1000A000031C64281F151F19532883161E0883126A
:1000B000DD071E0803181E0FDE071030F700F70BD0
:1000C0005F280000DF0A4E285E0CFA005D0CF90084
:1000D000FA0CF90CFA0CF90CFA0CF90CFA0CF90CF4
:1000E0000730FA057908F8007A08F90008008E3020
:1000F000F7005E08F8005D08F900FA01F808031D32
:100100008B287908F800F9010830F702F808031D78
:100110008B28F70193280310F81B9228F90DF80D8E
:10012000F7038B28F8130800610803190429E90074
:10013000650803190429E9070318A5287F30E90297
:10014000031C042903190429A9288130E90703188D
:1001500004296908F700F801F901FA016208ED00C5
:10016000ED176308EC006408EB001830E900EA01C1
:100170006B1CD2286808FA07031CC428F90A031D5F
:10018000C428F80A0319EA176708F907031CCB28E3
:10019000F80A0319EA176608E300E3176308F8078B
:1001A0000318EA17EA0DF80CF90CFA0CED0CEC0C3C
:1001B000EB0C0310E90BB7280130F70703180429EB
:1001C000F81BE928ED0DFA0DF90DF80DF7030319E9
:1001D0000429ED1FFA28FA0A031DFA28F90A031D5B
:1001E000FA28F80A031DFA28F80CF90CFA0CF70A99
:1001F000031904296208EA006608EA06EA1F0229D0
:10020000F8170829F8130829F701F801F901FA018C
:10021000080080308318E806ED01EE016408EC0068
:100220006808EC0663080319F929EB00F700670872
:100230000319022AEB0203199E29031C5C29680892
:10024000F100F1176908F0006A08EF00EE010310F1
:10025000F10CF00CEF0CEE0CEB0B2629EC1F332904
:100260006D14162A6D106B106D16663084008313A2
:100270002B2A6D12EC1B46296B1C5129F10CF00C3A
:10028000EF0CEE0CF70A0319112A5129F11B54291E
:100290000310EE0DEF0DF00DF10DF7030319112A08
:1002A00046296D17BE296D136408EC00EC1F5A290E
:1002B000F1170A2AF1130A2A6708EB00F70063080E
:1002C000EB026408F100F1176508F0006608EF0022
:1002D000EE010310F10CF00CEF0CEE0CEB0B6829A7
:1002E000EC1F7529ED14162AED106B10ED166A300F
:1002F000840083132B2AED12EC1B88296B1C932995
:10030000F10CF00CEF0CEE0CF70A0319112A9329EB
:10031000F11B96290310EE0DEF0DF00DF10DF70313
:100320000319112A8829ED17BE29ED136808EC007E
:10033000EC1F9C29F1170A2AF1130A2A6808F10018
:10034000F1176908F0006A08EF00EC1FAB29F11300
:100350006D15162A6D11EE016B1066308400831343
:100360002B2AEC1BD4296408EC006B1CBE29F10C71
:10037000F00CEF0CEE0CF70A0319112AEE1FCF292F
:10038000EF0A031DCF29F00A031DCF29F10A031D2F
:10039000CF29F10CF00CEF0CF70A0319112A6D1B91
:1003A0005329ED1B9529F3298030F106F11FDC2933
:1003B000162A6808EC00E9296408EC00F108031D1E
:1003C000E929F008031DE929EF08031DE929F701D0
:1003D0000A2AF11BF3290310EE0DEF0DF00DF10DBC
:1003E000F70BE929112AEC1FF729F1170A2AF11353
:1003F0000A2A6708F7006808F1006908F0006A082F
:10040000EF000A2A6308F7006408F1006508F000AD
:100410006608EF007108F8007008F9006F08FA002C
:10042000492AF701F801F901FA01492AEE01EF0919
:10043000F009F109EE09EE0A031D242AEF0A031D53
:10044000242AF00A0319F10A6D183229ED187429CB
:100450006D19AA29D9290008EF07031C352AF00ACB
:10046000031D352AF10A03196B1484030008F007F1
:10047000031C3D2AF10A03196B1484030008801F32
:10048000803AF10703186B146D1A3929ED1A7B298C
:10049000B12908004B207908FA007808DD007908B6
:1004A000DE0077207030E4009830E3002C30E2006A
:1004B0007E30E1007A08E8007908E7007808E60075
:1004C0007708E50094207708DD007808DE007908D9
:1004D000DF007A08E000E2010408E1006210831BFB
:1004E000621483147A08E6007908E5007808E400CD
:1004F0007708E300CD30EA002C30E9001330E80043
:100500008730E7000921610884008313621883178C
:1005100008002C082E0203189A2AA812280883160D
:1005200087008312871228132808831687008312F6
:100530000713A62AA8122808831687008312871695
:1005400028132808831687008312071703102D0D20
:100550002E020318B22A2812280883168700831255
:100560000712B82A28122808831687008312071654
:100570004A227A08DC007908DB007808DA0077087C
:10058000D90083145C08E6005B08E5005A08E40023
:100590005908E3003208EA003108E9003008E800B1
:1005A0002F08E70009217708DD007808DE007908C8
:1005B000DF007A08E000E4007908E3007808E20050
:1005C0007708E100E801E7014830E6008530E50002
:1005D00094207A08B6007908B5007808B400770846
:1005E000B3005C08B2005B08B1005A08B0005908BB
:1005F000AF002E08C73C031CFF2AAE0A002BAE0139
:100600000C108A110A122328DA012930D900B70AFE
:100610003708183C0318372BB701023059078400FC
:1006200083135A188317800A00083B3C0318372BA2
:1006300002305907840083135A1883178001013050
:100640005907840083135A188317800A00083B3C1B
:100650000318372B01305907840083135A18831766
:1006600080015908840083135A188317800A8C105C
:100670008A110A12232850294524C5205400A5199F
:10068000AE18E60843102000A518AE18E608C317F8
:1006900073102000D327C125201020100001A519B8
:1006A000AE18E60843102000063409340934063435
:1006B00080348034803480340034A81228088316B3
:1006C0008700831287162813280883168700831251
:1006D000071783168113091283129412A81228088F
:1006E0008316870083122816280883168700831232
:1006F000A811280883168700013083129400003067
:10070000831694000108C7390838810085308312A8
:1007100090004830F80006389200F93083169200B5
:1007200007309C00050885000330F700F70B962B77
:100730001C0883120D1383169D01C03083128B0495
:1007400083168C140C141F149F101F159F111F1358
:1007500083121F179F1383169F1783121F140030D5
:10076000F8001F08C73978049F008A150A121F284D
:100770004D308400831300080319CC2B0130F8009E
:10078000F701F70BC12BF80BC02B4A30F700F70B22
:10079000C72BCA2B800BBE2B08000808F039D500E8
:1007A00053080F39550488000715281128088316A7
:1007B000870000008312071128112808831687007C
:1007C00083120800D108031DE72B8710E82B87143C
:1007D000A8102808831687008312D20E5208D3006F
:1007E000CD23D20E5208D300CD230D30F700F70BE6
:1007F000F72B0800C830CD00B823F03083168805E9
:1008000083128710A8102808831687008312071107
:1008100028112808831687008312B8013808023C83
:10082000031C1A2C0230CD00B8230330D300CD2393
:10083000B80A0E2C0D30F700F70B1C2C0230D30039
:10084000CD230D30F700F70B232CB8013808023CFC
:10085000031C362C38083A20B900D1013908D200DF
:10086000E2230230CD00B823B80A262C8A150A12DA
:100870002E28831603178C170C1400000000831217
:100880008C080319602C0D080313B80003170F0818
:100890000313B90003170C080313BA000130D10089
:1008A0003A08D200E223380803178D0003133908F1
:1008B00003178F008D0A03198F0A0313392C0317AE
:1008C00003138A150A12422883168C1002308312F1
:1008D0003B07840083133C18831780013B08840086
:1008E00083133C188317800101303B078400831376
:1008F0003C188317800183168C1483120800013082
:100900004D02CF004E08023C031D882C4030CF071B
:100910004F088038D000D1015008D200E2230800EF
:100920004C080C3A03199B2C063A0319A32C073ADE
:100930000319A92CAE2CD1010130D200E2230230E0
:10094000CD00B823BA2C0130CD000230CE007F2478
:10095000BA2C0130CD00CE007F24BA2C4C081F3CAD
:10096000031CB42C0730CC050130D1004C08D20058
:10097000E223BA2C0800831603178C170C1400000E
:10098000000083120C087F390319FF2C0313BB00EE
:1009900003170D080313BC0003170F080313BD0052
:1009A0003B08CC0090243C0803178D0003133D083E
:1009B00003178F0083168C170C140000000083129D
:1009C0000C0D0E0D7F390319FF2C0313BB00031709
:1009D0000D080313BC0003170F080313BD003B08E9
:1009E000CC0090243C0803178D0003133D08031727
:1009F0008F008D0A03198F0A0313BB2C03170313EF
:100A000008004508CC004908CC06CC1F0C2D03116A
:100A10000310C51B03143F2D4508CC004808CD002A
:100A20004408CD0203191A2DCC1F3F2D0308013AAB
:100A300083003F2D4908CD004508CD020319262D1E
:100A4000CC1F3F2D0308013A83003F2D4A08CD00FB
:100A50004608CD020319322DCC1F3F2D0308013A61
:100A600083003F2D4B08CD004708CD0203193E2DD2
:100A7000CC1F3F2D0308013A83003F2D03100800CF
:100A8000F701F801F901FA01D401D501D601D70126
:100A9000530852045104500403197E2D2030D8000D
:100AA0000310CC0DCD0DCE0DCF0DD40DD50DD60D23
:100AB000D70D53085702031D672D52085602031D18
:100AC000672D51085502031D672D50085402031C61
:100AD000782D5008D4025108031C510FD50252083A
:100AE000031C520FD6025308031C530FD7020314E2
:100AF000F70DF80DF90DFA0DD80B502D5430840078
:100B0000831308000408C4004308C6000319A72D76
:100B1000A7018B1BA7178B134208E4004108E300D1
:100B20004008E2003F08E100E801E7012030E6006C
:100B30008230E5009420A71B8B177A08C200790841
:100B4000C1007808C0007708BF00C60B882D420896
:100B5000CF004108CE004008CD003F08CC004C0833
:100B6000B63CCC00FA014D08D000CD170310CD0CD7
:100B7000CE0CCF0CFA0CF90CF80CF70CCC0BB62DF4
:100B8000D01FCD2DF709F809F909FA09F70A031959
:100B9000F80A0319F90A0319FA0A7A08C20079084F
:100BA000C1007808C0007708BF00C21FE42DC4034D
:100BB000C416BF09C009C109C209BF0A0319C00A86
:100BC0000319C10A0319C20A3B30CB009A30CA008C
:100BD000CA30C900C8010A30C60043080319C40A54
:100BE0004208CF004108CE004008CD003F08CC00AD
:100BF0004B08D3004A08D2004908D1004808D00069
:100C000040250008BF00840A0008C000840A0008CC
:100C1000C100840A0008C200FD308407F708031DE4
:100C2000242E430A46020319242E44080319262EB3
:100C30000F39460203191E2E0318562EC41B562EBA
:100C4000441B262E2030522E2030C405C41E342EC4
:100C5000C4124308031DC4037708C4002D30CC0020
:100C600090244408F700C40143084602031D422EA5
:100C70007708C4002E30CC0090244408F7002030C0
:100C8000C40500303030C41E522EC4124308031D68
:100C9000C4037708C4002D30CC0090244408F7002A
:100CA000C4013030F7077708CC0090244B08CF0000
:100CB0004A08CE004908CD004808CC00D301D20133
:100CC000D1010A30D00040257A08CB007908CA004B
:100CD0007808C9007708C800C60BF02D08008316F5
:100CE00003178C170C140000000003189E2E8312AB
:100CF0000C087F390313C00003170D080313C1004C
:100D000003170F080313C2004008CC0090244108C9
:100D100003178D000313420803178F0083168C17E7
:100D20000C140000000083120313BF0B982E9B2E9F
:100D3000831603179E2EBD2E8316031783120C0DE8
:100D40000E0D7F390313C00003170D080313C100F4
:100D500003170F080313C2004008CC009024410879
:100D600003178D000313420803178F008D0A031920
:100D70008F0A03100313BF0B6F2E08003E08F80103
:100D80003D020318C62E3D08F700D22EF7010830A9
:100D9000BF00BD0DF70D3E0877020318F700F80DF0
:100DA000BF0BC92E080078083B08BD006430BE00A8
:100DB000BE267708BB0078083030031DE62EBC1C29
:100DC000ED2EBC19ED2E3C1A2030E92EBC113C1240
:100DD0003C14F8077808CC0090243B08BD000A308A
:100DE000BE00BE267708BB0078083030031DFE2EFB
:100DF000BC19022F3C1C022F3C1A2030F80778083F
:100E0000CC0090243030BB073B08CC009024080075
:100E1000F701F8013C0803103D18F707F70CF80C30
:100E2000BD18F707F70CF80C3D19F707F70CF80C8D
:100E3000BD19F707F70CF80C3D1AF707F70CF80C7B
:100E4000BD1AF707F70CF80C3D1BF707F70CF80C69
:0A0E5000BD1BF707F70CF80C0800B3
:10100000840183131F30830583168613831286178A
:10101000AC01AD01B201B101B001AF01B601B50142
:10102000B401B301B70183161F149F141F159F113C
:1010300007309C00FF308312A8008A115D2B8A15AF
:10104000A8122808831687008312871628132808F9
:1010500083168700831207178A11FA2B8A15D1018C
:101060004830D2008A11E2238A150230CD008A115D
:10107000B8238A15543003178D0003308F008A116E
:101080000313392C8A15D1010330D2008A11E223CF
:101090008A150230CD008A11B8238A15BC01293087
:1010A000BB008A1164248A150230B8009630CD0046
:1010B0008A11B8238A15B80B5628BC012930BB0009
:1010C0008A1164248A150130CD000230CE008A11C5
:1010D0007F248A153B3003178D0003308F008A115F
:1010E0000313BB248A15BE01BD01BC017F30BB00C8
:1010F000BF018314A7018B1BA7178B133608E600CB
:101100003508E5003408E4003308E3003E08EA004F
:101110003D08E9003C08E8003B08E7008A11092186
:101120008A15A71B8B177A08C3007908C2007808B4
:10113000C1007708C0004308C7004208C600410844
:10114000C5004008C400CB01CA01C901C8018A1109
:1011500001258A15031CB22850303F07AC005A30D5
:10116000AD00B428AC01AD010130CD00CE008A1134
:101170007F248A15A7018B1BA7178B138A114A227C
:101180008A15A71B8B177708BB007808BC00790865
:10119000BD007A08BE00023084007A08C2007908D7
:1011A000C1007808C0007708BF000130C3008A1171
:1011B00082258A15413003178D0003308F000314F8
:1011C00004300313BF008A116F268A150C30CD003E
:1011D0000130CE008A117F248A152A08BB00013015
:1011E000BC008A11D3268A153A30CC008A1190248B
:1011F0008A152B08BB000130BC008A11D3268A1542
:101200000A30CD000230CE008A117F248A15893041
:1012100084003608C2003508C1003408C000330815
:10122000BF000130C3008A1182258A15463003179A
:101230008D0003308F00031406300313BF008A11A2
:101240006F268A150430BB00FA30CD008A11B8230E
:101250008A15BB0B24292A08033C03184229AC0138
:10126000AD010130CD000230CE008A117F248A15F5
:10127000423003178D0000308F008A110313BB2406
:101280008A154129A7018B1BA7178B138A114A22A4
:101290008A15A71B8B177708BB007808BC00790854
:1012A000BD007A08BE00C7003D08C6003C08C50066
:1012B0003B08C400CB01CA011630C9008630C80003
:1012C0008A1101258A1503187328BC012930BB0037
:1012D0008A1164248A150130B9003908BC003C30F9
:1012E000BD008A1108278A1578086E3CBA000130C3
:1012F000CD000230CE008A117F248A154A300317B0
:101300008D0003308F008A110313BB248A15BA089D
:10131000031D8D29B9080319502ABE01BD011630DD
:10132000BC008630BB00A7018B1BA7178B138A114B
:101330004A228A15A71B8B177708BF007808C000C0
:101340007908C1007A08C2003E08C7003D08C600FF
:101350003C08C5003B08C4004208CB004108CA0055
:101360004008C9003F08C8008A1101258A15031CDE
:10137000BC29AC01AD01C0294630AC005030AD00F5
:101380000130CD00CE008A117F248A15A7018B1B66
:10139000A7178B138A114A228A15A71B8B17770868
:1013A000BB007808BC007908BD007A08BE00023096
:1013B00084007A08C2007908C1007808C000770864
:1013C000BF000130C3008A1182258A1551300317EE
:1013D0008D0003308F00031404300313BF008A1103
:1013E0006F268A152B08BA022A08BC003C30BD00C3
:1013F0008A1108278A1578086E3CF8002B087802B5
:10140000BC00BD003C30BE008A11BE268A1578089B
:10141000B9002A08BC003C30BD008A1108278A1593
:1014200078086E3CF8002B087802BB003908BC0035
:101430003C30BD008A1108278A1578083B02BA00A3
:101440000930CD000130CE008A117F248A15290889
:10145000BB001130BC008A11D3268A153A30CC006B
:101460008A1190248A153908BB000130BC008A110A
:10147000D3268A153A30CC008A1190248A153A086E
:10148000BB000130BC008A11D3268A150430BB0092
:10149000FA30CD008A11B8238A15BB0B482A872958
:0414A0005428630069
:02400E003A3F37
:00000001FF
;PIC16F877A
;CRC=47D4 CREATED="28-V-11 17:06"
/Designs/Tools/reflow2/SW/reflow.PJT
0,0 → 1,44
[PROJECT]
Target=reflow.HEX
Development_Mode=2
Processor=0x877A
Processor_Text=PIC16F877A
ToolSuite=CCS
 
[Directories]
Include=
Library=
LinkerScript=
 
[Target Data]
FileList=D:\MLAB\Designs\Tools\reflow2\SW\reflow.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[reflow.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=reflow.c
 
[Windows]
0=0000 reflow.c 0 0 796 451 3 0
 
[Opened Files]
1=reflow.c
2=reflow.h
3=C:\Program Files\PICC\devices\16F877A.h
4=process.h
5=C:\Program Files\PICC\drivers\math.h
6=lcd.c
7=
[Units]
Count=1
1=reflow (main)
/Designs/Tools/reflow2/SW/process.h
0,0 → 1,12
 
// reflow soldering profile difinition
#define PREHEAT_SLOPE 1.0 // preheat ramp up time
#define SOAK_TEMP 150 // soak temperature
 
#define SOAK_TIME 110 // time to soak
 
#define SOLDER_SLOPE 2.0
#define SOLDER_TEMP 210
#define SOLDER_TIME 5
 
 
/Designs/Tools/reflow2/SW/reflow.h
0,0 → 1,16
#include <16F877A.h>
#device adc=10
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
 
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8)
 
/Designs/Tools/reflow2/SW/LCD.C
0,0 → 1,318
// LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
// (c)miho 2002,2005
//
// Historie:
//
// 0.00 Uvodni verze se snadnou definici portu LCD displeje
// 0.01 Oprava portu (zapomenute stare identifikatory)
// 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
// 0.03 Doplnena procedura lcd_clr pro smazani displeje
//
//
// Funkce:
//
// lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
//
// lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
// \f = \x0C - nova stranka - smazani displeje
// \n = \x0A - odradkovani (prechod na druhou radku)
// \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
// \r = \x0D - goto home to position 1,1
// \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
// \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
// Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
//
// lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
// nekontroluje parametry
//
// lcd_cursor_on zapne kurzor
// lcd_cursor_off vypne kurzor
//
// lcd_clr smaze displej
//
// lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
// retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
// Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
// Na konci se provede lcd_gotoxy(1,1).
// Na konci teto knihovny je priklad pouziti definovanych znaku
//
//
// Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
//
// #define LCD_RS PIN_B2 // rizeni registru LCD displeje
// #define LCD_E PIN_B1 // enable LCD displeje
// #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
//
//
// Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
//
// #define LCD_RS PIN_B2 // rizeni registru LCD displeje
// #define LCD_E PIN_B1 // enable LCD displeje
// #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
// #define LCD_D1 PIN_C3 // D1
// #define LCD_D2 PIN_C4 // D2
// #define LCD_D3 PIN_C5 // D3
 
 
 
 
// Privatni sekce, cist jen v pripade, ze neco nefunguje
 
 
 
 
#ifdef LCD_DATA_LSB
// Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
// bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
// v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
//
#define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
#define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
#define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
#define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
//
#if LCD_SHIFT>4 // kontrola mezi
#error LCD data port LSB bit not in range 0..4
#endif
#endif
 
 
// Definice konstant pro LCD display
//
#define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
#define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
#define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
 
 
// Definice rezimu LCD displeje
//
BYTE const LCD_INIT_STRING[4] =
{
0x28, // intrfejs 4 bity, 2 radky, font 5x7
LCD_CURSOR_OFF_, // display on, kurzor off,
0x01, // clear displeje
0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
};
 
 
// Odesle nibble do displeje (posle data a klikne signalem e)
//
void lcd_send_nibble( BYTE n )
{
#ifdef LCD_DATA_LSB
// data jsou za sebou na 4 bitech jednoho portu
*LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
#else
// data jsou na libovolnych 4 bitech libovolnych portu
output_bit(LCD_D0,bit_test(n,0));
output_bit(LCD_D1,bit_test(n,1));
output_bit(LCD_D2,bit_test(n,2));
output_bit(LCD_D3,bit_test(n,3));
#endif
output_bit(LCD_E,1); // vzestupna hrana
delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
}
 
 
// Odesle bajt do registru LCD
//
// Pokud je Adr=0 .. instrukcni registr
// Pokud je Adr=1 .. datovy registr
//
void lcd_send_byte( BOOLEAN Adr, BYTE n )
{
output_bit(LCD_RS,Adr); // vyber registr
swap(n);
lcd_send_nibble(n); // posli horni pulku bajtu
swap(n);
lcd_send_nibble(n); // posli spodni pulku bajtu
delay_us(40); // minimalni doba na provedeni prikazu
}
 
 
// Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
//
// Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
//
void lcd_init()
{
 
int i; // pocitadlo cyklu
 
delay_ms(200); // spozdeni pro provedeni startu displeje po zapnuti napajeni
 
#ifdef LCD_DATA_LSB
// data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
*LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
#endif
 
output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
 
for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
{
delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
lcd_send_nibble(3); // rezim 8 bitu
}
 
delay_us(40); // cas na zpracovani
lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
delay_us(40); // cas na zpracovani
 
for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
delay_ms(2);
}
}
 
 
// Proved presun kurzoru
//
// Pozice 1.1 je domu
//
void lcd_gotoxy( BYTE x, BYTE y)
{
 
BYTE Adr;
 
Adr=x-1;
if(y==2)
Adr+=LCD_LINE_2;
 
lcd_send_byte(0,0x80|Adr);
}
 
 
// Zapis znaku na displej, zpracovani ridicich znaku
//
void lcd_putc( char c)
{
 
switch (c)
{
case '\f' : lcd_send_byte(0,1); // smaz displej
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
case '\r' : lcd_gotoxy(1,1); break; // presun home
// case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
lcd_send_byte(1,c); break; // zapis znak
}
}
 
 
// Zapni kurzor
//
void lcd_cursor_on()
{
lcd_send_byte(0,LCD_CURSOR_ON_);
}
 
 
// Vypni kurzor
//
void lcd_cursor_off()
{
lcd_send_byte(0,LCD_CURSOR_OFF_);
}
 
 
// Smaz displej
//
void lcd_clr()
{
lcd_putc('\f');
}
 
 
// Definice vlastnich fontu
//
// Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
// Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
// priklad pouziti definovanych znaku.
 
 
// Pomocna procedura pro posilani ridicich dat do radice displeje
//
void lcd_putc2(int Data)
{
lcd_send_byte(1,Data);
}
 
 
// Pomocne definice pro programovani obsahu CGRAM
//
#define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
#define lcd_define_def(String) printf(lcd_putc2,String);
#define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
 
 
// Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
//
#define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
 
 
// Pripravene definice fontu vybranych znaku
// V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
//
#define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
#define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
 
#define LCD_CHAR_BAT20 "\x0E\x1F\x11\x11\x11\x11\x1F\x1F" /* symbol baterie 20% */
#define LCD_CHAR_BAT40 "\x0E\x1F\x11\x11\x11\x1F\x1F\x1F" /* symbol baterie 40% */
#define LCD_CHAR_BAT60 "\x0E\x1F\x11\x11\x1F\x1F\x1F\x1F" /* symbol baterie 60% */
#define LCD_CHAR_BAT80 "\x0E\x1F\x11\x1F\x1F\x1F\x1F\x1F" /* symbol baterie 80% */
 
#define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
#define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
#define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
#define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
#define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
#define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
#define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
#define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
#define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
#define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
#define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
#define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
#define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
#define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
#define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
#define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
#define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
#define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
#define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
#define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
#define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
#define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
#define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
#define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
#define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
#define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
#define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
#define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
#define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
#define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
#define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
#define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
#define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
 
#define LCD_CHAR_STUPEN "\x06\x09\x09\x06\x80\x80\x80\x80" /* ° stupen C */
 
// Priklad pouziti definovanych znaku
//
//
//void lcd_sample()
//{
// lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
// lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
// // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
// // jediny definicni retezec)
// printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
// delay_ms(1000);
// lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
// delay_ms(1000);
//}
/Designs/Tools/reflow2/DOC/calibration/fit.log
0,0 → 1,474
 
 
*******************************************************************************
Mon Apr 18 10:07:44 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
*******************************************************************************
Mon Apr 18 10:07:56 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:11:53 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:15:14 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:16:19 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:16:42 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:22:51 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:23:12 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:24:14 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:24:37 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
 
 
*******************************************************************************
Mon Apr 18 10:25:11 2011
 
 
FIT: data read from "calibration_data.txt" using 2:1
format = x:z
#datapoints = 21
residuals are weighted equally (unit weight)
 
function used for fitting: f(x)
fitted parameters initialized with current variable values
 
 
 
Iteration 0
WSSR : 5.09698e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 431.263
 
initial set of free parameter values
 
k = 1
q = 1
 
After 7 iterations the fit converged.
final sum of squares of residuals : 121.522
rel. change during last iteration : -5.14772e-13
 
degrees of freedom (FIT_NDF) : 19
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 2.52901
variance of residuals (reduced chisquare) = WSSR/ndf : 6.3959
 
Final set of parameters Asymptotic Standard Error
======================= ==========================
 
k = 0.674201 +/- 0.005913 (0.877%)
q = -294.35 +/- 3.606 (1.225%)
 
 
correlation matrix of the fit parameters:
 
k q
k 1.000
q -0.988 1.000
/Designs/Tools/reflow2/DOC/calibration/plot.gp
0,0 → 1,17
set terminal png
set output "temperature.png"
 
set key under
set xlabel "ADC value [-]"
set ylabel "Temperature [°C]"
 
f(x)= k*x + q
fit f(x) "calibration_data.txt" using 2:1 via k,q
 
 
# from http://hw.cz/docs/mereni_teploty/mereni_teploty_1.html/
A=3.90802e-3
B=-5.802e-7
g(x)=(-A + sqrt(A*A - 4*B*(1.0 - 1.0*x*2350.0/1024.0/1000.0)))/2.0/B;
 
plot "calibration_data.txt" using 2:1 with points title "measured points", f(x) title "0.674201 * x - 294.35", g(x) title "original hw.cz"
/Designs/Tools/reflow2/DOC/calibration/temperature.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Tools/reflow2/DOC/calibration/calibration_data.txt
0,0 → 1,22
temperature ADCvalue
12 459
57 518
76 547
89 567
110 601
152 661
179 703
197 730
220 774
210 748
180 701
160 670
150 655
130 625
120 611
100 583
55 518
50 512
40 499
35 491
30 484