完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
所以我试图在这个应用笔记中重新创建代码(我找不到实际项目的链接)
我已经阅读了所有的PWM数据表,我想所有的设置正确。我正在读取状态寄存器,因为它说,但当我通过我的代码,它永远不会离开中断。它去读取状态寄存器,然后在ISR程序中无限循环。 我已经附上我的代码,如果有人能帮助我弄明白我哪里错了… 捕获信号频率 622.6 K 以上来自于百度翻译 以下为原文 So I am trying to recreate the code in this application note (I can't find the link to the actual project) I have read through all the PWM datasheet and I think I have everything setup right.. I am reading the status register as it says but when I step through my code it just never leaves the interrupt.. it goes off to read the status register and then just loops infinitely in the ISR routine.. I have attached my code if someone could help me make sense of where I am going wrong.. |
|
相关推荐
8个回答
|
|
YouActudio PWM将始终产生中断,因为它是硬件。当单步通过代码时,总是会在中断处理程序中停止。乍一看,我会认为你的代码是正确的。
我(个人)不使用定义中断处理程序的方式。当切换到另一个PSoC交换机或删除生成的文件(允许这样做)时,您将松开在文件iSr.Cux.C中所做的修改。 当用Cysi-ISrl PROTO(UHANDER)声明处理程序并用CysIsR(YouHuffer-Lead)定义它时,可以用iSrxCuasReaStTeX(YouHuffer-Lead)启动它,并对代码进行完全控制。查看“系统参考指南”,在“创建者”的帮助下找到“系统参考”。 鲍勃 以上来自于百度翻译 以下为原文 Your active PWM will generate interrupts all the time because it is hardware. When single-stepping through your code you will always stop in the interrupt handler. At first sight I would think that your code is right. I (personally) do not use the way you defined the interrupt handler. When switching to another PSoC switch or when deleting the generated files (which is allowed to do) you are going to loose the modifications you made in the file ISR_Compare.c When declaring the Handler with CY_ISR_PROTO(YourHandler) and defining it with CY_ISR(YourHandler) in your main.c you can start it with ISR_Compare_StartEx(YourHandler) and have full control of the code. Have a look into the "System Reference Guide" to be found under Creator -> Help -> System Reference. Bob |
|
|
|
我将调查你的做法,但请你详细说明PWM是什么时候产生的中断,因为它是硬件?还有一步一步的事情…我想我会看到代码退出ISR和回到主,然后回到ISR…等。
以上来自于百度翻译 以下为原文 I am going to look into your way of doing it, but please could you elaborate on what you mean about the pwm always generating interrupts as it is hardware? also the single stepping thing.. I thought I would see the code exit the isr and back to main, then back to isr...etc |
|
|
|
当你启动PWM时,它会产生中断。当程序到达断点时,PWM不会停止,只有程序停止。当单步执行时,你不会离开当前的指令。进行如下:
程序已停止在BP1 BP1到BP1之后的下一个指令。 删除BP1 运行程序,它停止ATBP2 移除BP2 在旧位置再次设置BP1 运行程序。 鲍勃 以上来自于百度翻译 以下为原文 The moment you started the PWM it runs ang generates interrupt. When your program reaches a breakpoint the PWM does NOT stop, only the program halts. When single-stepping you will not leave the current instruction. proceed as follows: Program has halted at BP1 Place BP2 to the next instruction after the BP1. Remove the BP1 Run program, it stops at BP2 Remove BP2 Set BP1 at the old position again Run Program. Bob |
|
|
|
AHH IGET是什么意思,但现在我已经这样做了,并设置了第二个断点之外的标志检查循环,肯定程序应该达到这个。但它不会,它永远不会通过黄线。
以上来自于百度翻译 以下为原文 Ahh I get what you mean, but now I have done this and set a second breakpoint outside of the flag checking loop and surely the program should reach that.. but it doesn't, it never gets past the yellow line.. |
|
|
|
另一个转折点…
我已经下载并编程了以下教程示例项目 HTTP//BLG.HEDRIKLIPKA.DE/CARIVES/2013/10/PSoCuffiTynYyOracy2.HTML 完全相同的情况下,代码会被困在ISR中,并且不会对频率的任何变化做出反应。你认为是我的董事会吗?还是虫子? 以上来自于百度翻译 以下为原文 another twist.. I have downloaded and programmed the following tutorials example project http://blog.hendriklipka.de/archives/2013/10/psoc_frequency_counter_2.html and the exact same happens, the code gets stuck in the ISR and doesn't respond to any change in frequency,.. is it my board do you think? or a bug? |
|
|
|
第一个帖子的答案:你记得我写的删除(或至少禁用)BP在当前行(或我忘记了)?
第二个帖子的回答:这个行为与你的董事会和PSoC无关。它发生在每个PSoC上。原因是如何处理断点、如何发出运行命令以及何时清除PSW中的中断标志。 鲍勃 以上来自于百度翻译 以下为原文 First post's answer: Did you remember that I wrote to delete (or at least to disable) the BP at the current line (or did I forget that)? Second post's answer: This behaveour has Nothing to do with your board / PSoC. It happens with EVERY PSoC. The cause is how breakpoints are handled, how a run-command is issued and when the interrupt-flag in the PSW is cleared. Bob |
|
|
|
是的,它现在正在工作,但是只有当我回去并删除和替换断点每次。这是在PSoC创建者中进行调试的唯一方法,因为这是恼人的地狱!
谢谢你的帮助,非常有用。 以上来自于百度翻译 以下为原文 Ahh right, It is working now, but only if I go back and delete and replace breakpoints every time.. is that the only way to do debugging in PSoC creator because that is annoying as hell! Thanks for the help by the way, very useful. |
|
|
|
这是调试中断处理程序的唯一方法。此外,您可能暂时禁用中断:菜单头上有一个按钮来启用或禁用它们。
鲍勃 以上来自于百度翻译 以下为原文 This is the only way to debug an interrupt handler. Additionally you may disable interrupts temporarily: there is a button on the menu-header to enable or disable them. Bob |
|
|
|
只有小组成员才能发言,加入小组>>
740个成员聚集在这个小组
加入小组1980 浏览 1 评论
1737 浏览 1 评论
3514 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1670 浏览 6 评论
1448 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
227浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
128浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
325浏览 2评论
273浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
456浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-22 13:51 , Processed in 0.879644 second(s), Total 91, Slave 75 queries .
Powered by 电子发烧友网
© 2015 www.ws-dc.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191