標(biāo)題: 跪求高手賜教C程序問題? [打印本頁(yè)]

作者: cnbaobao    時(shí)間: 2010-10-19 14:45
標(biāo)題: 跪求高手賜教C程序問題?

 #include<reg52.h>
sbit key1=P3^2;
sbit key2=P3^3;
sbit key3=P3^4;
sbit key4=P3^5;
sbit out1=P0^0;
sbit out2=P0^1;


void delay(unsigned int cnt)
{
        while(--cnt);
}


main()
{

        P0=0xff;
        while(1)
        {
                {if(!key1)
                       out1=0;
        out2=0;}問題:我想在此加入1S延時(shí),使之在亮1S后為1,就是關(guān)閉?
        
                {if(!key2)
                        out1=1;}
      
       
               
       
               

        }

}


 


作者: jzb812    時(shí)間: 2010-11-1 12:19

加個(gè)delay 程序  然后在這里調(diào)用下

 


作者: bill0522    時(shí)間: 2011-1-6 18:21
同意樓上的上說法,亮完后也可以加個(gè)取反,使其關(guān)閉。




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1