Pulse counter code

Looks like you already found that in your other post, here: What is the function of this code