打印

还是编译问题 数组定义方式

[复制链接]
4706|11
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ljm041128|  楼主 | 2011-11-8 10:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
----------------------------------------------------------------------
Debug build of project `E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\crowcon8008.mcp' started.
Language tool versions: mplink.exe v4.38, mplink.exe v4.38, mcc18.exe v3.37.01, mplib.exe v4.38
Preprocessor symbol `__DEBUG' is defined.
Target debug platform is `__MPLAB_DEBUGGER_ICD3=1'.
Debug platform options are: `__ICD2RAM=1'.
Tue Nov 08 10:44:43 2011
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean Warning: File "D:\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.o" doesn't exist.
Clean Warning: File "D:\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\crowcon8008.cof" doesn't exist.
Clean Warning: File "D:\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\crowcon8008.hex" doesn't exist.
Clean: Deleted file "E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\crowcon8008.mcs".
Clean: Done.
Executing: "E:\mcc18\bin\mcc18.exe" -p=18F45K22 "maxver2.0.c" -fo="maxver2.0.o" -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1697:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1700:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1703:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1706:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1709:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1712:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1715:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1718:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1721:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1724:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1727:Warning [2054] suspicious pointer conversion
E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\maxver2.0.c:1730:Warning [2054] suspicious pointer conversion
Executing: "E:\mcc18\bin\mplink.exe" /p18F45K22 /l"C:\mcc18\lib" "maxver2.0.o" /u_CRUNTIME /u_DEBUG /u_DEBUGCODESTART=0x7dc0 /u_DEBUGCODELEN=0x240 /u_DEBUGDATASTART=0x5f6 /u_DEBUGDATALEN=0xa /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /z__MPLAB_DEBUGGER_ICD3=1 /z__ICD2RAM=1 /o"crowcon8008.cof" /M"crowcon8008.map" /W
MPLINK 4.38, Linker
Copyright (c) 1998-2010 Microchip Technology Inc.
Errors    : 0
MP2HEX 4.38, COFF to HEX File Converter
Copyright (c) 1998-2010 Microchip Technology Inc.
Errors    : 0
Loaded E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\crowcon8008.cof.
----------------------------------------------------------------------
Debug build of project `E:\1\CROWCON8000 PIC18F4523\CROWCON8000 PIC18F4523\crowcon8008.mcp' succeeded.
Language tool versions: mplink.exe v4.38, mplink.exe v4.38, mcc18.exe v3.37.01, mplib.exe v4.38
Preprocessor symbol `__DEBUG' is defined.
Target debug platform is `__MPLAB_DEBUGGER_ICD3=1'.
Debug platform options are: `__ICD2RAM=1'.
Tue Nov 08 10:44:51 2011
----------------------------------------------------------------------
BUILD SUCCEEDED


const ram char Disp[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,
      //0 1     2    3    4    5    6    7    8    9    A    b    C    d    E    F
      0x76,0x38,0x40,0x3e,0x5c,0x31,0x70,0x08,0xce,0x08,0x08,0x40,0x80};
        // H    L    -    U    o    T   r   _    18   19  20    21  22

const ram char Dis_M[]={0xe,0x12,0x13,0x0f};//E-U

display_measure(&Dis_M);

void display_measure(unsigned char *Dis_String)
{
      unsigned char temp,i,j=0x10,code;
                for(i=0;i<4;i++)
               {
                   Led_code[i]=Dis_String[i];
               }
}

这种定义数组指针怎么会出现警告,有什么严重后果吗?
沙发
asspeed| | 2011-11-8 10:34 | 只看该作者
C18里指向ROM的指针和指向RAM的指针是不一样的。

使用特权

评论回复
板凳
ljm041128|  楼主 | 2011-11-8 10:44 | 只看该作者
怎样解决这个问题呢?

使用特权

评论回复
地板
yewuyi| | 2011-11-8 11:29 | 只看该作者
ROM指针应该定义常量指针吧?

使用特权

评论回复
5
ljm041128|  楼主 | 2011-11-8 11:38 | 只看该作者
常量指针怎样定义?

使用特权

评论回复
6
dz0658| | 2011-11-8 11:50 | 只看该作者
好像用ROM

使用特权

评论回复
7
yewuyi| | 2011-11-8 12:46 | 只看该作者
常量指针怎样定义?
ljm041128 发表于 2011-11-8 11:38


在类型前加const关键字

使用特权

评论回复
8
ljm041128|  楼主 | 2011-11-8 14:43 | 只看该作者
const rom char Disp[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,
      //0 1     2    3    4    5    6    7    8    9    A    b    C    d    E    F
      0x76,0x38,0x40,0x3e,0x5c,0x31,0x70,0x08,0xce,0x08,0x08,0x40,0x80};
        // H    L    -    U    o    T   r   _    18   19  20    21  22

const rom char Dis_M[]={0xe,0x12,0x13,0x0f};//E-U

都改成这样还出警告!

使用特权

评论回复
9
yewuyi| | 2011-11-8 16:41 | 只看该作者
不知道你加rom是哪里规定的,俺没用过C18,不知是否有这个规定?

PICC16只需要加const即可。

另外unsigned char *Dis_String是否也需要加const看看?

另外unsigned char temp,i,j=0x10,code;中的code是谁规定的?

俺没用过C18,提示一下。

使用特权

评论回复
10
asspeed| | 2011-11-8 19:51 | 只看该作者
像你后面的写法,还要赋值给const对象呀?
有一个资料很有用,它叫"C18 用户手册"

使用特权

评论回复
11
ljm041128|  楼主 | 2011-11-11 10:12 | 只看该作者
谢谢了!按照C18用户手册的方式解决了!

使用特权

评论回复
12
Light_David| | 2011-11-12 20:31 | 只看该作者
:D還是C51的那種通用指針用著爽:D

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

130

主题

455

帖子

0

粉丝