标题: 请问大神,我這个程序还能更快吗 [打印本页]

作者: 啊h啊    时间: 2020-9-5 16:13
标题: 请问大神,我這个程序还能更快吗
                        while(LIGHT_G1==0&&LIGHT_G2==1)//来到第一点
                                {
                                        LIGHT_L1=ADC_Value[9];//采用dma的方式               
                                        LIGHT_L2=ADC_Value[8];                               
                                        if(LIGHT_L1>flag_adc1)
                                                {
                                                        lig3 |=0x40;
                                                        adc1[0]=LIGHT_L1;
                                                }       
                                        if(LIGHT_L2>flag_adc2)
                                                {
                                                        lig3 |=0x04;
                                                        adc2[0]=LIGHT_L2;
                                                }                       
                                }
                                while(LIGHT_G1==0&&LIGHT_G2==0)//来到第2点
                                        {       
                                                LIGHT_L1=ADC_Value[9];//采用dma的方式                       
                                                LIGHT_L2=ADC_Value[8];                                                       
                                                if(LIGHT_L1>flag_adc1)
                                                        {
                                                                lig3 |=0x20;
                                                                adc1[1]=LIGHT_L1;
                                                        }
                                                if(LIGHT_L2>flag_adc2)
                                                        {
                                                                lig3 |=0x02;
                                                                adc2[1]=LIGHT_L2;
                                                        }               
                                        }
                                while(LIGHT_G2==0&&LIGHT_G1==1)//来到第3点
                                        {               
                                                LIGHT_L1=ADC_Value[9];//采用dma的方式               
                                                LIGHT_L2=ADC_Value[8];                                                                       
                                                if(LIGHT_L1>flag_adc1)//flag_adc1=150
                                                                {
                                                                        lig3 |= 0x10;
                                                                        adc1[2]=LIGHT_L1;
                                                                }
                                                        if(LIGHT_L2>flag_adc2)//flag_adc2=200
                                                                {
                                                                        lig3 |= 0x01;
                                                                        adc2[2]=LIGHT_L2;
                                                                }                               
                                        }


作者: man1234567    时间: 2020-9-5 19:02
提升单片机的主频就可以
作者: wwh2382    时间: 2020-9-5 20:51
你现在的程序有多快呢?




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1