完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,所有,我正在试验一个32位同步时钟计数器。我的目的是在64位计数器中计算微秒。为此,我有一个1MHz方波附加到time4输入。我想让计数器计数到最大的0xFFFFFFF,然后生成一个中断来增加一个变量。组合我都有一个64位计数器。但是,我不能成功地使0xFFFFFFF工作。查看代码我发现这是怎么回事?对于一个32位的时间,PR4和PR5寄存器需要设置。此代码只设置PR4。我错过什么了吗?THX,Jef
以上来自于百度翻译 以下为原文 Hi all, I'm experimenting with a 32bit synchronous clock counter. My intention is to count microseconds in a 64bit counter. For that I have a 1MHz square wave attached to the timer4 input. I want to let the counter count to the maximum 0xFFFFFFFF and then generate an interrupt to increment a variable. Combining both I have a 64bit counter. I however do not succeed in getting the 0xFFFFFFFF to work. Looking into the code I found this: PLIB_TEMPLATE void TMR_Period32BitSet_In32BitRegister (TMR_MODULE_ID index , uint32_t period ) { tmr_registers_t volatile * tmrX = ((tmr_registers_t *)(index)); if (TMR_ID_1 != index) { tmrX->PRx = period; } else { PLIB_ASSERT(false, "Timer1 instance does not support PLIB_TMR_Period32BitSet"); } } How is this supposed to work? For a 32 bit time the PR4 and PR5 registers need to be set. This code only sets PR4. Am I missing something? thx, Jef |
|
相关推荐
3个回答
|
|
你好,Jef Patat,上面的API位于“StudidiMicrochip 和谐 V2Y03B 框架外设 TMRTimeTMR.Pyro32 BITSSETIGIN 32位寄存器.h”文件中。我希望这个API仅适用于“PIC32 MK”家庭设备。PIC32 MK设备有9个定时器。其中,Time2-Time9可以充当16位或“32位个人”定时器。在其他设备家族中,如果您想要32位定时器,则需要组合定时器。如果您使用的不是PIC32 MK设备系列,则必须参考正确的模板文件。请参阅特定DeVI。CE处理器头文件要知道,它支持哪个模板文件。处理器头文件位于以下目录:“安装dieMicrochip HyralV2Y03B框架外围 TMR处理器“参考部分”第2部分-特征变体包含”在处理器头文件中。希望这对您有帮助。R要求,关于MVNSHIN
以上来自于百度翻译 以下为原文 Hi Jef Patat, Above API is located in "InstallDirmicrochipharmonyv2_03bframeworkperipheraltmrtemplatesTMR_Period32BitSet_In32BitRegister.h" file. I hope this API's holds good only for "PIC32MK" family devices. PIC32MK devices have 9 Timers. Out of which Timer2-Timer9 can act as either 16 bit or "32 bit individual" timers. In other device families, if you want to have 32bit timer, Then combination of Timers are required. If you are using other than PIC32MK device families, you have to refer the correct template file. Refer particular device processor header file to know, which template file does it support. Processor header files are located in following directory: "InstallDirmicrochipharmonyv2_03bframeworkperipheraltmrprocessor" Refer section "Section 2 - Feature variant inclusion" in Processor header file. Hope this helps your requirement. Regards, Mvns_in |
|
|
|
我确实使用了MK版本。我需要重新检查数据表,因为我只知道需要的计时器的组合。谢谢提示!
以上来自于百度翻译 以下为原文 I am indeed using a MK version. I need to recheck the datasheets because I only read about the combination of timers being required. Thanks for the tip! |
|
|
|
要记住的是,当定时器被配置为32位操作时,PR4将充当一个完整的32位寄存器。因此,不必单独设置PR5。
以上来自于百度翻译 以下为原文 One thing to keep in mind is that PR4 will act as a full 32-bit register when the timer is configured for 32-bit operation. Therefore, it is not necessary to set PR5 separately. |
|
|
|
只有小组成员才能发言,加入小组>>
5250 浏览 9 评论
2037 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2266 浏览 5 评论
788浏览 1评论
680浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
609浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-29 02:13 , Processed in 1.427093 second(s), Total 80, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号