?? 30dl.c
字號:
defrost_interval_t = 35;
/*
if (JPI)
{
defrost_interval_t = 35;
defrost_interval_t = 40;
}
else
{
defrost_interval_t = 30;
} */
if (defrost)
{
c_cumulate_time = 0x00;
defrost_interval_pass = OFF;
}
else
{
if ((++c_cumulate_time) >= defrost_interval_t)/*其它除霜間隔不起作用?*/
{
c_cumulate_time = 0x00;
defrost_interval_pass = ON;
}
}
}
}
}
else
{
c_cumulate_time = 0x00;
c_c_t_1m = OFF;
defrost_cnt = 0x00;
defrost_interval_t = 50; /* 50min *//*?????????????*/
defrost_interval_pass = OFF;
}
return;
}
/*-------------------------------------*/
void abnormal_show()
{
if (show_abnor_stus)
{
if (sh_error_1s)
{
sh_error_1s = 0;
if ((++ming_mie) >= 5)/*沒有2.5秒?*/
{
ming_mie = 0x00;
show_abnor_stus = 0;
}
}
}
else
{
IOP4.0 = ming_mie.0; /*0 -->00*/
if (sh_error_1s) /*1 -->01*/
{ /*2 -->10*/
sh_error_1s = 0; /*3 -->11*/
++ming_mie;
}
if (roomtemp_err)
{
if (ming_mie>=3)/*閃2下*/
{
sh_abnor_mid();
}
}
else
{
if (coil_err)
{
if (ming_mie>=7)/*閃4下*/
{
sh_abnor_mid();
}
}
}
}
return;
}
/*-------------------------------------*/
void sh_abnor_mid()
{
ming_mie=0x00;
show_abnor_stus = 1;
IOP4.0 = 1;
return;
}
/*-------------------------------------*/
void emergency_timer()
{
if (emergency_test && emergency_1m)
{
emergency_1m = OFF;
if ((++emergency_test_time) >= 30)
{
emergency_test_time = 0x00;
emergency_test = OFF;
emergency=OFF;
remo_fanspeed = rmot_fanLow_2;
}
}
return;
}
/*-------------------------------------*/
void read_key_emerg()
{
bit_key_new=IOP4.2;
if (bit_key_new != bit_key_last )
{
key_cnt=0;
bit_key_last=bit_key_new;
}
else
{
if ((++key_cnt) >= key_release_time)
{
key_cnt = 0x00;
if (newkey)
{
if (bit_key_last==1)
{
newkey = 0;
}
}
else
{
if (bit_key_last==0)
{
newkey = 1;
if (cool_only)
{
if ((++emergency_key_cnt) >= 2)
{
emergency_key_cnt = 0x00;
}
}
else
{
if ((++emergency_key_cnt) >= 3)
{
emergency_key_cnt = 0x00;
}
}
abnormal = 0;
position_ok = 0;
timer = time_on = time_off = OFF;
if (emergency_key_cnt==0)
{
power = OFF;
emergency = OFF;
emergency_test = OFF;
}
else
{
power = ON;
emergency = ON;
emergency_test = ON;
emergency_test_time = 0x00;
emergency_1m = OFF;
settemp = 24;
if (emergency_key_cnt==1)
{
mode = cool;
vane_mode = angle_1;
}
else
{
mode = heat;
vane_mode = angle_4;
}
}
}
}
}
}
return;
}
/*-------------------------------------*/
void sleepmode()
{
if (power && (!abnormal) && time_off)
{
if ((!sleeptime_pass) && sleep_1m)
{
sleep_1m=0;
sleeptime+=1;
if (mode_angle_mode == cool_mode_angle)
{
if (sleeptime >= 60)
{
sleeptime=0x00;
sleeptime_pass=1;
settemp+=1;
}
}
else
{
if (mode_angle_mode == heat_mode_angle)
{
if (sleeptime==60)
{
settemp-=1;
sleeptime=0x00;
sleeptime_pass=1;
}
}
}
}
}
else
{
sleeptime=0x00;
sleeptime_pass=0;
}
return;
}
/*-------------------------------------*/
unsigned char read_port_P1()
{
tempa=30;
do
{
if (tempb==IOP1)
{
tempa-=1;
}
else
{
tempa=30;
tempb=IOP1;
}
} while (tempa != 0);
return tempb;
}
/*-------------------------------------*/
unsigned char read_port_P4()
{
tempa=30;
do
{
if (tempb==IOP4)
{
tempa-=1;
}
else
{
tempa=30;
tempb=IOP4;
}
} while (tempa != 0);
return tempb;
}
/*-------------------------------------*/
void fctest()
{
fc_pulse_cnt=0x00;
do
{
WDTCR1 = 0y00001111;
WDTCR2 = 0x4e;
if (TREG3A >=250 || TREG3B >= 250 )
{
TC3CR = 0y00000101;
TC3CR = 0y00010101;
remo_step = 0;
EIRH.0 = 1;
}
if (on_line_1s)
{
on_line_1s=0;
fc_time+=1;
}
IOP4.3 = 1;
timer_cnt_sub();
ad_sub();
remo_decode();
sys_ram_P1 = read_port_P1() ^ 0y00001111;
/* tempb = read_port_P6();*/
regB = read_port_P4() ^ 0y00000100;
if (!pluse_reach)
{
if (JPT)
{
pluse_reach=1;
fc_pulse_cnt+=1;
IOP1=0x00;
IOP4.0=1;
IOP4.1=1;
IOP6=0x00;
tempa = 0x00;
}
}
else
{
if (!JPT)
{
pluse_reach=0;
}
}
if (fc_pulse_cnt != 0x00)
{
fc_test_output();
}
} while ((fc_time < 30) && (!flag_finish_pulse));
IOP1=0x00;
IOP4=0x0f;
IOP5=0x00;
IOP6=0x00;
return;
}
/*===========================*/
void fc_test_output()
{
switch (fc_pulse_cnt)
{
case 1:
IOP4.1=0; /* TCB_LED */
break;
case 2:
IOP4.0=0; /* RUN_LED */
break;
case 3:
IOP1=0y10000000; /* MOTOR STEP CN-5 */
break;
case 4:
IOP1=0y01000000; /* MOTOR STEP CN-4 */
break;
case 5:
IOP1=0y00100000; /* MOTOR STEP CN-3 */
break;
case 6:
IOP1=0y00010000; /* MOTOR STEP CN-2 */
break;
case 7:
IOP1=0y00001000; /* HEAT */
break;
case 8:
IOP6=0y00000100; /* COMP */
break;
case 9:
IOP6=0y00001000; /* VALVE */
break;
case 10:
IOP6=0y00010000; /* outfan */
break;
case 11:
IOP6=0y00100000; /* fan_hi */
break;
case 12:
IOP6=0y01000000; /* fan_mid */
break;
case 13:
IOP6=0y10000000; /* fan_low */
break;
case 14:
IOP5=0y00000010; /* buz */
break;
case 15:
IOP5=0y00000000; /* type */
if (cool_only)
{
IOP4.0 = 0;
IOP4.1 = 0;
}
else
{
IOP4.0 = 0;
}
break;
case 16:
if ((ad_room >= 0x7a) && (ad_room <= 0x84))
{
IOP4.1 = 0;
}
break;
case 17:
if ((ad_coil >= 0x7a) && (ad_coil <= 0x84))
{
IOP4.0 = 0;
}
break;
case 18:
if (autostart)
{
IOP4.1 = 0;
}
flg_remo_ok = OFF;
remo_test = 0;
key_test = 0;
IOP5.1 = 1;
break;
case 19:
if (remo_test)
{
IOP4.0 = 0;
IOP4.1 = 1;
TC4CR = 0y00010110;
remo_test = 0;
flg_remo_ok = OFF;
power = OFF;
newkey = 0;
}
if (!newkey)
{
if (!read_port_P4().2)
{
newkey=1;
}
}
else
{
if (read_port_P4().2)
{
newkey=0;
IOP4.1 = 0;
IOP4.0 = 1;
}
}
break;
default:
flag_finish_pulse=1;
break;
}
return;
}
/*-------------------------------------*/
/*
void on_line_test()
{
fc_pulse_cnt=0x00;
flag_finish_pulse=0;
do
{
WDTCR1 = 0y00001111;
WDTCR2 = 0x4e;
timer_cnt_sub();
if (on_line_1s)
{
on_line_1s=0;
fc_pulse_cnt+=1;
if (fc_pulse_cnt!=0)
{
switch (fc_pulse_cnt)
{
case 1:
outdoor_fan=1;
break;
case 2:
outdoor_fan=0;
break;
case 3:
comp=1;
break;
case 4:
comp=0;
break;
case 5:
valve=1;
break;
case 6:
valve=0;
break;
default:
flag_finish_pulse=1;
break;
}
output();
}
}
} while ((fc_pulse_cnt < 10) && (!flag_finish_pulse));
return;
}
*/
/*-------------------------------------*/
void inttbt()
{
RBS = 1;
TBTCR = 0y00000110; /* 0.256ms every interrupt */
if (++timer_cnt>=39)
{
timer_cnt = 0;
bit_1s = ON;
}
TBTCR = 0y00001110; /* 0.256ms every interrupt */
RETI();
}
/*------------------------------------*/
void inttc3()
{
RBS = 3;
switch(remo_step)
{
case 0:
remo_bit_cnt = 0;
remo_byte_cnt = 0;
remo_step = 1;
break;
case 1:
dig_tmp2 = TREG3B;
dig_tmp_mid = TREG3A;
dig_tmp1 = dig_tmp_mid - dig_tmp2;
if (( 0x10 < dig_tmp2 && dig_tmp2 < 0x20 ) && ( 0x08 < dig_tmp1 && dig_tmp1 < 0x10))
{ remo_step = 2; }
else
{ remo_init(); }
break;
case 2:
dig_tmp1 = TREG3A;
shift_temp=0x80;
if (dig_tmp1<0x0a)
{
shift_temp=0x00;
}
r_shift();
remo_bit_cnt += 1;
if (remo_bit_cnt>=8)
{
remo_byte_cnt += 1;
remo_bit_cnt=0;
}
if (remo_byte_cnt>=14)
{
remo_sum = 0;
for (tempa=0;tempa<13;tempa+=1)
{
remo_sum=remo_sum+remo_data_receive[tempa];
}
if (remo_sum==remo_data_receive[13])
{
for (tempa=0;tempa<14;tempa+=1)
{
remo_data[tempa]=remo_data_receive[tempa];
}
flg_remo_ok = ON;
}
else
{
flg_remo_ok = OFF;
remo_init();
}
remo_step=0;
EIRH.0 = 1; /* Enable INT3,TC1 */
}
break;
default:
remo_init();
break;
}
RETI();
}
/*-------------------------------------*/
void inttc4()
{
RBS = 2;
if (TC4CR.4 ==1)
{
if (++buztime>=800)
{
buztime = 0;
TC4CR.4 = 0;
}
}
RETI();
}
/*-------------------------------------*/
void onlyreti()
{
RETI();
}
/*-------------------------------------*/
void onlyretn()
{
RETN();
}
/*
Int vector address set
*/
/*-------------------------------------*/
#pragma section const vecttbl near 0xffe0
void (*ivect[])() =
{
onlyreti,onlyreti,onlyreti,onlyreti,
onlyreti,inttc4,onlyreti,inttc3,
onlyreti,inttbt,onlyreti,onlyreti,
onlyreti,onlyretn,onlyretn,main
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -