⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 30dl.c

📁 一款30dl空调控制器程序,包括了室内室外控制.
💻 C
📖 第 1 页 / 共 4 页
字号:
        if (tempa.7)
        {
            dtram=35; /*175min delay cancel*/
            d15sflg=ON;
            d10minflg=ON;
        }

        emergency = OFF;
        emergency_test = OFF;
        emergency_key_cnt = 0x00;
        abnormal=0;
        no_short_time = 0;
/*
    }
*/
    return;
}
/*-------------------------------------*/
void output()
{
    if (!abnormal)
    {
        show_abnor_stus = 0;

        if (power || time_on)
        {
            IOP4.0 = OFF;
        }
        else
        {
            IOP4.0 = ON;
        }
    }
    else
    {
        abnormal_show();
    }

    IOP4.1 = ~TCB;

    if (port1s)
    {
        port1s=0;

        comp_p=comp;
        valve_p=valve;
        outfan_p=outdoor_fan;
        fan_hi_p=fanhi;
        fan_mi_p=fanmi;
        fan_low_p=fanlo;
        heat_p = aim_heat;

        P1CR = 0y11111000;    
        P5CR = 0y00000010;
        P6CR = 0y11111100;
    }
    return;
}
/*-------------------------------------*/
void mode_sub()
{
    is_mode_change();
    press_protect();
    comp_cumulate_sub();
    if (mode == cool || mode == fan)
    {
        coolmode();
    }
    else
    {
        if (mode == heat)
        {
            heatmode();
        }
        else
        {
            drymode();
        }
    }
    return;
}
/*-------------------------------------*/
void coolmode()
{
/***冰堵预防退出条件__ ad_coil "4度"改为"10度" 压缩机停机时间5分钟改为10分钟***/ 
    runmode = cool;

    aim_heat = 0;

    mode_angle_mode = cool_mode_angle;

    if (power && TCB && (!abnormal))
    {
        if (comp==OFF)
        {
            yufang_105m_time=0x00;
            coil4c_time=0x00;
            if (yufang)
            {
                if (d10minflg && (ad_coil > coil10c))
                {
                    yufang=0;
                    comp_dly_5s(); 
                }
                else
                {
                    valve=OFF;
                    outfan_dly_15s();
                }
            }
            else
            {
                if (d175sflg)
                {
                    comp_dly_5s();  
                }
                else
                {
                    valve=OFF;
                    outfan_dly_15s();
                }
            }       
        }
        else    /* here comp==ON */
        {
            valve=OFF;
            ice_prv();
            if ((fan_run_word!=fan_hi) && (roomtemp<26) && yufang_c_1m)
            {
                yufang_c_1m = 0;
                if ((++yufang_105m_time) >= 105)
                {
                    yufang_105m_time = 0x00;
                    comp = 0;
                }
            }
        }
    }
    else
    {
        comp=OFF;
        valve=OFF;
        yufang_105m_time=0x00;
        coil4c_time=0x00;
        outfan_d5s=0x00;
        outfan_dly_15s();
        if ((!power) || abnormal)
        {
            yufang=OFF;             /*the "yufang jieshuang" reset*/
        }
    }
    return;  
}
/*-------------------------------------*/
void comp_dly_5s()
{
    if (outdoor_fan)
    {
        if (outfan1s)
        {
            outfan1s = OFF;
            if ((++outfan_d5s) >= 5)
            {
                outfan_d5s = 0x00;
                valve = OFF;
                comp = ON;
            }
        }
    }
    else
    {
        outdoor_fan = ON;
        valve = ON;   
        outfan_d5s = 0x00;
    }
    return;
}
/*-------------------------------------*/
void comp_dly_5s_h()
{
    if (outdoor_fan)
    {
        if (outfan1s)
        {
            outfan1s = OFF;
            if ((++outfan_d5s) >= 5)
            {
                outfan_d5s = 0x00;
                valve = ON;
                comp = ON;
            }
        }
    }
    else
    {
        outdoor_fan = ON;
        valve = OFF;
        outfan_d5s = 0x00;
    }
    return;
}
/*-------------------------------------*/
void outfan_dly_15s()
{
    if (outdoor_fan && d15sflg)
    {
        outdoor_fan = OFF;
    }
    return;   
}
/*-------------------------------------*/
void ice_prv()
{
    if (ad_coil <= coil4c)
    {
        if (coil4c_1m)
        {
            coil4c_1m=OFF;
            if ((++coil4c_time)>=300)
            {
                coil4c_time=0x00;
                yufang=ON;
                comp=OFF;
            }
        }
    }
    else
    {
        coil4c_time=0x00;
        coil4c_1m=OFF;
    }
    return;
}
/*-------------------------------------*/
void drymode()
{
    runmode = dry;
    aim_heat = 0;
    mode_angle_mode = cool_mode_angle;

    if (power && (abnormal==0) && (roomtemp>=13))
    {
        if (comp==OFF)
        {
            coil4c_time=0x00;
            if (yufang)
            {
                if (d295sflg && (ad_coil > coil4c))
                {
                    yufang=0;
                    comp_dly_5s();  
                }
                else
                {
                    valve=OFF;
                    outfan_dly_15s();
                }
            }
            else
            {
                if (roomtemp>=22)
                {
                    if (d175sflg)
                    {
                        comp_dly_5s();     
                    }
                    else
                    {
                        valve=OFF;
                        outfan_dly_15s();
                    }
                }
                else
                {
                    if (d235sflg)
                    {
                       comp_dly_5s();  
                    }
                    else
                    {
                        valve=OFF;
                        outfan_dly_15s();
                    }
                }
            }
        }
        else
        {
            valve=OFF;
            ice_prv();

            if (roomtemp>=25)
            {
                if (c8min)
                {
                    comp=OFF;
                }
            }
            else
            {
                if (roomtemp<22)
                {
                    if (c1min)
                    {
                        comp=OFF;
                    }
                }
                else
                {
                    if (c2min)
                    {
                        comp=OFF;
                    }
                }
            }
        }
    }
    else
    {
        comp=OFF;
        valve=OFF;
        yufang_105m_time=0;
        coil4c_time=0;
        outfan_d5s=0x00;

        if ((power==0) || abnormal)  /* add five lines at 2000-3-25 */
        {
            yufang=OFF;
        }

        outfan_dly_15s();
    }
    return;
}
/*-------------------------------------*/
void heatmode()
{
    runmode = heat;
    mode_angle_mode = heat_mode_angle;

    if (defrost)
    {
        heat_defrost_run();
    }
    else
    {
        heat_normal_run();
    }
    return;
}
/*-------------------------------------*/
void heat_defrost_run()
{
    aim_heat = 0;
    if (power && abnormal==0)
    {
        if (defrost_1s)
        {
            defrost_1s = OFF;
            defrost_time+=1;
        }

        switch (defrost_step)
        {
            case 0:
                comp = OFF;
                if (defrost_time >= 30)
                {
                    defrost_time = 0x0000;
                    defrost_step=1;
                }
                break;

            case 1:
                valve = OFF;
                outdoor_fan = OFF;
                if (defrost_time >= 15)
                {
                    defrost_step=2;
                }
                break;

            case 2:
                comp = ON;

                if (defrost_time >= defrost_time_cnt)
                {
                    comp = OFF;
                    defrost_step = 3;
                    if (defrost_cnt==0)
                    {
                        defrost_interval_t=40; /*40min*/
                        defrost_cnt=0x0f;
                    }
                    defrost_time = 0x0000;
                }
                break;

            case 3:
                if (defrost_time >= 30)
                {
                    if (real_defrost)
                    {
                        valve = ON;
                        outdoor_fan = ON;
                    }
                    defrost_step+=1;
                }
                break;

            default:
                if (defrost_time >= 45)
                {
                    if (real_defrost)/*?????????????*/
                    {
                        real_defrost = 0;
                        comp = ON;
                    }
                    else
                    {
                        dtram = 27;/*???????????*/
                    }
                    defrost = OFF;
                    defrost_time = 0x0000;
                    defrost_step = 0x00;
                    c_cumulate_time = 0x0000;
                }
                break;
        }
    }
    else
    {
        defrost = OFF;
        defrost_time = 0x0000;
        defrost_step = 0x00;
    }
    return;
}
/*-------------------------------------*/
void heat_normal_run()
{
    if (power && abnormal==0)
    {
        if (TCB)
        {
            if (comp==OFF)
            {
                aim_heat = 0;
                if (d175sflg)
                {
                    comp_dly_5s_h();
                }
                else
                {
                    outfan_dly_15s();
                }
            }
            else
            {
                outdoor_fan=~too_top_press_flg;
                if (press_exit_255s && defrost_interval_pass && c3min && outdoor_fan && (ad_coil<=picoil34))
                {
                    real_defrost = 1;
                    defrost = ON; /*defrost start*/
                    defrost_time = 0x00; /*defrost work time reset*/
                    defrost_step = 0x00; /*defrost from first step*/
                    defrost_interval_pass = OFF; /*this interval end*/
                    c_cumulate_time = 0x0000; /*comp leijishijian reset*/
                }

                if (!too_top_press_flg && settemp >= (roomtemp+3) && !fan_off)
                {
                    aim_heat = 1;
                }
                else
                {
                    aim_heat = 0;
                }
            }
        }
        else
        {
            aim_heat = 0;
            /*TCB关时,COMP关,c3min一直为OFF,如何进入除霜?*/
            if (press_exit_255s && defrost_interval_pass && c3min && (!too_top_press_flg))
            {
                defrost = ON; /*defrost start*/
                defrost_time = 0x00; /*defrost work time reset*/
                defrost_step = 0x00; /*defrost from first step*/
                defrost_interval_pass = OFF; /*this interval end*/
                c_cumulate_time = 0x0000; /*comp leijishijian reset*/
            }
            else
            {
                comp=OFF;
                outfan_d5s=0x00;
                outfan_dly_15s();
                if (valve && d10minflg)
                {
                    valve=OFF;
                }       
            }
        }
    }
    else
    {
        comp=OFF;
        aim_heat = 0;
        outfan_d5s=0x00;
        outfan_dly_15s();
        if (valve && d10minflg)
        {
            valve=OFF;
        }
    }
    return;
}
/*-------------------------------------*/
void press_protect()
{
    if (power && (runmode==heat))
    {
        if (comp)
        {
            if (ad_coil > coil52c)
            {
                too_top_press_flg=1;
                press_exit_255s=0;
                guoyali_time=0x00;
            }
            else
            {
                if (ad_coil < coil48c)
                {
                    too_top_press_flg=0;
                }
            }
        }
    }
    else
    {
        too_top_press_flg=0;
        press_exit_255s=ON;
    }

    if ((!press_exit_255s) && (!too_top_press_flg) && guoyali_1s)
    {
        guoyali_1s=0;
        if ((++guoyali_time) >= 250)
        {
            press_exit_255s=ON;
        }
    }
    return;
}
/*-------------------------------------*/
void comptime()
{
    if (delay1s)  /*if 1s reach and count time*/
    {
        delay1s=OFF;
        if ((++comp_time_cnt) >=5)
        {
            comp_time_cnt=0x00;
            dtram+=1;
            comprunT+=1;
        }
    }

        if (comp==ON)
        {
            d15sflg=OFF;
            d60sflg=OFF;
            d175sflg=OFF;
            d235sflg=OFF;
            d295sflg=OFF;
            d10minflg=OFF;
            dtram=0x00;
            /*--------------*/
            if (comprunT==12)
            {
                c1min=ON;
            }
            if (comprunT==24)
            {
                c2min=ON;
            }
            if (comprunT==36)
            {
                c3min=ON;
            }
       /*     if (comprunT==60)
            {
                c5min=ON;
            }
            if (comprunT==84)
            {
                c7min=ON;
            }                     */
            if (comprunT==96)
            {
                c8min=ON;
            }
      /*      if (comprunT==108)
            {
                c9min=ON;
            }
            if (comprunT==120)
            {
                c10min=ON;
            }                  */
        }
        else
        {
         /*   c10min=OFF;
            c9min=OFF;*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -