12864 写字符串函数出错误,求解
这个是12864 写字符串的函数,高手帮忙看看,错在哪里? 给点意见,或者指导下其他的方法void LCD(unsigned char addr,unsigned char *STR)
{
unsigned char ii=0,x,y;
x=addr/10;
y=addr%10;
write_cmd(LCD_a);//12864 写入显示地址
for(ii=0;STR!='\0';ii++)
write_dat(STR);
_delay_ms(5);
}
AVRGCC编译的提示
../DEVICE.C:27: error: invalid conversion from 'const char*' to 'unsigned char*'
../DEVICE.C:27: error: initializing argument 2 of 'void LCD(unsigned char, unsigned char*)'
谢谢啦 1、直接把unsigned char*改为char* 把unsigned char*改为char*后
编译错误提示为:
../lcd128.c:194: error: conflicting types for 'LCD'
../lcd128.h:10: error: previous declaration of 'LCD' was here
make: *** Error 1
Build failed with 2 errors and 0 warnings... *.h文件里面还没有改过来嘛??? /**************在X(行)Y(列)显示字符串********************/
void LCD_Display_String( uchar x,uchar y,uchar *str )
{
LCD_Set_XY(x,y); //先确定起始行和列
while (*str!='\0')
{
LCD_Write_DATA(*str);
str++;
Delay_ms(1); //写入字符串
}
}
STR是指针,问题出自你的STR 回复【4楼】jingwaner
-----------------------------------------------------------------------
好的,我去试一试吧,谢谢啦 学习记号备用
页:
[1]