PBP as well as other compilers that have the COUNT command use a software loop to count pulses. which means that it's a blocking command and nothing else can happen while counting pulses. the code above uses hardware timers that can work in the background.