1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,我感兴趣的是“自定义模块”在“PIN模块”中的意思。根据我在http://MyCHIPPravestDeave:West:GPIOORD中发现的描述,这就像是PIN的另一个给定名称,这将是在编写配置中未覆盖的任何附加代码时使用的名称。这个页面还说,如果EQ为PIN设置了自定义名称,下面的宏应该在Pin管理器中。在生成代码后,我检查了PixMault.h。我可以看到这些宏//GET/SET RC4过程,定义了RC4xSETHEE():{LATCITS.LATC4=1;}(0)定义了RC4SETWORLVER()DO LATCITS.LATC4=0;}(0)定义了RC4x ToGeLe[()的定义:{LaCTBIT.LATC4= ~LATCITS.LATC4;}(0)α定义。cRb4xStudioDigalIdPUTPUTE()DO TrigCalbId.TrISC4=1;}(0)*定义RC4xStudioDigalOutPututer()DO TrccBist.TrISC4=0;}(0)*定义RC4SeToPulCuffle()DO {WPUCITBES.WPUC4=1;}(0)*定义RC4SeReTePULPULL()DO {WPUCPITS.WPUC4= 0;}(0)RC4GETValuy()端口请让我知道,我是否误解了自定义名称的含义,或者只是做错了什么?MPALBX IDE:4.15xC8:1.45谢谢您的帮助,/ Robi
以上来自于百度翻译 以下为原文 hello, I was interested what the "custom name" means in the "Pin Module". According to the description I found in http://microchipdeveloper...ress:gpiointroduction, this is like a additional given name for the pin, and this will be the name used while writing any additional code not covered in configuration. Also this page says if eq I set the Custom Name for a PIN, the following macros should be in the pin_manager.h: In my project I configured RA4 as digital output, and give the "PWR_STATUS" Custom Name. I checked the pin_manager.h after generated the code, and I can see these macros // get/set RC4 proceduresCould you please let me know, did I misunderstand the meaning of Custom Name, or just did something wrong? MPALBX IDE: 4.15 XC8: 1.45 Thanks for your help, /Robi |
|
相关推荐
11个回答
|
|
定义了RC4xToGeLe[()d{LabcTys.LATC4= LATCITS.LATC4;}(0)可以用:*定义:RC4Twitter TrcBITS.LATC4^=1 / /独占ORC44Twitter;//CAPS,因此您知道它是宏而不是变量或函数。你为什么把它们放进去?
以上来自于百度翻译 以下为原文 #define RC4_Toggle() do { LATCbits.LATC4 = ~LATCbits.LATC4; } while(0) You can replace with: #define RC4_TOGGLE LATCbits.LATC4 ^= 1 //exclusive or RC4_TOGGLE; //caps so you know that it is a macro rather than a variable or function. Take out all the do..whiles. Why do you put them in? |
|
|
|
他问为什么“定制的名字”没有被使用。他没有。是MCC把它们放在那里。这是我在别处看到的一些C技巧,以确保宏中的所有语句都被当作一个单独的块。
以上来自于百度翻译 以下为原文 He is asking why the "Custom name" is not being used. He didn't. It was MCC that put them there. This is some C trick I've seen elsewhere to ensure all statements in the macro are treated as a single block. |
|
|
|
如果您右键单击RC4YTwitter;或者在代码中的任何地方,选择“导航”,然后单击“查看宏扩展”,您将看到代码将在编译之前查看。
以上来自于百度翻译 以下为原文 If you right click RC4_TOGGLE; or anywhere in your code, select, "navigate" and then click, "view macro expansion" you will see the code as it will look before it is compiled. |
|
|
|
你会以为用1条单行线是没有理由的。我不使用MCC,认为这是你编写的代码。看起来还行。
以上来自于百度翻译 以下为原文 You would have thought that with 1 single line there would be no reason for it. I don't use MCC, thought it was code that you had written. Looks ok. |
|
|
|
可能是某个块像下面这样,所以“通用宏”(RC4**())仍然可用,只是使用它们的“自定义名称”变体。您可能需要搜索这些-它们可以在MCC生成的标题中的任何地方。P.S.:我不经常使用MCC,但我做同样的事情。手工操作。
以上来自于百度翻译 以下为原文 Could be somewhere is a block like the following #define PWR_STATUS_SetHigh() RC4_SetHigh() #define PWR_STATUS_SetLow() RC4_SetLow() Thus the "generic macros" ( RC4_*() ) are still available, the "Custom name" variants just using them. You might have to search for these - they could be anywhere in the MCC-generated headers. P.S.: I do not use MCC routinely, but I do the very same thing manually. |
|
|
|
嗨,In MCC,如果在“PIN模块”或其他设置窗口中发生了什么变化,则需要点击“资源管理”中的“生成”按钮,在左上面板中,改变在头文件或代码中生效。}当(0)围绕宏时,在GCC文档中解释:http://gcc.gun.org/OnLeNeDoCs/CPP/吞并分号。
以上来自于百度翻译 以下为原文 Hi, In MCC, if something is changed in 'Pin Module', or other setup windows, then it is needed to click the 'Generate' button in 'Resource Management', in the upper left panel, for the change to take effect in header files or code. The construct that is used by MCC: do { ... } while(0) around a macro, is explained in GCC documentation: https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing-the-Semicolon Mysil |
|
|
|
|
|
|
|
为我工作:Mysil
以上来自于百度翻译 以下为原文 Works for me: // get/set LEFT aliases #define LEFT_TRIS TRISBbits.TRISB4 #define LEFT_LAT LATBbits.LATB4 #define LEFT_PORT PORTBbits.RB4 #define LEFT_WPU WPUBbits.WPUB4 #define LEFT_OD ODCONBbits.ODCB4 #define LEFT_ANS ANSELBbits.ANSB4 #define LEFT_SetHigh() do { LATBbits.LATB4 = 1; } while(0) #define LEFT_SetLow() do { LATBbits.LATB4 = 0; } while(0) #define LEFT_Toggle() do { LATBbits.LATB4 = ~LATBbits.LATB4; } while(0) #define LEFT_GetValue() PORTBbits.RB4 #define LEFT_SetDigitalInput() do { TRISBbits.TRISB4 = 1; } while(0) #define LEFT_SetDigitalOutput() do { TRISBbits.TRISB4 = 0; } while(0) #define LEFT_SetPullup() do { WPUBbits.WPUB4 = 1; } while(0) #define LEFT_ResetPullup() do { WPUBbits.WPUB4 = 0; } while(0) #define LEFT_SetPushPull() do { ODCONBbits.ODCB4 = 0; } while(0) #define LEFT_SetOpenDrain() do { ODCONBbits.ODCB4 = 1; } while(0) #define LEFT_SetAnalogMode() do { ANSELBbits.ANSB4 = 1; } while(0) #define LEFT_SetDigitalMode() do { ANSELBbits.ANSB4 = 0; } while(0) // ... // get/set RIGHT aliases #define RIGHT_TRIS TRISCbits.TRISC5 #define RIGHT_LAT LATCbits.LATC5 #define RIGHT_PORT PORTCbits.RC5 #define RIGHT_WPU WPUCbits.WPUC5 #define RIGHT_OD ODCONCbits.ODCC5 #define RIGHT_ANS ANSELCbits.ANSC5 #define RIGHT_SetHigh() do { LATCbits.LATC5 = 1; } while(0) #define RIGHT_SetLow() do { LATCbits.LATC5 = 0; } while(0) #define RIGHT_Toggle() do { LATCbits.LATC5 = ~LATCbits.LATC5; } while(0) #define RIGHT_GetValue() PORTCbits.RC5 #define RIGHT_SetDigitalInput() do { TRISCbits.TRISC5 = 1; } while(0) #define RIGHT_SetDigitalOutput() do { TRISCbits.TRISC5 = 0; } while(0) #define RIGHT_SetPullup() do { WPUCbits.WPUC5 = 1; } while(0) #define RIGHT_ResetPullup() do { WPUCbits.WPUC5 = 0; } while(0) #define RIGHT_SetPushPull() do { ODCONCbits.ODCC5 = 0; } while(0) #define RIGHT_SetOpenDrain() do { ODCONCbits.ODCC5 = 1; } while(0) #define RIGHT_SetAnalogMode() do { ANSELCbits.ANSC5 = 1; } while(0) #define RIGHT_SetDigitalMode() do { ANSELCbits.ANSC5 = 0; } while(0) Mysil |
|
|
|
|
|
|
|
不要用下划线和大写字母或另一个下划线来使用名称。它们是严格保留的,供编译器使用。这是大多数C编译器的一般规则。
以上来自于百度翻译 以下为原文 Do NOT use names starting with an underscore followed by either an upper-case letter, or another underscore. They are strictly reserved for use by the compiler. That is a general rule in most C compilers. |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5242 浏览 9 评论
2031 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3207 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2256 浏览 5 评论
778浏览 1评论
668浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
595浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
677浏览 0评论
576浏览 0评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 14:56 , Processed in 1.443936 second(s), Total 69, Slave 62 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号