回覆列表
  • 1 # lanfengz3

    #include

    sbit LED = P0^0;

    sbit ADDR0 = P1^0;

    sbit ADDR1 = P1^1;

    sbit ADDR2 = P1^2;

    sbit ADDR3 = P1^3;

    sbit ENLED = P1^4;

    void main()

    {

    unsigned int cnt = 0;

    ADDR0 = 0;

    ADDR1 = 1;

    ADDR2 = 1;

    ADDR3 = 1;

    ENLED = 0;

    TMOD = 0x01;

    TH0 = 0xB8; //在這裡設定了初值

    TL0 = 0x00;

    TR0 = 1; //啟動T0

    while(1) //一直迴圈

    {

    if(TF0 == 1) //如果TF0=1,TH0 = 0x00,TL0 = 0x00;

    {

    TF0 = 0; //清除這個標誌

    TH0 = 0xB8; //再次設定了初值,就這麼迴圈的

    TL0 = 0x00;

    cnt++;

    if(cnt >= 50)

    {

    cnt = 0;

    LED = ~LED;

    }

    }

    }

    }

  • 中秋節和大豐收的關聯?
  • 你是因為什麼原因放棄玩崩壞3的?