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 pulses?

I am giving 2 signals to the controller.
1st signal to port 3.4
and 2nd to port 3.5.
now these signals are continuously being fed to the port pin..

1st signal has the following patern
011001101100110110011.......(0110011 pattern is repeating again and again.entire duration of 0110011 is 14ms)

2nd signal has the following patern
011010101101010110101.......(0110101 pattern is repeating again and again.entire duration of 0110101 is 14ms)

my task is to count the number of one's (high) in 14 ms..
Then i should put this in while loop bcoz unique pattern of 14ms is repeating again and again...

How should i proceed?

I have two options in hardware-either i can give my 2 signals to timer port3.4 or 3.5

or to give it to gpio

pls help

  • Since you started your previous thread several weeks ago - haven't you already figured out good ways to count pulses? What have you done? What information have you read? What experiments have you done with your processor? What analysis have you done of your signals?

    On the other hand - you have still not managed to answer the questions I did write in the previous thread. Have you verified if it is enough to count number of flanks within 14 ms? Have you figured out your required reaction times since your processor will not run synchronously with these signals (you don't mention any clock signal telling when to sample the two input patterns). 14 ms for the transmitter will not even be the same time as 14 ms measured by your processor. So anything where the two don't have the same clock or where you auto-adjust timing in your program will suffer clock drift. Without analysis by you, we can't know the implications of that.