51单片机程序错误,无法编译?怎么搞好STC15F


http://zhidao.baidu.com/link?url=DmCONESvSPQsY7Rt_dutlyG8EQB_UW9lPz0w9uX3z9VRL9QvrDowx0T6l4qiQbC6eF7CSLMzU-rnGcHRDAJ-LzpzEgfQg-uNJSPcVmfefVm
#include 

sbit P2_0 = P2 ^ 0;  

sbit P2_1 = P2 ^ 1;   

sbit P2_2 = P2^ 2;  

sbit P2_3 = P2 ^ 3;  

sbit P2_4 = P2 ^ 4;  

sbit P2_5 = P2^ 5;  

sbit P2_6 = P2 ^ 6;  

sbit P2_7 = P2 ^ 7;  

void Delay()		//@27.000MHz
{
	unsigned char i, j, k;

	_nop_();
	_nop_();
	i = 103;
	j = 153;
	k = 44;
	do
	{
		do
		{
			while (--k);
		} while (--j);
	} while (--i);
}

void main(void)  

{  

while(1)  

{  

P2_7 = 0;      

P2_7 = 0;  

  Delay();

P2_6 = 1;  

P2_6 = 1;
P2_7 = 0;      

P2_7 = 0;  

  Delay();

P2_6 = 0;  

P2_6 = 0;
P2_7 = 1;      

P2_7 = 1;  

  Delay();

P2_7 = 1;  

P2_7 = 1;
P2_6 = 1;  

P2_6 = 1;

}  

}

错误提示:

创建目标 '目标 1'
PA51汇编 STARTUP.A51 ...
编译 o.c ...
O.C(26): 警告 C206: '_nop_': missing function-prototype
O.C(26): 错误 C264: intrinsic '_nop_': declaration/activation error
目标未产生

怎么搞?
 
  
 
  
#include 
添加这个头文件就可以了。因为你用到了
_nop_();
	_nop_();这个叫内嵌汇编
追问:
哦,我试试
追答:
你这个是个LED跑马灯的吧,入门的了。
 
 

你可能感兴趣的:(51单片机程序错误,无法编译?怎么搞好STC15F)