标题:求助简单的51单片机端口问题
取消只看楼主
ID不见了
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2016-5-10
结帖率:83.33%
 问题点数:0 回复次数:0 
求助简单的51单片机端口问题
刚开始学数码管显示,为什么直接定义端口高低电平会出错?
程序代码:
#include<stc15.h>
#include<intrins.h>
#include<gpio.h>
#define uchar unsigned char 
#define uint unsigned int 
#include<Delay.c>

uchar code SEG[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71,0x00};
uchar code scan_bit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};          //λѡ£¬Î»¿ØÖÆÂ룬¿ØÖÆÄ3¸öêyÂë1üμÄááÃe
uchar data Dis_buf[]={0,1,2,3,4,5,6,7};         //ÏÔê¾»o3åÇø

void main()
{
    P2^0=0;
    P2^1=0;
    uint i;
    gpio();
    while(1)
    {
        for(i=0;i<8;i++)
        {
            P0=SEG[Dis_buf[i]];
            Delayxms(100);
        }
    }
}


错误信息如下:
test.c(14): error C141: syntax error near '='
test.c(15): error C141: syntax error near '='
test.c(16): error C141: syntax error near 'unsigned'
test.c(16): error C202: 'i': undefined identifier
test.c(20): error C202: 'i': undefined identifier
test.c(22): error C202: 'i': undefined identifier

我看到书上这样定义也行的啊
搜索更多相关主题的帖子: include 单片机 数码管 
2016-06-06 11:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-465644-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 2.191880 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved