35,9 → 35,9 |
// globalni promenne |
struct time |
{ |
volatile unsigned int8 hod; |
volatile unsigned int8 min; |
volatile unsigned int8 sec; |
volatile signed int8 hod; |
volatile signed int8 min; |
volatile signed int8 sec; |
}cas; |
|
unsigned int top_heat_power=0; // range 0-200% nad 100% je ale teleso jiz pretizene |
57,7 → 57,7 |
setup_psp(PSP_DISABLED); |
setup_spi(SPI_SS_DISABLED); |
|
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); //nepouzit |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_64); //nepouzit |
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); // rizeni |
setup_timer_2(T2_DIV_BY_16,249,10); //rtc 40ms |
|
66,7 → 66,7 |
|
enable_interrupts(GLOBAL); |
enable_interrupts(INT_TIMER2); |
enable_interrupts(INT_TIMER1); |
enable_interrupts(INT_TIMER0); |
|
setup_adc_ports(AN0_AN1_VSS_VREF); //A0 vstup cidla, A1 nepozit, A3 - ref. 2.5V |
setup_adc(ADC_CLOCK_DIV_8); |
125,10 → 125,9 |
else{ |
output_high(POWER_T3); |
} |
|
} |
|
#int_TIMER1 |
#int_TIMER0 |
void heating_control() //rizeni topnych teles pri preteceni casovace |
{ |
float temp; |
136,11 → 135,14 |
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) |
{ |
temp=teplota(); |
temp_slope=(temp - temp_last) /(2*100.0*256.0/62500.0); // vypocet strmosti narustu teploty ve stupnich/s |
temp_last = temp; |
} |
|
if (period < 200) period++; |
else period=0; |
} |
174,8 → 176,8 |
|
if(slope_deviation < 0) |
{ |
top_heat_power= 80 + balance; |
bottom_heat_power= 90; |
top_heat_power= 67 + balance; |
bottom_heat_power= 100; |
} |
else{ |
top_heat_power=0; |
214,7 → 216,7 |
|
struct time process_time; |
|
// preheat |
// ------------------- PREHEAT --------------------- |
|
nullcas(&cas); |
lcd_gotoxy(1,2); |
232,16 → 234,17 |
lcd_gotoxy(10,2); |
printf(lcd_putc,"%1.1f\21C/s ",temp_slope); |
|
delay_ms(1000); |
delay_ms(200); |
if (cas.min>3) heat_failure(); |
} |
while (teplota() < SOAK_TEMP); |
|
// soak |
// ----------- SOAK --------------- |
nullcas(&cas); |
process_time.min = SOAK_TIME/60; |
process_time.sec = SOAK_TIME - process_time.min*60; |
|
|
lcd_clr(); |
lcd_gotoxy(1,2); |
printf(lcd_putc,"SOAK "); |
|
258,15 → 261,77 |
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); |
printf(lcd_putc,"%02u:%02u", process_time.min, process_time.sec); |
delay_ms(200); |
|
} |
|
// solder |
//----------------- solder ---------------------------- |
|
nullcas(&cas); |
lcd_clr(); |
lcd_gotoxy(1,2); |
printf(lcd_putc,"SOLDER"); |
|
do { |
slope_control(SOLDER_SLOPE, 10); // 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(200); |
if (cas.min>3) heat_failure(); |
} |
while (teplota() < SOLDER_TEMP); |
|
// ---------------- TAO ------------------------ |
|
|
while (process_time.sec!=0 || process_time.min!=0) |
{ |
level_control(SOLDER_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 = (SOLDER_TIME - cas.min*60 - cas.sec)/60; |
process_time.sec = (SOLDER_TIME - cas.min*60 - cas.sec) - process_time.min*60; |
|
lcd_gotoxy(9,1); |
printf(lcd_putc,"%02u:%02u", process_time.min, process_time.sec); |
delay_ms(200); |
|
} |
|
// ---------------- COOLING ------------------------ |
|
top_heat_power=0; |
bottom_heat_power=0; |
|
lcd_clr(); |
|
lcd_gotoxy(1,2); |
printf(lcd_putc,"REFLOW COMPLETE"); |
|
while(true) |
{ |
lcd_gotoxy(1,1); |
printf(lcd_putc,"%3.1f\21C ",teplota()); |
|
lcd_gotoxy(10,1); |
printf(lcd_putc,"%1.1f\21C/s ",temp_slope); |
|
} |
} |
|
|
void main() // main loop |
{ |
GeneralCpuInit(); |