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.

[参考译文] TMS570LS0432:需要对 NHET 进行编程以输出脉冲脚本

Guru**** 2487425 points


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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/735966/tms570ls0432-need-to-program-nhet-to-output-a-pulse-script

器件型号:TMS570LS0432

我正在尝试对 N2HET 进行编程以输出脉冲脚本。 该脚本将是80位开启或关闭的序列。 请注意、奇数位始终为零、并且它们不会显示在下面的脚本中。 将有四个脚本。 默认情况是空闲状态、不需要发送脚本。 应用将需要发送其所需操作的 NHET。

脚本1:

   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1.

脚本2:

   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1

脚本3:

   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1.

脚本2:

   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1

如果我要用 C 语言编写此代码、我可能会编写如下内容:

typedef enum send_pulse_script

   SEND_PULSE_script_none=0、
   SEND_PULSE_script_1、
   SEND_PULSE_script_2、
   SEND_PULSE_script_3、
   SEND_PULSE_script_4
}send_pulse_script_t;

静态 send_pulse_script_t pulse_script = send_pulse_script_none;
静态 int nCounter = 0;

空 NHET_Loop (空)

   if (pulate_script =send_pulse_script_none)
   {
      返回;
   }

   //奇数计数始终为零
   if (nCounter %2 ==1)      gioSetBit (hetPORT1、18、0);

   //前导码
   否则、如果(nCounter <= 48) gioSetBit (hetPORT1、18、0);
   否则、如果(nCounter = 50) gioSetBit (hetPORT1、18、1);
   否则、如果(nCounter = 52) gioSetBit (hetPORT1、18、1);
   否则、如果(nCounter = 54) gioSetBit (hetPORT1、18、0);

   //地址
   否则、如果(nCounter = 56 || nCounter = 58 || nCounter = 60)
   {
      if (pulate_script =send_pulse_script_1 || pulse_script =send_pulse_script_2   )
      {
         gioSetBit (hetPORT1、18、0);
      }
      else   // pulse_script =send_pulse_script_3 || pulse_script =send_pulse_script_4
      {
         gioSetBit (hetPORT1、18、1);
      }
   }

   //命令
   否则、如果(nCounter = 62) gioSetBit (hetPORT1、18、0);
   否则、如果(nCounter = 64) gioSetBit (hetPORT1、18、0);
   如果(nCounter = 66)则为其他值
   {
      if (pulate_script =send_pulse_script_1 || pulse_script =send_pulse_script_3   )
      {
         gioSetBit (hetPORT1、18、1);
      }
      else   // pulse_script =send_pulse_script_2 || pulse_script =send_pulse_script_4
      {
         gioSetBit (hetPORT1、18、0);
      }
   }
   否则、如果(nCounter = 68) gioSetBit (hetPORT1、18、1);

   //结束
   否则、如果(nCounter = 70) gioSetBit (hetPORT1、18、1);
   否则、如果(nCounter = 72) gioSetBit (hetPORT1、18、1);
   否则、如果(nCounter = 74) gioSetBit (hetPORT1、18、1);
   否则、如果(nCounter = 76) gioSetBit (hetPORT1、18、1);
   否则、如果(nCounter = 78) gioSetBit (hetPORT1、18、1);

   IF (nCounter >= 80)
   {
      //脚本完成,重新初始化下一条消息
      gioSetBit (hetPORT1、18、1);
      PULSE_script = SEND_PULSE_STEFLE_NONE;
      nCounter = 0;
   }
   其他
   {
      nCounter++;
   }


void SetPulseScript (send_pulse_script_t 脚本)

   PULSE_script =脚本;


SEND_PULSE_script_t GetPulseScript (void)

   返回 PULSE_script;

我将如何在 HET 指令中写入此内容?

感谢您的帮助!

       Ken

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

    N2HET 支持29条指令。 您可以使用这些指令来生成您的帖子中列出的序列:CNT、ECMP 和、或、MOV32、 ADD、BR 等

    我建议使用 NHET IDE 进行仿真
    http://www.ti.com/tool/HET_IDE