完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我正在尝试将一个PIC18F26K22的项目从C18编译器转换成XC8编译器。这个完整的项目用C18编译器工作。用XC8(V1.38),我有一个指针指针的赋值(初始化)失败的问题。如果我使用了提取的代码片段。在一个小示例程序(比如down)中,一切正常。如果在整个项目中使用SAME代码,列表中的点号已经为NULL。有人能给我一个提示吗?
以上来自于百度翻译 以下为原文 Hello, I'm trying to convert a project for a PIC18F26K22 from a C18 compiler to a XC8 compiler. The complete project works correct with the C18 compiler. With XC8 (v1.38) I have the problem that the assignment (initialization) of a pointer to an array of pointers fails. If I use extracted code snippets within a small example program (like down), all is ok. If I use the SAME code within the whole project, already the pionter within the list is NULL. Can someone give me a hint please ? #define DATA_STATIC static #define UCHAR unsigned char #define PUCHAR unsigned char* #define INT32 long #define PINT32 long* #define UINT16 unsigned short #define T1_SIZE_OF_SERVICE_BUFFER 56 #define T1_NUMBER_OF_SERVICE_CHANNEL 1 /* memory fo Mailbox */ static unsigned char gaucChannelBuffer0[56]; unsigned char* T13_aucServiceChannelBufferList[2] = {gaucChannelBuffer0, NULL}; unsigned short T13_ausSizeOfSCBList[2] = {sizeof(gaucChannelBuffer0), 0}; unsigned char* T13_pvOpenServiceChannel(short ssChannelIndex, long* pslSizeOfServiceChannelBuffer, long argc, char* argv[]) { *pslSizeOfServiceChannelBuffer = T13_ausSizeOfSCBList(ssChannelIndex); return T13_aucServiceChannelBufferList[ssChannelIndex]; } ..... unsigned char* pMailbox = NULL; long SizeOfMailbox = 0; pMailbox = T13_pvOpenServiceChannel(0, &SizeOfMailbox, 0, NULL) |
|
相关推荐
6个回答
|
|
我以前也尝试过这种方法,也尝试过char*T13_aucServiceChannelBufferList[2]={&gaucChannelBuffer0[0],NULL};但是没什么帮助。现在我已经创建了一个新的XC8项目,将所有的源放入其中,设置所有定义,现在它都工作了。对XC8编译器(这似乎不起作用)。我希望其他问题也将由此解决。
以上来自于百度翻译 以下为原文 I have tried this before and also unsigned char* T13_aucServiceChannelBufferList[2] = {&gaucChannelBuffer0[0], NULL}; but nothing helps. Now I have create a new XC8 project, put all my sources in it, set all defines and now it works. Before this I changed only the compiler settings of my old project to the XC8 compiler (that does not seem to be working). I hope that the other problems will solved also by this. |
|
|
|
你为什么要把已经是地址的东西拿走了?
以上来自于百度翻译 以下为原文 Why do you want to take the address of something that is already an address? |
|
|
|
这里没有C专家,但我认为数组名称的应用和冗余是多余的,并且应该发出警告。
以上来自于百度翻译 以下为原文 No C expert here, but I think applying & to an array name is redundant, and should throw a warning. |
|
|
|
我已经使用“&数组;0”来指向一个特定的数组成员。
以上来自于百度翻译 以下为原文 I have used "&array[0]" to point to a specific array member. |
|
|
|
我看到添加的“main.c:39:warning:(362)redundant”&”应用于数组“所以是的,您完全正确,它确实抛出警告……
以上来自于百度翻译 以下为原文 I see this with the addition of "main.c:39: warning: (362) redundant "&" applied to array" So yes you are quite correct and it does throw a warning.. Attached Image(s) |
|
|
|
你好,谢谢所有的留言。我使用数组的名称或第一个元素的地址指向这个数组。在我的例子中,我需要一个指针数组作为一个列表来指向一个或多个消息缓冲区。这工作现在(在创建一个新的XC8项目)之后。
以上来自于百度翻译 以下为原文 Hello, thanks for all messages. I use either the name of an array or the address of the first element to point to this array. In my case I need an array of pointer as a list to point to one or more message buffer. This works now (after create a new XC8 project). |
|
|
|
只有小组成员才能发言,加入小组>>
5178 浏览 9 评论
2003 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3177 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
737浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
636浏览 0评论
533浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 18:03 , Processed in 1.289065 second(s), Total 87, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号