完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
嗨,我需要做一个打断,每一个女士都要使用一个32 MZ的V1.40xC32编译器,而HAMONY V2.03B是CPU负载中最简单的解决方案。在和声演示中,我们使用time3中断+回调。我发现它与我以前的MLA解决方案相比真的很重。谢谢。
以上来自于百度翻译 以下为原文 Hi, I need to make an interrupt that fire every ms. I use a 32MZ with the V1.40 XC32 compiler , and Hamony V2.03b What is simplest solution in CPU load to make this. In the hARMony demo they use Timer3 interrupt + callback . I found it really heavy compare from an my old MLA solution. Thanks you |
|
相关推荐
18个回答
|
|
|
启用定时器服务并使用SysStMRMARCalbEngEng.以下是文档的用法:
以上来自于百度翻译 以下为原文 Enable the timer service and use SYS_TMR_CallbackPeriodic. Here is the usage from the documentation: SYS_TMR_HANDLE handle20ms, handle30ms; void Test_Callback ( uintptr_t context, uint32_t currTick ); handle20ms = SYS_TMR_CallbackPeriodic ( 20, 1, Test_Callback ); handle30ms = SYS_TMR_CallbackPeriodic ( 20, 2, Test_Callback ); void Test_Callback ( uintptr_t context, uint32_t currTick ) { if ( context == 1 ) { //20 ms } else { //30 ms } } |
|
|
|
|
|
谢谢,但是系统服务毫无用处,我正在寻找一种更便宜的资源解决方案。
以上来自于百度翻译 以下为原文 Thanks But the system service use lot of resource for nothing. I'm looking for a cheaper resource solution. |
|
|
|
|
|
8Con=0;T8CONBITS.TCKPS=?IEC1SET=IEC1A T8IEA掩码;IFS1CLR=IFIF1T8IFIFM掩模;IPC9BITS T8IP=1;PR8=?T8康塞特=T8CONION ON掩码;Vaul-Y-ISR(γTimeRe8Of向量,IPL1AUTO)Time8HANDER(空隙){IFS1CLR=IFIF1T8IFIAL掩码;}
以上来自于百度翻译 以下为原文 How about T8CON = 0; T8CONBbits.TCKPS = ?; IEC1SET = _IEC1_T8IE_MASK; IFS1CLR = _IFS1_T8IF_MASK; IPC9bits.T8IP = 1; PR8 = ?; T8CONSET = _T8CON_ON_MASK; void __ISR(_TIMER_8_VECTOR, IPL1AUTO) Timer8Handler(void) { IFS1CLR = _IFS1_T8IF_MASK; } |
|
|
|
|
|
让我问你一个问题:你需要回调还是仅仅寻找1毫秒的非阻塞延迟?如果是后者,请考虑使用α-uBuffTiNIN MFC0(9, 0)。我知道你已经指定了一个回调,但是MZ处理器在200 MHz的时候非常快,1毫秒很容易在主线代码中命中。
以上来自于百度翻译 以下为原文 Let me ask you this: do you need a callback or are you just looking for a non-blocking delay of 1 ms? If it's the latter, consider using __builtin_mfc0(9, 0). I understand that you've specified a callback, but the MZ processors are so blindingly fast at 200 MHz that 1 ms is easy to hit in your main line code. |
|
|
|
|
|
O.CP0xGETYAQuoTo()是等价的FuxBuffTiNIN MFC0(9, 0)
以上来自于百度翻译 以下为原文 _CP0_GET_COUNT() is the equivalent of __builtin_mfc0(9, 0) |
|
|
|
|
|
事实上,我需要一个非常精确的ISR来做一些计算。我会尽快测试你的想法。谢谢你。
以上来自于百度翻译 以下为原文 In fact I need a very precise ISR to make some calculations. I will test your ideas asap. Thanks you |
|
|
|
|
|
嗨,它的工作我找到了一个软件来计算PR和PraseCaleValueBask.MikRO.COM/PrimeS/VIEW/98/TIMER计算器谢谢你
以上来自于百度翻译 以下为原文 Hi, It works I've found a software to calculate the PR and prescale value libstock.mikroe.com/projects/view/398/timer-calculator Thanks you |
|
|
|
|
|
计时器工作非常孤独,但不可能与UDP栈一起使用。有两种解决方案吗?工作计时器的解决方案是:驱动程序:静态中断模式1TimeID 1CAML源:DRVYTMRMLCKSURCESTIONEngalPrimeCale8期12500,但是当我激活UDP时,不可能把定时器放在静态模式或UDP不工作。有人有另一个解决方案吗?但是不可能有一个完美的1ms。谢谢帮助。
以上来自于百度翻译 以下为原文 The timer was working perfectly lonely. But impossible to use it with the UDP stack . Is there a solution to use both ? The working timer solutions was: Driver : Static Interrupt Mode Instance 1 Timer ID 1 Clock source : DRV_TMR_CLKSOURCE_INTERNAL Prescale 8 Period 12500 but When I activate the UDP it is impossible to put the timer in static mode or the UDP don't work. Is someone have another solution I've tried the _CP0_GET_COUNT() but it is impossible to have a perfect 1ms . Thanks for help |
|
|
|
|
|
你在做什么,需要绝对精确的1毫秒的工作?我很好奇,因为可能有比你尝试的更好的方法。
以上来自于百度翻译 以下为原文 What are you doing that requires absolutely precise 1 ms work? I'm curious because there may be better approaches than what you're trying. |
|
|
|
|
|
你的1ms中断服务要执行多长时间?
以上来自于百度翻译 以下为原文 and how long is your 1ms interrupt service taking to execute? |
|
|
|
|
|
嗨,在我以前的代码(没有和谐)的程序是围绕一个1ms的频率循环,当所有的功能都使用我在70%的CPU负载(700 USEC),我使用的是PIC32 MX。在我的循环中,我做了多个PID、滤波和导数,所以当DT总是相同的时候它更精确和容易。所以在我的32 MZ的新版本中,我想用同样的方式,我不必重写所有的代码。实际上,和谐程序中的循环在30kHz和2之间运行。5kHz,它不可能有一个完美的1ms,所以我正在寻找一个定时器解决方案,重现我的1ms循环,与32 MZ的计算将很快。如果你有任何想法,欢迎你…谢谢你
以上来自于百度翻译 以下为原文 Hi, In my previous code (without Harmony) the program is made around a 1ms frequency loop, and when all the functions are used I'm under 70% of CPU load (700Usec), I'm using a PiC32MX. In my loop I make multiple PID, filtering and derivative so it is more precise and easy when you're dt is always the same. So in the new version with my 32MZ I wanted to used the same way like this I don't have to rewrite all the code . Actually the loop in the harmony program run between 30khz and 25khz and it impossible to have a perfect 1ms , so I'm looking for a timer solution to reproduce my 1ms loop, with the 32MZ the calcultion will be really fast. if you have any ideas you're welcome... Thanks you |
|
|
|
|
|
埃里克发布的1ms定时器中断是最好的方法,如果你的ISR代码只有100Us或更少。如果你开始进入几百个毫秒,那么你就不会把时间浪费在其他事情上。确切的时间将取决于更高优先级的中断和它们的处理时间。你可以使用FreeRTOS,并用TICK计时器通知你所有的定时任务。如果需要按顺序运行,请通知第一个并通知第二个。至少每个MS运行一次任务,系统任务也得到CPU的切片。如果你需要低抖动,1ms,那么你需要小心在ISR中做了多少,并且你最好用N个定时任务来使用一个n个kHz定时器,用一个模n个索引来决定哪个函数。对于UDP,它可能是谁具有更高的中断优先级级别的问题。
以上来自于百度翻译 以下为原文 The 1ms timer interrupt that Erik posted is the best approach IF your ISR code is only ~100us or less. If you start getting into the high hundreds of ms, then you will not leave time for anything else. The exact timing will depend on higher priority interrupts and their handling time. You could use FreeRTOS and have the tick timer Notify all of your timed tasks. If you need them to run in a sequence, Notify the first and have it Notify the second. At least then the tasks run about once per ms and the system tasks get their slice of CPU as well. If you need low jitter, 1ms, then you need to be careful how much you do in the ISR and you might be better off with N timed tasks to use an N KHz timer with a modulo-N index that decides which function to Notify. As to the UDP, it may be a matter of who has the higher interrupt priority level... |
|
|
|
|
|
对于UDP来说,它不是一个优先级问题。UDP需要一个计时器工作,我不能用它来做1ms的中断。
以上来自于百度翻译 以下为原文 For the UDP it is not a priority problem. The UDP require a timer to work and I can't use it for my 1ms interrupt. |
|
|
|
|
|
网络堆栈可以与其他回调共享计时器服务。所以你做错了什么。可选地,可以为中断使用不同的定时器。有或没有和谐的定时器驱动程序。信息在数据表中。
以上来自于百度翻译 以下为原文 The Network stack can share a timer service with other call backs. So you are doing something wrong. Optionally you can use a different timer for your interrupt. With or without the harmony timer drivers. The information is in the data sheet. |
|
|
|
|
|
够公平的。要清楚,我假设你在ISR中做这些计算。如果是这样的话,你不能重写很多,因为它已经完成/工作/测试,然后使用一个原始的定时器中断外的和谐结构是走的路。有人说,700我们,如果我有这个正确的,是相当多的计算时间为PIC32。有没有可能把一些计算改变成查找表?一般来说,如果给定计算的结果范围小且计算密集,那么查找表将显著地提高程序的吞吐量。
以上来自于百度翻译 以下为原文 Fair enough. To be clear, I'm assuming you're doing these calculations in the ISR. If that is the case, and you can't rewrite a lot of this because it's already done/working/tested, then using a raw timer interrupt outside the constructs of Harmony is the way to go. That having been said, 700 us, if I have this correct, is quite a bit of calculation time for a PIC32. Any chance you can change some of the calculations to a lookup table? Generally speaking, if the range of outcomes for a given calculation is small and the calculation is intensive, then a lookup table will significantly improve your program's throughput. |
|
|
|
|
|
如果你真的想让你的循环每1ms运行一次,你可以设置一个中断,每毫秒发射一次,做你的计算,然后睡觉。中断和看门狗计时器将唤醒PIC,这样您就可以运行循环的下一个迭代。您可以使用MIPS核心定时器来执行中断。Hyror不知道核心计时器,所以您可以使用它,而不必担心在Orthor配置器中正确设置项目。但是,这需要你手动设置核心定时器和它的中断。
以上来自于百度翻译 以下为原文 If you really want to have your loop run once every 1ms, you could set up an interrupt to fire every millisecond, do your calculations, and then go to sleep. Interrupts and the watchdog timer will wake up the PIC, so you can then run your next iteration of the loop. You can use the MIPS Core Timer to do your interrupts. Harmony does not know about the Core Timer and so you can use it without having to worry about setting up the project in the Harmony Configurator properly. This does require you to manually set up the Core Timer and its interrupt, however. |
|
|
|
|
|
看起来很有趣,谢谢。我可以用OpenCoeTimeTo吗?
以上来自于百度翻译 以下为原文 It looks interesting thanks. I can use it with OpenCoreTimer ? |
|
|
|
|
|
和谐并不知道你没有明确分配给它的任何定时器。PIC32 MZ有很多硬件定时器。
以上来自于百度翻译 以下为原文 Harmony does not know about any timer you have not explicitly assigned to it. The PIC32 MZ has a lot of hardware timers. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
454 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3529 浏览 3 评论
1121浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1094浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
872浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
460浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 16:40 , Processed in 1.942377 second(s), Total 111, Slave 93 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
657