keil c说 xbyte 没定义#include #define DIGPORT XBYTE[0x0200] //定义字位口#define WORDPORT XBYTE[0x0100] //定义字型口#define fosc 11.0592#define time0 2000 //延时#define uchar unsigned char#define uint unsigned intuchar digbit; uchar wo
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 00:03:38
keil c说 xbyte 没定义#include #define DIGPORT XBYTE[0x0200] //定义字位口#define WORDPORT XBYTE[0x0100] //定义字型口#define fosc 11.0592#define time0 2000 //延时#define uchar unsigned char#define uint unsigned intuchar digbit; uchar wo
keil c说 xbyte 没定义
#include
#define DIGPORT XBYTE[0x0200] //定义字位口
#define WORDPORT XBYTE[0x0100] //定义字型口
#define fosc 11.0592
#define time0 2000 //延时
#define uchar unsigned char
#define uint unsigned int
uchar digbit;
uchar wordbuf[4];
uint idata time0_tmp;
uchar gercode(char i);
void display(void);
/*主函数*/
void main()
{
DIGPORT=0;
TMOD=0x01;
time0_tmp=65536-time0*fosc/12;
TH0=(time0_tmp/256);
TL0=(time0_tmp%256);
TR0=1;
ET0=1;
EA=1;
digbit=0x01;
wordbuf[3]=4;
wordbuf[2]=3;
wordbuf[1]=2;
wordbuf[0]=1;
while(1);
}
void time0_int(void) interrupt 1
{
TH0=(time0_tmp/256);
TL0=(time0_tmp%256);
display();
}
uchar getcode(uchar i)
{
uchar p;
switch(i)
{
case 0:p=0x3f; break;
case 1:p=0x06; break;
case 2:p=0x5B; break;
case 3:p=0x4F; break;
case 4:p=0x66; break;
default:break;
}
return(p);
}
void display(void)
{
uchar i;
switch (digbit)
{
case 1:i=0; break;
case 2:i=1; break;
case 4:i=2; break;
case 8:i=3; break;
default:break;
}
DIGPORT=0;
WORDPORT=gercode(wordbuf[i]);
DIGP0RT=digbit;
if (digbit
keil c说 xbyte 没定义#include #define DIGPORT XBYTE[0x0200] //定义字位口#define WORDPORT XBYTE[0x0100] //定义字型口#define fosc 11.0592#define time0 2000 //延时#define uchar unsigned char#define uint unsigned intuchar digbit; uchar wo
xbyte是一个宏定义在absacc文件中,在前面加一个#include 这个头文件即可