For starters, There is too much variance between pulses and there is nothing in your code to SYNC the 10 Ms. start pulse with. You are only counting the pulses for 15 Ms. and with no SYNC 1 of the pulses is taking as much as 10 Ms. of the timing gate. I am not understanding the pulse pattern you are trying to decode. If the pulse train only lasts for 15 Ms. before it repeats then you will only ever count approx.9 counts. Am I correct? What in the data stream is changing? The number of pulses or the pulse width?