warning '_nop_': missing function-prototype error intrinsic '_nop_': declaration/activation error
总是出现错误warningC206:'_nop_':missingfunction-prototypeerrorC264:intrinsic'_nop_':declara...
总是出现错误
warning C206: '_nop_': missing function-prototype
error C264: intrinsic '_nop_': declaration/activation error
error C231: '_nop_': redefinition
warning C275: expression with possibly no effect
加了 intrins 头文件也不行,求大神指教
下面这是代码
#include <REGX52.H>
#include <intrins.h>
sbit LcdRs=P2^0;
sbit LcdRw=P2^1;
sbit LcdEn=P2^2;
sfr DBPort= 0x80;
unsigned char LCD_Wait(void)
{
LcdRs=0;
LcdRw=1; _nop_;
LcdEn=1; _nop_ ;
LcdEn=0;
return DBPort;
}
#define LCD_COMMAND 0
#define LCD_DATA 1
#define LCD_CLEAR_SCREEN 0x01
#define LCD_HOMING 0x02
void LCD_Write(bit style,unsigned char input)
{
LcdEn=0;
LcdRs=style;
LcdRw=0;
_nop_();
DBPort=input;
_nop_();
LcdEn=1;
_nop_();
LcdEn=0;
_nop_();
LCD_Wait();
}
#define LCD_SHOW 0x04
#define LCD_HIDE 0x00
#define LCD_CURSOR 0x02
#define LCD_NO_CURSOR 0x00
#define LCD_FLASH 0x01
#define LCD_NO_FLASH 0x00
void LCD_SetDisplay(unsigned char DisplayMode)
{
LCD_Write(LCD_COMMAND,0x08|DisplayMode);
}
#define LCD_AC_UP 0x02
#define LCD_AC_DOWN 0x00
#define LCD_MOVE 0x01
#define LCD_NO_MOVE 0x00
void LCD_SetInput(unsigned char InputMode)
{
LCD_Write(LCD_COMMAND,0x04|InputMode);
}
void LCD_Initial()
{LcdEn=0;
LCD_Write(LCD_COMMAND,0x38);
LCD_Write(LCD_COMMAND,0x38);
LCD_SetDisplay(LCD_SHOW|LCD_NO_CURSOR);
LCD_Write(LCD_COMMAND,LCD_CLEAR_SCREEN);
LCD_SetInput(LCD_AC_UP|LCD_NO_MOVE);
}
void GotoXY(unsigned char x,unsigned char y)
{
if(y==0)
LCD_Write(LCD_COMMAND,0x80|x);
if(y==1)
LCD_Write(LCD_COMMAND,0x80|(x-0x40));
}
void Print(unsigned char*str)
{
while(*str!='\0')
{
LCD_Write(LCD_DATA,*str);
str++;
}
} 展开
warning C206: '_nop_': missing function-prototype
error C264: intrinsic '_nop_': declaration/activation error
error C231: '_nop_': redefinition
warning C275: expression with possibly no effect
加了 intrins 头文件也不行,求大神指教
下面这是代码
#include <REGX52.H>
#include <intrins.h>
sbit LcdRs=P2^0;
sbit LcdRw=P2^1;
sbit LcdEn=P2^2;
sfr DBPort= 0x80;
unsigned char LCD_Wait(void)
{
LcdRs=0;
LcdRw=1; _nop_;
LcdEn=1; _nop_ ;
LcdEn=0;
return DBPort;
}
#define LCD_COMMAND 0
#define LCD_DATA 1
#define LCD_CLEAR_SCREEN 0x01
#define LCD_HOMING 0x02
void LCD_Write(bit style,unsigned char input)
{
LcdEn=0;
LcdRs=style;
LcdRw=0;
_nop_();
DBPort=input;
_nop_();
LcdEn=1;
_nop_();
LcdEn=0;
_nop_();
LCD_Wait();
}
#define LCD_SHOW 0x04
#define LCD_HIDE 0x00
#define LCD_CURSOR 0x02
#define LCD_NO_CURSOR 0x00
#define LCD_FLASH 0x01
#define LCD_NO_FLASH 0x00
void LCD_SetDisplay(unsigned char DisplayMode)
{
LCD_Write(LCD_COMMAND,0x08|DisplayMode);
}
#define LCD_AC_UP 0x02
#define LCD_AC_DOWN 0x00
#define LCD_MOVE 0x01
#define LCD_NO_MOVE 0x00
void LCD_SetInput(unsigned char InputMode)
{
LCD_Write(LCD_COMMAND,0x04|InputMode);
}
void LCD_Initial()
{LcdEn=0;
LCD_Write(LCD_COMMAND,0x38);
LCD_Write(LCD_COMMAND,0x38);
LCD_SetDisplay(LCD_SHOW|LCD_NO_CURSOR);
LCD_Write(LCD_COMMAND,LCD_CLEAR_SCREEN);
LCD_SetInput(LCD_AC_UP|LCD_NO_MOVE);
}
void GotoXY(unsigned char x,unsigned char y)
{
if(y==0)
LCD_Write(LCD_COMMAND,0x80|x);
if(y==1)
LCD_Write(LCD_COMMAND,0x80|(x-0x40));
}
void Print(unsigned char*str)
{
while(*str!='\0')
{
LCD_Write(LCD_DATA,*str);
str++;
}
} 展开
1个回答
展开全部
你自己写的程序都不记得了,也看不到吗?
#include <REGX52.H>
#include <intrins.h>
sbit LcdRs=P2^0;
sbit LcdRw=P2^1;
sbit LcdEn=P2^2;
sfr DBPort= 0x80;
unsigned char LCD_Wait(void)
{
LcdRs=0;
LcdRw=1; _nop_; //看这里, 应该是_nop_(); 你写的缺括号
LcdEn=1; _nop_ ;//看这里, 应该是_nop_();你写的缺括号
LcdEn=0;
return DBPort;
}
#include <REGX52.H>
#include <intrins.h>
sbit LcdRs=P2^0;
sbit LcdRw=P2^1;
sbit LcdEn=P2^2;
sfr DBPort= 0x80;
unsigned char LCD_Wait(void)
{
LcdRs=0;
LcdRw=1; _nop_; //看这里, 应该是_nop_(); 你写的缺括号
LcdEn=1; _nop_ ;//看这里, 应该是_nop_();你写的缺括号
LcdEn=0;
return DBPort;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询