完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
有人能告诉我如何使用PSoC 1来测量输入正弦波的频率。我遵循Dana给出的程序。
在最基本的层面上,你需要一个已知宽度的门, 和一个计数器,当门是活动的(高)时,从已知值(255 8位,65535位16位)开始计数,当门变低时停止计数。你读计数器的值,从开始值减去它,然后按秒除以门周期。 16位示例,1秒门周期,F=(65535 -计数值)/ 1。 安装门 1)定时器,设置为1或1秒(分辨率分别为10赫兹或1赫兹)。设置周期为2X所需的门周期,并比较值1/2周期,从而比较高输出时间=门周期,低时间=门周期。 2)路由计时器比较计数器启用。 设置计数器 1)路径针,鳍,计数器时钟 2)路由计时器与计数器使能比较 代码 1)负载计数器,其最大允许值,255位为8位,65535位为16位。 2)启动计数器 3)启用定时器ISR,在终端计数上,意味着门低,计数器不能计数 3)启动定时器 当ISR发生时,设置一个标志并返回 1)如果标志真读计数器(门是低的,所以它不启用计数器)和计算频率。用最大值重新装入计数器。 还可以进行其他优化,例如当ISR发生时停止和复位定时器,使得门极低周期被最小化,并且测量频率增加。 如果你正在测量的频率非常低,比如小于1赫兹,则使用倒数计数器技术。 但我无法理解如何在终端计数上写ISR。 任何帮助都值得赞赏 谢谢 以上来自于百度翻译 以下为原文 Can someone tell how do I measure frequency of a incoming sine wave using PSoC 1. I'm following the given procedure given by Dana. At the most basic level you need a gate of known width in time, and a counter that starts counting when gate is active (high), from a known value (255 8 bit, 65535 16 bit), and stops counting when gate goes low. You read the value of the counter, subtract it from start value, and divide by gate period in seconds. 16 bit example, .1 sec gate period, f = (65535 – count value) / .1 To setup Gate 1) Timer, setup for .1 or 1 sec (resolution would be 10 Hz or 1 Hz respectively). You set up period to be 2X desired gate period, and compare value 1/2 period, so that high time of compare output = gate period, low time = gate period. 2) Route timer compare out to counter enable. To setup counter 1) Route pin, Fin, to counter clock 2) Route timer compare out to counter enable Code 1) Load counter with its max allowed value, 255 for 8 bit, 65535 for 16 bit 2) Start counter 3) Enable timer ISR, on terminal count, that means gate is low, counter not enabled to count 3) Start timer When ISR occurs set a flag and return 1) If flag true read counter (gate is low so it is not enabling counter) and compute frequency. Reload counter with its max value. There are other optimizations that can be done, for example stop and reset timer when ISR occurs so that gate low period is minimized, and measurement frequency is increased. If the frequencies you are measuring are very low, like less than 1 Hz, use reciprocal counter technique. But I'm unable to comprehend that how do I write the ISR on terminal count. Any help would be appreciated Thanks |
|
相关推荐
6个回答
|
|
|
当你在页面顶部的“关键字搜索”字段中键入“频率测量PSoC1”时,YoFink至少是这个附注。
鲍勃 以上来自于百度翻译 以下为原文 When you type "frequency measure PSoC1" into the "Keyword Search" field at top of this page, yofind at least this appnote. Bob |
|
|
|
|
|
这里有两种方法可以用于FRQ测量,
附属的。 问候,Dana。 脉冲宽度和周期测量方法 2.8兆字节 以上来自于百度翻译 以下为原文 Here is a couple of approaches you can use for freq measurement , attached. Regards, Dana. |
|
|
|
|
|
另一种方法,附加。
问候,Dana。 脉冲宽度和周期测量方法 1.6兆字节 以上来自于百度翻译 以下为原文 The other approach, attached. Regards, Dana. |
|
|
|
|
|
对不起,没有注意到您正在使用PSoC 1的事实。
这里,附加,是PSoC 1解决方案。 问候,Dana。 基本文件 1.1兆字节 以上来自于百度翻译 以下为原文 Sorry, not paying attention to the fact you are working with PSOC 1. Here, attached, is a PSOC 1 solution. Regards, Dana.
|
|
|
|
|
|
|
|
|
|
|
|
你好, 我用CY8C26623-24LTSI芯片使用CY8CKIT-01套件。但是,当我编程的工具包,我不能看到任何显示。你能帮我一下吗? 以上来自于百度翻译 以下为原文 Hi, I am using this code for CY8C28623-24LTXI chip and using CY8CKIT-001 kit. But when I program the kit, I am not able to see any display. Can you please help me with it. |
|
|
|
|
只有小组成员才能发言,加入小组>>
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 13:59 , Processed in 0.869718 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
5653