This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TMS570LC4357:N2HET PWM

Guru**** 1997655 points
Other Parts Discussed in Thread: HALCOGEN
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1104796/tms570lc4357-n2het-pwm

器件型号:TMS570LC4357
主题中讨论的其他器件:HALCOGEN

王工您好:μ A

    我想问一下:μ A

    uint32 pwmPeriod =(hetRAM->指令[(cap << 1U)+ 26U].Data)>> 7U;

   和 μ A

    uint32  pwmPeriod =(hetRAM->指令[(PWM << 1U)+ 42U].Data + 128U)>>7U;

   1)有什么区别?μ A

   2)为什么第二行代码中要+128?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Mingxi、

    在 HALCoGen 生成的 HET 代码中、

    [引用 userid="507609" URL"~μ C/support/microcontrollers/arm-based microcontrollers-group/arm-based microcontrollers/f/arm-based microcontrollers-forum/1104796/tms570lc4357-n2het-pwm"] uint32 pwmPeriod =(hetRAM->指令[(cap)[+26U]数据引用)<[+26U]

    第26条指令为: PCNT、用于捕捉输入信号0的周期

    [引用 userid="507609" URL"~μ C/support/microcontrollers/arm-based microcontrollers-group/arm-based microcontrollers/f/arm-based microcontrollers-forum/1104796/tms570lc4357-n2het-pwm"] uint32  pwmPeriod =(hetRAM->Instruction [(PWM)+128u]+数据[[[+42U]+报价[[[+42U]

    第42条指令为: MOV64、用于更新指令#2  DJZ (远程地址)使用的 PWM0周期。  

    现在考虑 MOV64指令的数据字段:

    该数据字段由7位高分辨率数据字段和25位环路分辨率数据字段组成。 此 HALCoGen 示例不使用高分辨率功能、因此不使用"HR 数据"字段。 这就是更新后的数据值被7移位、然后添加128的偏移(2^7 = 128)的原因。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    王工:μ A

       1)如果我想捕获PWM脉冲的周期period ,应该使用PCNT 还是MOV64 指令?μ A

       2)为什么代码2需要先加128再shifted x 7?而不是直接

       uint32  pwmPeriod =(hetRAM->指令[(PWM << 1U)+ 42U].Data)>> 7U;

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [ )如果我想捕获PWM脉冲的周期period ,应该使用PCNT 还是MOV64 指令?userid="507609" URL"~μ C/support/microcontrollers/arm-based microcontrollers-group/arm-based microcontrollers/f/arm-based microcontrollers-forume/1104796/tms570lc4357-n2het-PWM/4093721#4093721"] 1 μ m[/quot]

    PCNT

    [?而不是直接 userid="507609" URL"~μ C/support/microcontrollers/arm-based microcontrollers-group/arm-based microcontrollers/f/arm based microcontrollers-forume/1104796/tms570lc4357-n2het-PWM/4093721#4093721"] 2 μ m x 7 μ)为什么代码2需要先加128再shifted

    DJZ 指令用于生成 PWM 周期、每次 执行 DJZ 指令时、DJZ 中的25位数据都会递减、直到 计数器计数到0。 周期是数据+1。

    DJZ 数据字段由指令42 (MOV64)更新。