完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
与输入捕获模块非常混淆。我已经为输入捕捉模块配置了time3。这是否意味着Time3和IC模块运行在同步或Time3中独立运行。我的意思是说,如果输入捕获模块中断发生,它会重置Time3值吗?例如,如果Time3当前值为65000,输入捕获发生在这里,在65536发生溢出计数器吗?我的意思是说我还在检查溢出计数器来识别低频信号。它误导了我吗?我应该在第一个输入捕获信号中清除Time3缓冲区值。请帮忙。
以上来自于百度翻译 以下为原文 Very confused with the input capture module. I have configured Timer3 for input capture module. Does it mean Timer3 and IC module run in sync or Timer3 runs independently. I mean to say if input capture module interrupt happens does it reset the timer3 value? For example if Timer3 present value is 65000 and input capture happens here and at 65536 does overflow counter happens? I mean to say i am also checking for overflow counter to identify low frequency signals. Does it mislead me? Should i clear Timer3 buffer value at first input capture signal. Please help. |
|
相关推荐
4个回答
|
|
你需要确切地告诉我们你使用的是哪种MCU。我认为大多数设备的DSIC33家族都有类似的输入捕获外围设备,但我不会依赖它。我随机选择了DSPIC33 EP128GM304进行讨论,因为它是第一个弹出的,当我开始把零件号输入到微芯片站点时,你需要查看在数据表中的“输入捕获”描述的开始附近的图表。也可以为你的设备看合适的FRM部分。基本上,同步可以应用于你正在捕获的输入信号。通常,如果你使用FP作为输入(按定义),则计时器将被同步,如果你使用外部时钟信号,*可以被同步。当你问你的问题时,我感觉到你并不真正理解IC外围设备是如何工作的。计时器用于输入捕获的方式是它假设(需要?)它一直在滴答滴答地响着。它用来触发一个内部计数器(ICXTMR),它是一个无符号值,所以它总是可以从先前的值中减去,即使它是环绕的。(当然,如果允许在触发器之间缠绕不止一次,那就错了。)苏珊
以上来自于百度翻译 以下为原文 You need to tell us exactly which MCU you are using. I *think* most of the dsPIC33 families of devices have a similar input capture peripheral but I would not rely on that. I've randomly picked the dsPIC33EP128GM304 for this discussion as it was the first that popped up as I started to type the part number into the Microchip site. You need to look at the diagram that will be near the start of the 'Input Capture' description in the data sheet. Also look at the appropriate FRM section for your device. Basically the synchronisation can be applied to the input signal that you are 'capturing'. Typically the timer will be synchronised if you use the Fp as its input (by definition) and *can* be synchronised if you use an external clock signal. The way you ask your question, I get the feeling that you don't really understand how the IC peripheral works. The way the timer is used for the input capture is that it assumes (requires?) that it keep on 'ticking'. It is used to trigger an internal counter (ICxTMR) which is an unsigned value so it can always be subtracted from the previous value even if it wraps around. (Of course it will be wrong if it is allowed to wrap around more than once between triggers.) Susan |
|
|
|
嗨,输入捕捉模块,和定时器为它选择,一起工作!当捕获触发发生时,输入捕获模块记录定时器值的“快照”。可能有一些不同的可用模式,但是对于基本情况来说,计时器将继续运行,而不管捕获事件。您使用定时器中断和捕获值的设计都是明智的。当定时中断和捕获中断被同时触发或非常接近时,仍然可能有一些情况引起混乱。在消息1中的示例情况下,输入捕获寄存器将捕获值65000并保持该值,即使在提姆之前未处理来自捕获模块的中断。呃已经翻滚了。在ISR中测试中断标志和调用中断处理函数的顺序可能会有所不同。输入捕获寄存器将保持值不变,直到下一个捕获事件。一些PIC设备在硬件中有一个FIFO缓冲器,具有2个或更多捕获值。这可能是有用的,当试图测量短脉冲。这个问题是在DSIC33论坛中发布的。所有的DSIC33设备都有16位定时器,主要是在32位模式下使用两个定时器的能力,但是许多DSIC3F设备不可能做32位捕获。这使得一些特殊情况对程序员来说是一个挑战,就像在软件中计算计时器中断一样。迈西尔
以上来自于百度翻译 以下为原文 Hi, Input Capture module, and the timer that is selected for it, work together! The Input Capture module record a 'snapshot' of the Timer value, when the capture trigger happen. There may be some different modes available, but for the basic case, Timer shall continue running regardless of capture events. Your design of using both Timer interrupts, and Capture values is sensible. There may still be some cases causing confusion, when Timer interrupt and Capture interrupt are triggered at same time, or very close. In the example case in message #1, Input Capture register will catch value 65000 and keep that, even if interrupt from capture module isn't processed before the Timer have rolled over. Sequence of testing interrupt flags, and calling interrupt handling functions in ISR, may make a difference. Input Capture register will keep the value unchanged, until the next capture event. Some PIC devices have a FIFO buffer, in hardware, with 2 or more capture values. This may be useful when trying to measure short pulses. (shorter than time used by your interrupt processing). This question is posted in dsPIC33F forum. All dsPIC33 devices have 16 bit timers, mostly with some ability to use two timers together in 32 bit mode, but many dsPIC33F devices do not have a possibility to do 32 bit capture. This leave some of the special cases as challenges to the programmer, same as when counting timer interrupts in software. Mysil |
|
|
|
谢谢你们的回复。好吧,现在我想一想,这就是我想要的。我的Micro是DSPIC33 EV256GM106I AM,假设TimeRoFullOffice计数器lt;2,因为它应该在TimeFror计数器之前不应该增加,或者一旦它溢出,不超过它,否则它是非常低的频率信号。我只写了伪代码,很抱歉。如果我错了请纠正我。
以上来自于百度翻译 以下为原文 Thank you both for the replies. Ok now i got to think little bit and this is want i have come up. My micro is dspic33ev256gm106 Timer3OverflowInterrupt() { timeroverflowcounter++; } Interrupt InputCaptureInterrupt() { ClearInputCaptureFlag; pastcapture_temp = actualcapture_temp; actualcapture_temp = IC1Buf; if(timeroverflowcounter <2) /* Valid Frequency Range*/ { pastcapture = pastcapture_temp; actualcapture = actualcapture_temp; } else /* Very Low Frequency Signal make default Values */ { pastcapture = 0; actualcapture = DefaultValue; } timeroverflowcounter=0 I am assuming timeroverflowcounter <2 since it should fall before the timerflowcounter should not increment or once it can overflow not beyond that, else it is very low frequency signal. I haven written only pseudo code sorry for that. Please correct me if i am wrong. |
|
|
|
在这种情况下,输入捕获是一个完全独立的自结合外围设备,它有自己的集成计时器,它可以在FP上计时,或者可以从一个定时器中共享时钟信号。或者,你可以对时钟进行预处理。例如,我必须获得一个可变脉冲宽度和固定在30100或300赫兹的频率的信号。在FP上运行IC模块意味着当信号频率为30赫兹时,我会溢出。为了使事情更简单,我不得不减慢IC计时器时钟。在我的所有项目中,我把一个定时器作为一个系统时钟定时器,根据MCU有多忙,每1, 5或10ms产生一个中断。所以我改变了TMR预分频器。我仍然能够得到1ms的中断率,然后我选择了。TMR时钟作为IC模块的时钟源。然后IC时钟变慢,不再溢出:)我能够以足够的分辨率获得所有三个频率,而不溢出:
以上来自于百度翻译 以下为原文 in this case, the input capture is a completely independent and self-cointaned peripheral. It has its own integrated timer, which can be clocked at Fp or can share the clock signal from one of the timers. This is so you can be using an external clock for those (Then you should use the syncronous output of TMR1), or you can prescale the clock. For example, i had to acquire a signal which had a variable pulse width and a frequency fixed at 30,100 or 300 Hz. Running the IC module at Fp meant that when the signal frequency was 30 Hz i would have overflows. To keep things simpler i had to slow down the IC TIMER Clock. In all my projects i dedicate one timer as a system tick timer, generating an interrupt every 1, 5 or 10ms depending to how busy is the MCU. So i changed the TMR prescaler. I was still able to get my 1ms Interrupt rate, then i selected the TMR clock as a clock source for the IC module. The IC clock was then slower, no more overflows :) I was able to acquire all three frequencies with enough resolution, without overflows :) |
|
|
|
只有小组成员才能发言,加入小组>>
5237 浏览 9 评论
2026 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3201 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
772浏览 1评论
660浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
590浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
672浏览 0评论
572浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 06:32 , Processed in 1.416080 second(s), Total 84, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号