欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1824|回復: 3
收起左側

為什么這個程序不可以

[復制鏈接]
ID:275404 發表于 2018-5-29 13:37 | 顯示全部樓層 |閱讀模式
#include<reg52.h>
#include<intrins.h>

void Delay( unsigned int t);
void one(unsigned char time);
void two(unsigned char time);

void Delay(unsigned int t)
{
        while(--t);
}

void one(unsigned char time)
{
        unsigned char i;

        for(i=0;i<8;i++)
        {
                P1<<=1;
                Delay(time);

                P3<<=1;
                Delay(time);

                P2<<=1;
                Delay(time);

                P0<<=1;
                Delay(time);
        }
}

void two(unsigned char time)
{
        unsigned char i;
        unsigned char temp;

        temp=0xfc;
        P2=temp;
        for(i=0;i<7;i++)
        {
                Delay(time);
                temp<<=1;
                temp=temp|0x01;
                P2=temp;
        }
        temp=0x3f;
        P2=temp;
        for(i=0;i<7;i++)
        {
                Delay(time);
                temp>>=1;
                temp=temp|0x80;
                P2=temp;
        }
}

void main(void)
{
        while(1)
        {
                one(30000);
                two(20000);
        }
}
回復

使用道具 舉報

ID:91114 發表于 2018-5-29 16:23 | 顯示全部樓層
unsigned char的取值范圍是0-255
回復

使用道具 舉報

ID:331575 發表于 2018-5-29 22:48 | 顯示全部樓層
char是有長度的,你好好看看書,會有詳細的解釋
回復

使用道具 舉報

ID:390775 發表于 2018-9-4 18:18 | 顯示全部樓層
void two(unsigned char time)
void Delay( unsigned int t)
unsigned char  是 1個字節  8位 最大為 255;
unsigned int 一般為4個字節  32位  最大為 4294967295  建議你用 unsigned int
加油
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表