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.

TMS570LS1224: Code for HET to capture the frequency

Part Number: TMS570LS1224

Hi,

Customer asks for a reference code, to use HET to capture an external signal's frequency. 

In details: 

1) The external signal comes from C2000 PWMxA;

2) The signal's frequency is changed each 10us;

3) During each 10us, TMS570 needs to read the frequency from HET.

Will you help to provide?

Thanks a lot.

Br, Jordan

  • Hello Jordan,

    NHET has the capability to measure the period, duty cycle, and frequency of the incoming signals.

    For input pulse period measurement, I recommend  to use PCNT instruction

    ; Input Pulse/Period measurements with PCNT

    ;  Set HRSHARE register bit 0 to measure RISE2FALL and RISE2RISE from input signal on pin 0

    ; If HRSHARE bits are not set, then the defined pulse/period type will be measured on the

    ; 4 individual pins as defined below

    L00   PCNT { type=RISE2FALL, pin=0};

    L01   PCNT { type=RISE2RISE, pin=1};

    L02   BR { next=L00,cond_addr=L00,event=NOCOND};

    The L00 instruction measures the time from rising edge to falling edge. L00 measures the period between rising edge and next rising edge. The frequency can be calculated from the period.

     

  • QJ,
    Thanks for your comment.
    Do you have a reference code?

    Br, Jordan
  • Hi Jordan,

    Please download HET IDE to do the simulation, then generate C code and C header files. The C code can used in CCS project. The C code should be copied to NHET RAM for execution.

    http://www.ti.com/tool/HET_IDE

    HET IDE also contains some examples.