完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
亲爱的康美蒂:
我用PSOC5专门处理单针中断。当我定义输入的下降沿作为中断事件,并且我使用ISR 1.50与派生选项时,我意识到中断ISRY1工作在下降和上升边缘。这是正常的还是应该只在我定义的下降沿上工作? 提前感谢。 以上来自于百度翻译 以下为原文 Dear comunity: I'm working with Psoc5 specifically interrupts in a single pin. When I define falling edge on input as interrupt event and I use ISR 1.50 with derived option, I realized interruption ISR_1 works on falling and rising edges. Is this normal or should work only on falling edge as I defined? Thanks in advance. |
|
相关推荐
6个回答
|
|
奥迪斯
我测试了一个项目中断的“下降沿”上的引脚和“派生”中断。 根据我的观察,中断得到(LED切换)下降沿。有时(如10次中的1次),我观察到LED在上升沿上切换。我强烈怀疑这可能是由于开关反跳造成的。 当使用下降沿作为中断源时,确保电阻上拉。 我已经上传了这个项目。 三铝1.Zip 577.2 K 以上来自于百度翻译 以下为原文 odesus, i tested a project with interrupt on "falling edge" on the pin and "derived" on interrupt. As per my observation, the interrupt was obtained (LED Toggle) upon falling edge. Sometimes (like 1 in 10 times), i observed that the LED toggled upon rising edge. i strongly suspect that this may be due to switch debounce. Make sure that the resistive pull up is enabled when using falling edge as interrupt source. i have uploaded the project.
|
|
|
|
亲爱的戴维:
谢谢你的回答。是的,我注意到了,中断作用于下降和上升的边缘。事实上,为了避免这种情况,我使用了 像这样的代码: ISRY11DISABLE(); 如果(CythRead Pin()= 0) { 中断主代码 } CypIn清除中断(); IsRy11Enable(); 中断/结束 不幸的是,在两个边沿上都有中断,所以当你停止按下按钮并考虑到上面的代码时会变得很高,如果没有按下按钮,中断的主代码将永远不会执行。我想知道这是否是API的一种错误。让我们看看柏树工程师告诉我们什么。谢谢 以上来自于百度翻译 以下为原文 Dear David: Thanks for your answer. Yes I have notice this, interruption serves on falling and rising edges. In fact to avoid this I have used a code like this: isr_1_Disable(); if(Cy_ReadPin()==0) { main code of interruption } Cy_Pin_ClearInterrupt(); isr_1_Enable(); }// end of interrupt Unfortunately interrupt WORKS on both edges, so when you stop of pressing the button and goes high considering the code above the main code of interruption will never executed if button is not pressed. That I was wondering if this is a kind of error on API's or something like that. Lets see what a cypress engineer tell us about it. Thanks |
|
|
|
嗨,Odesus,
PICU中断可以设置为上升沿、下降沿或两侧。 戴维附带的项目被配置为在下降沿中断。LED在下降边缘切换。在上升沿不产生中断。 如戴维所提到的,开关去抖动可能导致输入引脚高达GT;低GT;而不是直接高电平(电阻上拉是启用的,因此引脚被拉上默认)。 这将不可避免地导致PICU中断被触发,因为高GT;低过渡(下降沿)。 为了克服开关DeBung引入的模糊性,我通过在引脚输入处给出方波来测试该项目。输出引脚应该切换到输入信号的下降沿。 示波器快照附在下面: 黄色波形=输入信号到PICU 蓝色波形=输出引脚开关。 可以看出,输出引脚切换仅在PICU输入引脚的下降沿。 以上来自于百度翻译 以下为原文 Hi Odesus, The PICU Interrupt can be set to Rising edge, Falling edge or on Both edge. The project attached by David is configured for interrupt on Falling edge. The LED toggles on the Falling edge. Interrupt is not generated on the rising edge. As mentioned by David, the Switch Debounce might result in the input pin going high > low > high instead of going high directly (The resistive pull up is enabled, hence the pin is pulled up by default). This will inevitably result in the PICU interrupt getting triggered because of a high > low transition (falling edge). In order to overcome the ambiguity introduced by the switch debounce, I tested the project by giving a square wave at the Pin input. The output pin was supposed to toggle on falling edge of the input signal. The oscilloscope snap-shot is attached below: Yellow waveform = Input signal to PICU Blue waveform = Output pin toggle. It can be seen that the output pin toggles only on the falling edge of the PICU input pin. |
|
|
|
在类似的情况下,PICUU被改变为打断“上升沿”。
下面的快照显示输出引脚在输入信号的每一个上升沿上切换。 以上来自于百度翻译 以下为原文 On similar grounds, the PICU was changed to Interrupt on "Rising Edge". The snapshot below shows that output pin toggles on every rising edge of the input signal. |
|
|
|
作为第三种情况,当PICU被配置为在“两个边”上中断时,输出引脚在输入信号的每个边缘上切换。
示波器快照如下所示: 以上来自于百度翻译 以下为原文 As a third case, when the PICU was configured for interrupt on "Both Edges", the output pin toggled on every edge of the input signal. The oscilloscope snapshot is as shown below: |
|
|
|
非常感谢你的回答!!
是的,我已经了解了中断的原因,特别是使用非常嘈杂的按钮。我注意到有一些寄存器与中断标志有关,如Primask、XPSR等。 当我进入中断状态时,我注意到,尽管使用PixCultSuffTeTh()函数,但该标志似乎仍然被激活,因此该中断被服务了2次。 1、有没有办法读取这个中断的状态,并用ASM直接清除标志来消除这个屏蔽中断?2、这个中断寄存器直接访问的地址在哪里?我的意思是清除与这个引脚相关的所有可能的中断。 在技术数据表中,我观察到PixCultInUpTUTE()必须清除所有中断,但我不知道为什么在我的情况下不工作。 谢谢你的评论。 以上来自于百度翻译 以下为原文 Many thanks for your answers!! Yes, I have understood what is the matter with interruptions, specially using pushbuttons which can be very noisy. I've observed there are some registers which are related to interrupt flags like primask, xPSR,etc. When I enter to my interruption I have notice despite use PIN_ClearInterrupt() function, the flag seems to be still activated so this interruption is served 2 times. 1.-Is there any way to read the status of this interrupt and clear the flag directly using ASM to remove this mask interrupt? 2.-Where is the address of this interrupt register to access directly? I mean to clear all possible interrupts associated to this pin. On technical datasheets I have observed PIN_ClearInterupt() must clear all interrupts, but I don't know why in my case is not working. Thanks in advance for all your comments. |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2065 浏览 1 评论
1824 浏览 1 评论
3633 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1760 浏览 6 评论
1508 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
506浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
357浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
409浏览 2评论
354浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
853浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-20 21:22 , Processed in 1.003286 second(s), Total 84, Slave 69 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号