#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;
}
}
用的C8051F350单片机,想用74LS164驱动一个数码管,KEIL报错了:P1,DAT,CLK都是undefined identifier.该怎么解决? |