1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我试图读取一个输出频率(脉冲)的传感器。我使用本文中描述的方法:
HTTP://www. CyPress .COM/FIL/144696/下载 它可以读取传感器的输出频率,但它似乎比我从我的范围观察到的大约少10%。有没有办法提高这种方法的准确性? 以上来自于百度翻译 以下为原文 I'm trying to read a sensor that outputs frequency (pulses). I use the method described in this document: http://www.cypress.com/file/144696/download It can read the output frequency from the sensor, but it seems to be about 10% less than what I'm observing from my scope. Is there any way to improve the accuracy from this method? |
|
相关推荐
2个回答
|
|
如果你编写一个微控制器来计算一秒钟内的脉冲数,这是错误的。它不是正确地计数脉冲数,也不是精确估计秒的通过。我敢打赌这是后来的事。
为了精确地测量时间,你的微控制器的时钟源要么需要精确(晶体源),要么需要补偿(实际上有多少个时钟周期在微控制器的内部时钟的第二个VS额定近似值)。 以上来自于百度翻译 以下为原文 If you program a microcontroller to count the number of pulses in a second, and it's wrong. It's either counting the number of pulses incorrectly, or it isn't accurately estimating the passing of a second. I'm willing to bet it's the later. To measure time accurately, your microcontroller's clock source either needs to be accurate (crystal source) or needs to be compensated (how many clock cycles are actually in a second VS rated approximation of microcontroler's internal clock). |
|
|
|
如果你的脉宽与频率成正比,你可以使用类似于这个的东西:
定时器从上升沿开始,并在下降沿捕获。捕获中断具有结果。你有1微秒的准确度。 如果需要从上升脉冲捕获到上升脉冲,则在其中放置一个触发器,使Q不进入D,上升沿将发送Q高。把它发送到计数器使能。下一个上升沿将发送Q低,禁用计数器。你可以用Q来捕获计数,而不是捕获(上升沿上的捕获),在捕获时中断,然后读取捕获寄存器。我通过实验发现,捕获在一个计数器上工作,使能低,这就是为什么Q不能给你计数器捕获。 请确保并将其放入,然后构建,然后在成功构建和运行之后将任何USB放到原理图上,否则您可能会遇到路由问题,并会出现零星的捕获中断。(基于经验与6个或更多相同的计数器在示意性页面与USB放置在页面上。) 以上来自于百度翻译 以下为原文 If your pulse width is proportional to the frequency, you can use something similar to this: The timer starts on rising edge and captures on falling edge. the Capture interrupt has the results. You have a 1 microsecond accuracy. If you need to capture from rising pulse to rising pulse, then put a flip flop in there that sends Q NOT into D, and the rising edge will send Q high. Send that into counter enable. The next rising edge will send Q low, disabling the counter. You can capture the count using Q Not into Capture (capture on rising edge), interrupt on capture, then read the capture register. I found out through experimentation that capture works on a counter with enable low, which is why Q NOT can give you the counter capture. Be sure and put this in, then build, then put any USB onto the schematics after a successful build and run, else you can end up with routing issues, with sporadic capture interrupts. (Based on experience with with 6 or more identical counters in the schematic page with USB placed on the page first.) |
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2113 浏览 1 评论
1859 浏览 1 评论
3673 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1794 浏览 6 评论
1540 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
581浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
434浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
445浏览 2评论
392浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
1008浏览 2评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-30 17:02 , Processed in 0.907709 second(s), Total 80, Slave 64 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号