標(biāo)題: 這個(gè)程序?yàn)槭裁床荒苁沽魉疅袅鲃?dòng)起來 [打印本頁]

作者: a110    時(shí)間: 2012-9-23 13:34
標(biāo)題: 這個(gè)程序?yàn)槭裁床荒苁沽魉疅袅鲃?dòng)起來
#include #include #define uint unsigned int #define uchar unsigned char uchar temp; sbit sj=P1^4; void delay(uint z); void main() {sj=0; temp=0x7f; P0=temp; while(1) { delay (500); temp=_cror_(temp,1); sj=0; P0=temp; } } void delay(uint z) {uint x,y; for(x=z;x>0;z--) for(y=110;y>0;z--); }
作者: lydashan    時(shí)間: 2012-9-24 21:48

delay函數(shù)中for語句錯(cuò)誤,for(x=z;x>0;x--)for(y=110;y>0;y--);

 sbit sj=P1^4;這句無用,

主函數(shù)中把sj=0;去掉,把P0=temp;放在while(1)中,

void main()

{

    temp=0x7f;

    while(1)

        {

            P0=temp;

            delay(500);

            temp=_cror_(temp,1);

        }

}


作者: aqqkkee    時(shí)間: 2012-9-25 12:23

sbit sj=P1^4;還是要的

在51hei開發(fā)板上P14口是控制二極管的使能端;

主要還是延時(shí)函數(shù)搞錯(cuò)了。


作者: 肖川    時(shí)間: 2012-9-29 17:36
是延時(shí)的錯(cuò)
作者: amchina    時(shí)間: 2012-10-31 15:33
沒有聲明delay函數(shù)吧?




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