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.

TMS570LS1114: Up Counter, when Digital Input is high

Part Number: TMS570LS1114


Dear support team,

I want to execute the following function: 

I want to determine the 'on-time' of an incoming digital signal. 

Thus, I figured, I use either the eCAP or N2HET module. 

In the technical reference sheet, considering the N2HET, I read, that there are several instruction that can be used to control the timer module.

Basically I want to do the following: 

Siganl LOW -> Stop Counter / No counting

Signal HIGH -> Start Counter / Continue counting

First Question:

How would you realize this function? My idea would be:

Considering N2HET:

Use the ECNT (Event Count) instruction.

If event == RISE => Count UP 

if event == FALL => stop counting 

Would this result in my wanted Counter behaviour? 

Second question:

Is it also possible to execute this behaviour using the eCAP module? I can't seem to find similar 'instructions'. 

Thank you and kind regards


Sebastian 

  • Hi Sebastian ,

    You can use either N2HET or eCAP to count the pulse or rising edge or falling edge or both.

    In ECNT, select the rising edge as the event.

  • Hello QJ,

    thank you for your fast reply. 

    I already know that I can count a pulse or rising / falling edge time stamp with both modules.

    But what I want to do is just determing the previous 'On Status' of the signal. It should not be limited to the number of edges occured. 

    For example: Let s assume a 50% duty cycle signal with 10ms period. This signal goes into the N2HET. Instead of reacting to edge interrupts, i want to, for example, look into the N2HET after 100ms. After this time, 10 Rising Edges and Falling edges have occured, but that is of no interesst. 
    Instead, I'm only interested in the average on time, which is 50% oder 50ms in the given example. No interrupts generated when edges occure. Just a timer, that counts up, when the incoming signal is high and stops counting, when the incoming signal is low, without me, actively stopping starting the counter in SW by using interrupts.

    From what I have seen so far, this should be possible by writing my own programm for the N2HET. I'm gonna test it, using the HET-IDE. 

    Am I right here? And is it also possible to use the eCAP modules? 

    Thank you and kind regards

    Sebastian 

  • Hi Sebastian,

    Have you make your code work to calculate the average High time and Low time for a incoming series of pulse signal? 

  • Hi QJ, 

    sorry for the late response. I did so, using the HET IDE and start counting only, when the incoming signal is low. 

    I didn't manage to do that using the eCAP modules. There, I only measured timing, when edges occured and had to calculate the average on time way more complicated. 

    Code in HET IDE: 

    A0 ECNT { control=ON,pin=6,event=ACCUHIGH,reg=NONE,data=0};             -> Upcounting when signal is high 

    Is there a way to do the same thing using the eCAP module?

    Kind regards

    Sebastian 

  • hello Sebastian,

    I don't think that ecap has this kind of feature to accumulate the high level of a pin.