[技术讨论] KEIL相关问题求助

[复制链接]
1580|11
 楼主| NEWTECHNOOB 发表于 2023-2-3 14:52 | 显示全部楼层 |阅读模式
大佬们,为啥这个结构体内,一样的数据,一样的结构,有的会警告有的不会啊,而且几分钟之前它们都是没有警告的,这应该是哪儿出了问题啊?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
wangxiangtan2 发表于 2023-2-3 15:24 | 显示全部楼层
刚在keil里面试了一下,没警告。你这警告内容是什么?
 楼主| NEWTECHNOOB 发表于 2023-2-3 15:35 | 显示全部楼层
wangxiangtan2 发表于 2023-2-3 15:24
刚在keil里面试了一下,没警告。你这警告内容是什么?

lcd.c(349): warning:  #144-D: a value of type "char *" cannot be used to initialize an entity of type "unsigned char"
lcd.c(349): error:  #69: integer conversion resulted in truncation
都是这两个警告
 楼主| NEWTECHNOOB 发表于 2023-2-3 15:38 | 显示全部楼层
而且汉字也会出现这种问题
wang1979 发表于 2023-2-3 18:28 | 显示全部楼层
结构定义的和内容不符,另外赋值方式也不对!

jack821119 发表于 2023-2-3 18:42 | 显示全部楼层
明显赋值就不规范,"A"是字符串,用'A'试试。
海洋无限 发表于 2023-2-3 19:42 | 显示全部楼层
源码有没有用其他编辑器编辑过
wangxiangtan2 发表于 2023-2-4 08:24 | 显示全部楼层
NEWTECHNOOB 发表于 2023-2-3 15:35
lcd.c(349): warning:  #144-D: a value of type "char *" cannot be used to initialize an entity of t ...

a value of type "char *" cannot be used to initialize an entity of type "unsigned char",人家说了char*不能用来初始化unsigned char,改成‘A’试试
coody 发表于 2023-2-4 10:12 | 显示全部楼层
数据类型与变量类型没对齐,强转一下即可。
William1994 发表于 2023-2-4 21:15 | 显示全部楼层
const typFNT_ABC GB16_Code[]= {
{ {'A'},{0x00,...},
{ {'B'},{0x00,...},
{ {'C'},{0x00,...},
} ;
随手写的,标点用的中文。
应该是这个格式。
鸡蛋鸭蛋荷包蛋 发表于 2023-2-4 22:29 | 显示全部楼层
这个应该是LCD显示屏给的程序,不用管它.
13775972833 发表于 2023-2-5 12:59 | 显示全部楼层
英文和汉字不一样
//常用ASCII表
//偏移量32
//ASCII字符集
//偏移量32
//大小:12*6
const unsigned char asc2_1206[95][12]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00,0x00},/*"!",1*/
{0x00,0x14,0x0A,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
{0x00,0x00,0x14,0x14,0x3F,0x14,0x0A,0x3F,0x0A,0x0A,0x00,0x00},/*"#",3*/
...
typedef struct
{
       unsigned char Index[2];       
       char Msk[32];
}typFNT_GB16;
//字体取模:宋体常规小四 横向取模 字体正序
//阴码  逐行 顺向
const typFNT_GB16 tfont16[]=   
{
"徐",0x10,0x40,0x10,0x40,0x20,0xA0,0x41,0x10,0x92,0x08,0x15,0xF6,0x20,0x40,0x60,0x40,
0xA7,0xFC,0x20,0x40,0x22,0x50,0x22,0x48,0x24,0x44,0x28,0x44,0x21,0x40,0x20,0x80,/*0*/
"州",0x10,0x04,0x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x54,0xA4,0x52,0x94,0x52,0x94,
0x90,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x20,0x84,0x20,0x84,0x40,0x04,0x80,0x04,/*1*/
...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

19

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部