完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
好的一天,我想简单地读写核心定时器——32位定时器,它对SysCLK循环进行计数。我不需要中断它,我不需要任何花哨的东西,我只是想用它来测量delta时间。当然,我可以使用外围定时器模块,但这些可以做很多其他事情。S和可以被捆绑或运行在从SysCLK分拆的PBLK中,或者甚至从外部源运行或参与生成PWM或脉冲宽度测量。在SISCLK上(在这MIPS内核中似乎是固有的)具有一个简单的32位自由运行计数器将是非常方便的。我如何用XC32简单地读取核心定时器的当前值,而不必导入任何额外的LIB,如PLIB或配置器或和声?读一个32位寄存器并不难,非常感谢,杰西。
以上来自于百度翻译 以下为原文 Good Day, I'd like to simply read and write the core timer -- the 32 bit timer that counts SYSCLK cycles. I don't need interrupts off of it, and I don't need anything fancy, I just want to use it to measure delta time. Sure, I could use the peripheral timer modules but those can do lots of other things and may be tied up or running on a PBCLK that's divided down from SYSCLK or even running from external sources or involved in generating PWM or pulse width measurement. Having a simple 32bit free running counter on SYSCLK (which seems to be inherent in this MIPS core) would be super handy! How do I simply read the current value from the core timer with XC32, without having to import any extra libs like plib or configurator or hARMony? It shouldn't be that difficult to read a 32 bit register someplace. Thank you very much, Jesse |
|
相关推荐
5个回答
|
|
这是一个MIPS寄存器。您可以直接阅读它。
以上来自于百度翻译 以下为原文 It is a MIPS Register. You can read it directly. I have _CP0_GET_COUNT(); I am not sure if it is harmony or the compilers define |
|
|
|
非常感谢!我真的很感激!似乎是在CP0DEFF中定义的。HI没有安装和谐或配置器,所以必须内置。无论如何,这似乎是有效的:写命令看起来是:但我没有测试过。顺便说一下,核心时钟似乎运行在SysCLK/2,再次感谢!
以上来自于百度翻译 以下为原文 Thank you so much!! I really appreciate it! Seems to be defined in cp0defs.h I do not have harmony or configurator installed so it must be built in. Anyway, this seems to work: int myvar; myvar=_CP0_GET_COUNT() The write command appears to be: _CP0_SET_COUNT(val); but I have not tested this. Incidentally, the core clock seems to run at SYSCLK/2. Thanks again! |
|
|
|
是的,核心定时器运行在指令时钟的一半。你所引用的宏是用于构建和读取的包装器。
以上来自于百度翻译 以下为原文 Yes, the core timer runs at half the instruction clock. You macros quoted are wrappers for the builtins _mtc0(9,0,val); to write and val=_mfc0(9,0); to read. |
|
|
|
在CP0DEFS.H中定义了*CP0xGETYAQUTTHER(和)CP0SETSySCOUNT(VAL),它包含在XC.H中,并使用那里的MyTC0宏。所以,不需要和谐,你只需要包含和lcx.h & gt;
以上来自于百度翻译 以下为原文 _CP0_GET_COUNT() and _CP0_SET_COUNT(val) is defined in cp0defs.h, which is included in xc.h and uses the _mtc0 macros from there. So, no Harmony needed and you only need to #include |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
4839 浏览 9 评论
1842 浏览 8 评论
1756 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2968 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2072 浏览 5 评论
467浏览 1评论
1120浏览 1评论
303浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
371浏览 0评论
268浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-5-6 02:23 , Processed in 0.862595 second(s), Total 79, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号