完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
我很难把我的问题张贴到这个论坛上。在论坛支持论坛上,我把它作为一个快速的回复,所以我要在这里尝试一下。希望它能起作用,我不会搞得一团糟!张贴规则是非常限制性的…
以上来自于百度翻译 以下为原文 I am having a very difficult time posting my problem to this forum. I was able to post it as a quick reply in the "Forum Support" forum, so I am going to try that here. Hopefully it works and I don't make a mess! The posting rules are very restrictive... |
|
相关推荐
4个回答
|
|
我们有多个项目使用一些共同的代码。有些项目有不同的时钟速率。通用代码段之一使用UART。UART相关文件位于.\CudioSerialcom中的目录中,在UART1.C文件中定义BRG:FoSC定义在St.h中的项目文件中:…ProjestProjordNo.固件SR\驱动程序。这两个文件都是项目的一部分。两个目录都包含在Project Pro/Realth/Stand文件夹中。两个目录都包含在ProjtProjts/xC16 GCC中,下拉框中选择“预处理和消息”,C包括DRE。显然,如果我在UART1.C文件中不包括Syt.h,我会得到:“错误:‘FoSC’未被删除”。但是当我包含Syt.h时,我得到了一个奇怪的(似乎不相关的)第一个错误如下:“从……/SRC/驱动程序/系统中包含的文件。h:30:0,从….. /…/No./SerialCu/UART1.C:51:…///…/No./Serialcom/Serialcom。h:18:20:错误:预期''”在“TopRunt”“系统”h之前明显使用EL WHE。在项目中,没有这个“FoSC”的要求,它没有问题地建立起来。查看论坛帖子“M77 8606 .ASPX”(抱歉,我还不允许链接),我想它与目录结构有关。有没有办法让这个工作?
以上来自于百度翻译 以下为原文 We have multiple projects using some common code. Some of the projects have different clock rates. One of the common code sections uses the UART. The UART related files are located in the directory: ..CommonSerialCom To define a BRG in the uart1.c file I have: // Baud Rate = 115200; U1BRG = (int)((FOSC / (2 * 4 * 115200)) - 1); FOSC is defined in the project files in system.h located in the directory: ..ProjectsProjectNamefirmwaresrcdrivers Both files are part of the project. Both directories are included in Project Proerties/General/Source Folders. Both directories are included in Project Properties/XC16-gcc, Drop down box select "Preprocessing and messages", C include dirs. Obviously, if I don't include system.h in the uart1.c file I get: "error: 'FOSC' undelared". But when I include system.h, I get a weird (seemingly unrelated) first error as follows. "In file included from ../src/drivers/system.h:30:0, from ../../../Common/SerialCom/uart1.c:51: ../../../Common/SerialCom/SerialCom.h:18:20: error: expected ')' before 'toPrint'" System.h is obviously used elsewhere in the project and without this "FOSC" requirement it builds without issue. After looking at forum post "m778606.aspx" (Sorry, I'm not allowed to link yet) I think it has to do with the directory structure. Is there a trick to get this to work? |
|
|
|
很显然,您在投影的其他地方使用了System.h,没有人能看到您所做的。这不是目录错误,而是代码错误。您看过SerialCom.h中的第18行吗?什么是托普林特?它是宏吗?前面有什么问题?前面系统中包含的标题有问题吗?h
以上来自于百度翻译 以下为原文 System.h is obviously used elsewhere in the project only obvious to you, noone can see what you did That is not a directory error it is a code error. Did you look at line 18 in SerialCom.h? what is 'toPrint? Is it a Macro? what is immediately before it. Is there a problem with the header included before system.h |
|
|
|
可以。。。我不想张贴更多的帖子,因为帖子已经长了。我会尝试给予更多,但这是一个好规模的项目,我只想给尽可能多的信息,因为需要。我在找人说……”是的,我遇到过这样的问题。“St.h在项目中的其他12个文件中使用。如果我用常量替换FOSC(在原始文章中)并将system.h从uart1.c中的include中移除,那么项目构建得很好。system.h中的第29-31行:“SerialComOn”被定义。uart1.c中的第47-52行:以及SerialCom.h的整个文件:
以上来自于百度翻译 以下为原文 Okay... I was trying to not post more than is needed, because the post was already getting long. I'll try giving more, but this is a good sized project and I only want to give as much info as is needed. I was fishing for someone to say... "yeah I've had a problem like that." system.h is used in 12 other files in the project. If I replace FOSC (in original post) with a constant and remove the system.h from the include in uart1.c then the project builds fine. Line 29-31 in system.h: #ifdef SerialComOn #include "SerialCom.h" #endif "SerialComOn" is defined. Line 47-52 in uart1.c: /** Section: Included Files */ #include "system.h" #include "uart1.h" And the entire file of SerialCom.h: /* * File: SerialCom.h * Author: A Wolfe * * Created on March 2, 2016, 5:42 PM */ #ifndef SERIALCOM_H #define SERIALCOM_H #ifdef __cplusplus extern "C" { #endif void SerialCom_Initialize (void); void PrintString(char *String); void PrintDecimal(int toPrint); void PrintHex(BYTE toPrint); void PrintHex16(int toPrint); #ifdef __cplusplus } #endif #endif /* SERIALCOM_H */ |
|
|
|
谢谢。在这个作用域中没有定义字节。我忽略了它。
以上来自于百度翻译 以下为原文 Thanks. BYTE was not defined in this scope. I had overlooked it. |
|
|
|
只有小组成员才能发言,加入小组>>
5212 浏览 9 评论
2019 浏览 8 评论
1944 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3192 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2246 浏览 5 评论
760浏览 1评论
647浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
567浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
659浏览 0评论
557浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-12 10:16 , Processed in 1.361417 second(s), Total 83, Slave 69 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号