打印
[国产单片机]

求大神解答疑惑

[复制链接]
495|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
xl531145882|  楼主 | 2015-9-20 22:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
include <c8051f350.h>
#include <stdio.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit DAT = P1^6;
sbit CLK = P1^5;
uchar code tab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};

void sendbyte(uchar byte)
{
     uchar num ,c;
     num=tab[byte];
     for(c=0;c<8;c++)
     {
      CLK=0;
      DAT=num&0x01;
      CLK=1;
      num>>=1;

      }

}


void delay(uint t)
{
  uint x,y;
  for(x=t;x>0;x--)
      for(y=120;y>0;y--);

}

void main()
{
      unsigned char h;
      while(1)
     {
           for(h=0;h<10;h++)
           {
               delay_50ms(1);
               sendbyte(h);
               delay_50ms(10);
           
            }
            h=0;
       }

}
程序在KEIL里编译时候报错了,P1,DAT,CLK都是unsigned identifier,该怎么解决呢?

相关帖子

沙发
z79325| | 2015-9-21 08:35 | 只看该作者
估计是什么头文件没有包含进去吧

使用特权

评论回复
板凳
xl531145882|  楼主 | 2015-9-21 11:33 | 只看该作者
z79325 发表于 2015-9-21 08:35
估计是什么头文件没有包含进去吧

...但是我全加进去了

使用特权

评论回复
地板
forget345| | 2015-9-21 15:45 | 只看该作者
include <c8051f350.h>   前面少一个#

使用特权

评论回复
5
z79325| | 2015-9-22 09:25 | 只看该作者
xl531145882 发表于 2015-9-21 11:33
...但是我全加进去了

无符号 标识符  好像不是没定义是吧,,,你自己检查检查

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

2

帖子

0

粉丝