完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
PIC18F27 K40HI,函数A—我使用TMR0作为程序的慢周期计数器。一旦TMR0上指定数量的“蜱”已经通过,那么采取一些行动。TMR0的全部计数(16位)最多是分钟。函数B—I也使用TMR0(重新编程它的配置)作为长时间设备来唤醒设备从睡眠。TMR0的整个计数可以是半天……当它在函数A中使用并命中它的末端时,它会触发它的中断并运行TMR0 ISR,对吗?在我思考的这个阶段,TMR0ISR会简单地重置计时器并重新启动它。程序将从它被粗暴地中断的地方继续。当它被用作函数B中的睡眠中断器时,它会在计数结束时触发它的中断,并且…我正在考虑触发它的中断,然后触发我的睡眠数据的重置,如我的数据表第8.13部分所述,叫做“确定重置的原因”(pp.81.)。在那里它说程序计数器在PC+ 2。这是否意味着它将不运行TMR0 ISR而是跳到第二个指令之后的睡眠();指令?在这一点上,我应该检查状态寄存器的TO和PD位状态,然后跳转到适当的程序?谢谢,史提夫
以上来自于百度翻译 以下为原文 PIC18F27K40 Hi, Function A - I'm using TMR0 to act as a slow period counter for parts of the program. ie. once a specified number of 'ticks' on TMR0 have passed then take some action. The whole count (16bits) of TMR0 would be minutes at best. Function B - I'm also using TMR0 (after re-programming its configuration) as a long time period device to wake up the device from sleep. The whole count of TMR0 could be half a day... So. When it is being used in Function A and hits its end, it will fire its interrupt and run the TMR0 ISR right ? At this stage of my thinking TMR0 ISR would simply reset the timer and restart it. The program would continue from where it was rudely interrupted. When it is being used as a sleep interrupter in Function B, it fires its interrupt at the count end and ... ? I am thinking the firing of its interrupt then triggers a reset from sleep as described in section 8.13 of my datasheet called "Determining the Cause of a Reset" (pp.81). In there it speaks of the program counter being at PC+2. Does that mean it will not run TMR0 ISR but jump to the second instruction after the Sleep(); instruction ? At which point I should check the STATUS register for TO and PD bit status and then jump into program proper ? Thanks, Steve |
|
相关推荐
4个回答
|
|
你打算用什么来计时?为了得到一分钟的翻转,即使使用1:8预分频器,也需要一个8KHz或更少的输入时钟。这个PIC确实有很多时钟选项,所以我想这可能是使用另一个定时器的输出,但是你没有提到任何东西。不需要“重置和重启”。计时器翻转不会停止计时器,它只是从零继续。计时器1章说使用定时器。1在睡眠模式,它必须从SOSC或外部时钟源时钟。这就是你的计划吗?(然而,在其他地方,它说HFIFToC保持在睡眠模式下运行,所以也许您可以使用它)是否在唤醒上执行中断是由GIE位设置决定的。在6.2.1的数据表中详细描述了从睡眠唤醒和6.2.2唤醒使用中断。
以上来自于百度翻译 以下为原文 What are you going to clock it with? To get a one minute rollover, even using the 1:8 prescaler, will require an input clock of 8kHz or less. Again, what are you clocking it with? This PIC does have lots of clocking options, so I guess this is possible using the output of another timer, but you haven't mentioned anything about that. No need to "reset and restart". A timer rollover does NOT stop the timer, it just continues on from zero. The timer 1 chapter says that o use Timer 1 in sleep mode, it MUST be clocked from the SOSC or an external clock source. Is that what you are planning? (However, elsewhere it says the HFINTOSC keeps running in SLEEP mode, so maybe you can use that) Whether or not it executes an interrupt on wakeup is determined by the GIE bit setting. That is described in detail in the datasheet under 6.2.1 WAKE-UP FROM SLEEP and 6.2.2 WAKE-UP USING INTERRUPTS |
|
|
|
HQQHB,与LimtoSc计时。LimtoSC在睡眠模式下工作。我只是不知道程序将从哪里醒来时继续…谢谢有关定时器翻转的信息。也许只是在模式A中禁用中断……欢呼,
以上来自于百度翻译 以下为原文 Hi QHB, Clocking with LFINTOSC. LFINTOSC does work in SLEEP mode. I just don't know where the program will continue from when it wakes up ... Thanks for the info about the rollover on the timer. Perhaps then just disable the interrupt in Mode A ... Cheers, |
|
|
|
|
|
|
|
我认为6.2.1更清楚地说明了唤醒时发生了什么,不管原因是什么。
以上来自于百度翻译 以下为原文 I think 6.2.1 is more explicit as to exactly what happens at wake-up, regardless of the reason. |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2037 浏览 8 评论
1957 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2265 浏览 5 评论
788浏览 1评论
680浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
608浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 11:45 , Processed in 1.291904 second(s), Total 84, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号