Dave,

Thanks - I've just tried that and it works fine - the first time in 2 days that I have managed to get the code to output the correct number of pulses.

However, I presume that when I incorporate the .asm code inside PBP the loop will prevent the .asm from ever finishing?

ASM
; lots of my asm code goes here
End_loop:
goto End_loop
ENDASM

Any other ideas please? What on earth is making the PIC ignore all the 'end stuff' instructions?

Regards Bill Legge