Cypress技术william hill官网
直播中

魏贝贝

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

PWMblock只能返回UTIT8值

PWMblock上的数据表表示,pWMLRead COMPARATE()可以返回Uti8或UIT16。我只能让它返回UTIT8值,但是我需要它来回复UTIT16,我该怎么做?
PWM被设置为16位UDB。

以上来自于百度翻译


     以下为原文
  The data sheet on the PWM block says that the PWM_ReadCompare() can return either a uint8 or uint16. I can only get it to return a uint8 value, but I need it to returna uint16, how can I do this?
    The PWM is set as a 16-bit UDB

回帖(6)

杨军

2019-4-28 14:33:14
DS中存在一些“框图和配置”,这意味着生成。
API的返回正确值。API调用的SAMEIN描述。
快速测试编译器,返回到8位变量,就应该抱怨了。
问候,Dana。

以上来自于百度翻译


     以下为原文
  There is some verbiage in DS, under "Block Diagram and Configuration" that implies generated
    API's return correct vaule. Same in descriptions of API call.
     
    Quick test of compiler, return to an 8 bit variable, it should complain.
     
    Regards, Dana.
举报

魏贝贝

2019-4-28 15:02:12
是否有任何理由改变代码中PWM块的比较值和周期值将导致周期在达到期望值之前尖峰?

以上来自于百度翻译


     以下为原文
  Is there any reason that changing the compare value and period value of a PWM block in code will cause the period to spike before reaching the desired value?
举报

杨军

2019-4-28 15:15:13
相信我,我们仍然不知道为什么E= IX R,为什么这是真实的。也没有其他解决办法。
我们不知道宇宙膨胀的速度为什么远离凝聚体的质量。我们认为
暗物质是一个用来描述我们不了解的物质的术语。
编译器。如果它是好的,发出警告,而不是错误。有时我也会有不同。
更改到Reg的编写、周期和比较,API描述没有显示任何副作用……?不知道什么
事实上正在发生。
问候,Dana。

以上来自于百度翻译


     以下为原文
  Trust me, we still do not know why E = I x R, why that is physically true. And can be no other solution.
     
    We do not know why the universe's rate of expansion is away from the mass that coeleseces it. We think it
    is dark matter, a convienent term to describe a prtoblem we do not understand.
     
    The compiler. if it is good, issues a warning, not an error. Sometimes the difference escapes me.
     
    Change to reg writes, period and compare, the API descriptions do not show any side effects......? Not sure whats
    actually happening.
     
    Regards, Dana.
举报

姜钰

2019-4-28 15:22:08
当当前PWM计数器高于新的比较值(取决于配置)时,改变比较值可以立即影响比较输出的状态(这也在数据表中说明)。在这种情况下,比较可能不会触发,PWM计数器在整个周期内运行,再次启动,然后触发比较。改变周期值不影响输出,因为它只在PWM计数器到达终端计数时才使用。

以上来自于百度翻译


     以下为原文
  Changing the compare value can immediately affect the state of the compare output (this is also stated in the data sheet), when the current PWM counter is above the new compare value (depending on the configuration). It might also be, in that case, that the comparision doesn't trigger, and the PWM counter runs for the full period, starts again and only then triggers the compare. CHanging the period value should not affect the output, as it is used only when the PWM counter reaches the terminal count.
举报

更多回帖

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