完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
嗨,我正试图读取计数器的捕获值,当它被计时器打断时,我无法追踪出哪里出错了。所以有人能帮我弄到这个吗?我附上了文件供您参考。基本上,我试图得到他的DUY循环的PWM在转速方面。
以上来自于百度翻译 以下为原文 Hi, I am trying to read the capture value of the counter when it gets interrupted by the timer, I am not able to trace where I am going wrong. So can anyone help me for getting this. I have attached the file for your reference. Basically I am trying to get he dutycycle of the PWM in terms of RPM. |
|
相关推荐
10个回答
|
|
|
|
|
|
|
|
|
对不起,鲍勃,这里是附件中的文件
图片1.JPG 146.8 K 以上来自于百度翻译 以下为原文 Sorry @bob, here is the file check it in the attachments
|
|
|
|
|
|
您的复位引脚计数器没有路由到任何东西?
以上来自于百度翻译 以下为原文 Your reset pin on counter is not routed to anything ? |
|
|
|
|
|
“DaaWal奈德,是的,我已经把计数器的复位引脚路由到0,但是在C的代码中仍然存在一些问题,你能帮助我在中断的时候如何读取计数器的值,即如何从计数器读取捕获值。
以上来自于百度翻译 以下为原文 @danaknight, yes i have routed the reset pin of the counter to 0 but still there are some issues with the coding in the main.c, can you help me for how to read the value of counter when interrupt occours i.e. how to read capture value from counter. |
|
|
|
|
|
基本代码是数据表中显示的API。
UIT8/16/32反读(空) 说明:此函数返回捕获寄存器的内容或FIFO(UDB)的输出。 参数:无 返回值:UIT8/16/32:当前捕获值。对于24位计数器,返回类型是UIT32。 副作用:无 问候,Dana。 以上来自于百度翻译 以下为原文 The basic codeing is an api shown in datasheet - uint8/16/32 Counter_ReadCapture(void) Description: This function returns the contents of the capture register or the output of the FIFO (UDB only). Parameters: None Return Value: uint8/16/32: Current capture value. For 24-bit Counters, the return type is uint32. Side Effects: None Regards, Dana. |
|
|
|
|
|
如果没有所有用户模块的设置,它或多或少是一个猜想:
ISRY1设置为上升沿?初始化时,像iSr11SARTEX(YOutBuffTrutOutin)执行什么?? 在您的中断程序中 UTI8状态=反E1O1RealStaseRealStices(); 然后检查FIFONEMP位集吗? *读取所有FIFO值? 给我们提供所有的信息,所以我们不必猜测将整个项目上传到这里不仅是一个示意图的图片。当过程包含一些公开的材料,尝试建立一个节选,你可以公开展示给我们带来错误。 使用创建者函数“创建工作区束”并在这里上传备份档案。 鲍勃 以上来自于百度翻译 以下为原文 Well, without the settings of all your usermodules it is more or less a guess: isr_1 set to rising edge? in initialization something like isr_1_StartEx(YoutInterruptRoutine) executed?? In YourInterruptRoutine uint8 Status = Counter_1_ReadStatusRegister(); followed by a check of FIFONEMP - bit set ? *ALL* fifo-values read off? To provide us with all the information so we do not have to guess would be to upload the complete project here not only a picture of the schematic.When the procect contains some disclosured material, try to build an excerpt that you may show us openly which produces the error. Use the Creator-function "Create Workspace Bundle" and upload the relulting archive here. Bob |
|
|
|
|
|
你能告诉我们问题是什么吗?只是说“不要看我哪里错了”是没有用的。你没有结果,错误的结果,程序被卡住了吗?
此外,通过这种设置,您将无法获得PWM的占空比,只是它的频率。(占空比是每个PWM周期期间输出高的分数)。但是“RPM”暗示你想要得到频率-它是什么? 以上来自于百度翻译 以下为原文 Can you also tell us what the problem is? Just stating 'don't see where I'm wrong' doesn't help. Do you get no result, wrong results, is the program stuck? Also, with this setup you won't get the duty cycle of the PWM, just its frequency. (The duty cycle is the fraction of each PWM period during which the output is high). But 'RPM' suggests you want to get the frequency - what is it? |
|
|
|
|
|
实际上,我正在尝试将传感器脉冲接口转换为8CY8C050 PSoC 5套件到RPM。为此,我使用了计时器和计数器组合。我的目标是从脉冲中获得电机转速。
以上来自于百度翻译 以下为原文 @hli, actually I am trying convert the sensor pulses interfaced to the 8CY8C050 PSoC 5 kit in to RPM. For this i have used a timer and a counter combination. My aim is to get the speed of the motor in RPM from the pulses. |
|
|
|
|
|
你建立的方式应该有效。只要确定它是在上升沿配置,你有正确的门从计时器,你重置计数器为下一个阅读。
愿意帮助更多,但这是一种不可预知的,不知道什么是真正的问题,它是进入ISR,是不是得到错误的价值观?一点价值都没有?我们只能在没有更多细节的情况下前进 以上来自于百度翻译 以下为原文 the way you have it set up should work. Just make sure it is configured at rising edge, that you have the right gate from the timer and that you reset the counter for the next reading. Would like to help more but it is kind of imposible without knowing what is actually the problem, is it entering to the ISR, is it getting wrong values?, no value at all? We could only gyess without more details |
|
|
|
|
|
基本途径
1)设置PWM作为门计数器计数输入(基本使能),PWM正脉冲将服务 作为计数器时间分辨率。因此,1秒脉冲高将使计数器A 1 Hz分辨率,100毫秒= 10赫兹分辨率。计数器宽度gt;=max Frq待测量。PWM时钟与PWM周期 设置为产生PWM输出高脉冲宽度=门周期。 2)增加ISR到PWM输出,触发下降沿PWM。当ISR火灾设置一个标志。在主()测试标志中, 读计数器(因PWM输出为0停止计数器而停止),则复位计数器。脉宽调制, 当它再次变高时,会自动重新启动计数器。 问候,Dana。 以上来自于百度翻译 以下为原文 A basic approach - 1) Set up PWM as a gate to counter count input (basically enable), PWM positive pulse will serve as counter time resolution. So 1 sec pulse high would give counter a 1 Hz resolution, 100 mS = 10 Hz resolution. Width of counter >= max freq to be measured. Clock to PWM and PWM period set to yield PWM output high pulse width = gate period. 2) Add ISR to PWM out, trigger off falling edge PWM. When ISR fires set a flag. In main() test flag, read counter (it is stopped because PWM output is 0 stopping counter), then reset counter. PWM, when it goes high again, will automatically restart counter. Regards, Dana. |
|
|
|
|
只有小组成员才能发言,加入小组>>
786个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7088 浏览 0 评论
2477 浏览 1 评论
2166 浏览 1 评论
4031 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2074 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7567浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6114浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
742浏览 2评论
710浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
7962浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 12:42 , Processed in 1.187816 second(s), Total 90, Slave 73 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2882