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 Execution time

Part Number: TMS570LC4357

Hi, 

I want to measure the execution time of my HET program.

I tried the following:

L01 ADD { src1=ZERO,src2=ZERO,dest=A,rdest=NONE,data=0};;
L02 ECMP { next=L03,hr_lr=HIGH,en_pin_action=ON,pin=8,action=SET,reg=A,data=0,hr_data=0};

; My HET program

L04 ADD { src1=ZERO,src2=ZERO,dest=A,rdest=NONE,data=0};
L05 ECMP { next=L01,hr_lr=HIGH,en_pin_action=ON,pin=9,action=CLEAR,reg=A,data=0,hr_data=0};

The ECMP should always be true as the register A is ZERO.

I use the HR share feature for pins 8 and 9.

I expect the pin to be set at HET program start and to  be reset on HET program end. However, the pin stays high.

What am I doing wrong? Or Is there a another way to determine the execution time of the N2HET program?

Thanks and best regards, 

Katharina Gilles

  • Hi Katharina,

    Some things to note:
    - an action on a pin only takes effect at the end of a loop, so you may not be able to indicate exactly when the HET program begins / completes its execution
    - the "HR share" feature is an "input" function wherein the high-resolution capabilities of two adjacent timer channels are used for two separate measurements on a single input signal

    The execution time for all HET instructions is deterministic and is specified in the technical reference manual (see "Instruction Set" section). You can add up the execution cycles for each instruction in your HET program sequence and that will give you the total execution time for your HET program.

    Regards,
    Sunil
  • Hi Sunil, 

    thanks for your answer.

    I made a mistake in my post, I use the XOR share (for output) and not the HR share (for input) on pins 8 and 9.

    So there is no way to set an output pin with high resolution? Because the TRM says concerning the XOR share

    "In this way, it is possible to generate pulses smaller than the loop resolution clock since both edges can be generated by two independent HR structures."

    So how do I do it?

    Thanks, Katharina

  • I already added up the execution time of the HET instructions as specified in the TRM, and I monitor the program overflow flag, that's all fine. Nevertheless, I'd like to have a measurement additionally.
    Regards, Katharina
  • Katharina,

    You can use two HET instructions to generate interrupts and then drive a pin high/low in these two interrupt service routines. Assuming the same interrupt latency for the two separate interrupts, you can identify the time taken for the HET program to execute.
  • Sunil,

    thanks, that works.

    Just for information, is it possible to toggle an output pin with high resolution?

    Regards, Katharina