This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to count rising edges of a pulse in ADUC842

Hello,

I am using ADUC842.

Continuous pulse is being fed at port P2.6

I need to calculate rising edges of the pulse for 10ms time interval..

how should i proceed?

pls help.

Regards
Mayuri

Parents
  • But why are you then even talking about patterns?

    Counting flanks will not see any difference between:

    100000001100
    000000101000
    000000001001
    001010000000
    011111110100
    


    All the above alternatives have two rising edges and two falling edges (but see note 1 below).
    So edge-counting is obviously not a working solution for pattern detection.

    Not only that - if your signal could potentially be noisy, then you could manage to count two extremely short noise pulses (just long enough for the timer to detect them) even if your intended signal should never manage a pulse shorter than 1ms.

    Maybe you should switch to a project where do you understand the exact needs - only then can you even start considering how to implement a solution.

    If the word "pattern" is really important to this problem, then the traditional way is to either catch the flanks (both high and low) and pick up the exact time when the flanks was seen - or sample the signal at a frequency higher than the shortest high or low pulse allowed for the signal. Then the samples/times can be analyzed to decide if the detected data matches the pattern - obviously, a repeating pattern requires the analyzer to take care of the situation where you start listening at any time in the pattern, i.e. that the same repeating pattern 01011101001 could be seen as all of the following rotated variants (11 alternatives since 11 "bit slots" in pattern:

    01011101001
    10111010010
    01110100101
    11101001010
    11010010101
    10100101011
    01001010111
    10010101110
    00101011101
    01010111010
    10101110100
    

    Note 1: The first pattern could potentially have only one rising edge and two falling edges.
    The third pattern could potentially have two rising edges and one falling edge.
    A flank detector can only see flanks that happens while the flank detector is active - flanks that happens just before or just after can't be separated from a situation where the signal has been static high a long time before the flank detector is started - or the signal stays high a long time after the flank detector runs out of time.

Reply
  • But why are you then even talking about patterns?

    Counting flanks will not see any difference between:

    100000001100
    000000101000
    000000001001
    001010000000
    011111110100
    


    All the above alternatives have two rising edges and two falling edges (but see note 1 below).
    So edge-counting is obviously not a working solution for pattern detection.

    Not only that - if your signal could potentially be noisy, then you could manage to count two extremely short noise pulses (just long enough for the timer to detect them) even if your intended signal should never manage a pulse shorter than 1ms.

    Maybe you should switch to a project where do you understand the exact needs - only then can you even start considering how to implement a solution.

    If the word "pattern" is really important to this problem, then the traditional way is to either catch the flanks (both high and low) and pick up the exact time when the flanks was seen - or sample the signal at a frequency higher than the shortest high or low pulse allowed for the signal. Then the samples/times can be analyzed to decide if the detected data matches the pattern - obviously, a repeating pattern requires the analyzer to take care of the situation where you start listening at any time in the pattern, i.e. that the same repeating pattern 01011101001 could be seen as all of the following rotated variants (11 alternatives since 11 "bit slots" in pattern:

    01011101001
    10111010010
    01110100101
    11101001010
    11010010101
    10100101011
    01001010111
    10010101110
    00101011101
    01010111010
    10101110100
    

    Note 1: The first pattern could potentially have only one rising edge and two falling edges.
    The third pattern could potentially have two rising edges and one falling edge.
    A flank detector can only see flanks that happens while the flank detector is active - flanks that happens just before or just after can't be separated from a situation where the signal has been static high a long time before the flank detector is started - or the signal stays high a long time after the flank detector runs out of time.

Children
No data