Cypress技术论坛
直播中

孙琪

7年用户 168经验值
私信 关注
[问答]

使用PSOC5 LP上的定时器捕获在周期计上产生杂散结果

你好,
这是我的第一个帖子。我在PoSO5LP上使用了CY8CKIT-059工具包上的周期表。
输入方波在timeRy1的捕获输入上。
该周期被计算为TimeRy1的捕获寄存器的2个连续值之间的差值。
结果用于设置VDAC(全SACLE=4.080V)的值。
定时器时钟设置为1MHz,因此对于4kHz至16 kHz的频率(周期256μs下降到62秒),VDAC的8位值不应该溢出。
结果是好的,除了一些杂散值,如示波器上所示。
上迹是输入信号(0…5V),低迹是DE VDAC1的输出。
有人看到我做错了什么吗?
谢谢你的帮助
伯纳德
2018031909922.JPG
2兆字节
201803190094253.JPG
1.8兆字节
金龟子
1.5兆字节

以上来自于百度翻译


     以下为原文
  Hi,
It’s my first post . I’m having trouble with a periodmeter on PSOC5 LP, on a cy8ckit-059 kit.

The input square wave is on the capture input of Timer_1.
The period is calculated as the difference between 2 successive values of the capture register of Timer_1.
The result is used to set the value of a VDAC (full sacle = 4.080V)
The timer clock is set to 1MHz, so for frequencies of 4kHz to 16 kHZ  (period 256µs downto 62µs) there should be no overflow of the 8 bit value of the VDAC.

The result is ok, except for some spurious values, as shown on the oscillograms.
Upper trace is the input signal ( 0..5V), lower trace is the output of de VDAC1.


Can anyone see if I’ve done something wrong ?
Thank you for your help
Bernard


回帖(5)

胡书琴

2018-10-23 15:42:03
你好,伯纳德,
在你的设计中,计时器时钟在1MHz,计时器计数将溢出,并从初始计数重新启动。对于4kHz的输入时钟,这可能会发生多达250次。当我们在溢出之前和之后捕获新的和新的值时,旧的新的测量可以是一个伪值。我怀疑这是造成这个问题的原因。
最好的问候,
VSRS

以上来自于百度翻译


     以下为原文
  Hello Bernard,
 
In your design as the timer clock is at 1MHz, the timer count is going to overflow and restart from initial count. For 4KHz input clock this can happen upto 250 times. When we capture the old and new value before and after overflow, the measurement of old-new can be a spurious value. I am suspecting this to cause the issue.
 
Best Regards,
VSRS
举报

孙琪

2018-10-23 15:50:01
引用: EnjoyL 发表于 2018-10-23 15:44
你好,伯纳德,
在你的设计中,计时器时钟在1MHz,计时器计数将溢出,并从初始计数重新启动。对于4kHz的输入时钟,这可能会发生多达250次。当我们在溢出之前和之后捕获新的和新的值时,旧的新的测量可以是一个伪值。我怀疑这是造成这个问题的原因。
最好的问候,

你好,VRSR,谢谢你的回答。
我不太明白它的意思:“定时器时钟会溢出,从初始计数重新启动”是什么意思?
你能再解释一下吗?
谢谢,问候
伯纳德

以上来自于百度翻译


     以下为原文
  Hello VRSR, thank you for your answer.
 
I'm not sure to understand it very well : what do you mean by 'the timer clock is going to overflow and restart from initial count.' ?
Can you explain a bit more?
Thank you, regards
 
Bernard
举报

胡书琴

2018-10-23 16:04:33
引用: boju81 发表于 2018-10-23 15:52
你好,VRSR,谢谢你的回答。
我不太明白它的意思:“定时器时钟会溢出,从初始计数重新启动”是什么意思?
你能再解释一下吗?

你好,
我指的是计时器。我已经纠正了先前的反应。
最好的问候,VashanthR

以上来自于百度翻译


     以下为原文
  Hi,
 
I meant timer count. I have corrected previous response.
 
Best Regards,
Vasanth R S
举报

孙琪

2018-10-23 16:19:41
引用: EnjoyL 发表于 2018-10-23 16:07
你好,
我指的是计时器。我已经纠正了先前的反应。
最好的问候,VashanthR

你好,
我不确定你的答案:在1MHz时,定时器时钟周期为1秒。在4kHz时,输入信号的周期为250秒。计时器计数将减少250。当它溢出时,计算值应该是正确的。
为了查看错误是否来自溢出,我将计时器的位数更改为32。溢出将出现每4295秒(超过小时),但我仍然得到相同的虚假结果。
有人知道发生了什么事吗?
谢谢您!
伯纳德

以上来自于百度翻译


     以下为原文
  Hi,
I'm not sure about your answer : at 1Mhz, the period of the timer clock is 1µs. At 4kHz, the period of the input signal is 250µs. The timer count will decrease by 250. When it overflows,  the calculated value should be correct.
To see if the error comes from the overflow, I changed th number of bits of the timer to 32. The overflow will occur every 4295 s (more than on hour), but I still get the same spurious results .
 
Has anyone an idea of what happens?
Thank you!
Bernard
举报

更多回帖

发帖
×
20
完善资料,
赚取积分