Duncan,

Now that you are using PBPL, things get very easy.

PBPL does not have the 32767 upper limit like PBPW.
The resolution is only 8-bit max. But you don't need resolution, just frequency @~50% duty.
And, it's not glitch free, but if you only change the frequency when you need to, it shouldn't be a problem.
Code:
Freq  VAR LONG

Freq = 500000

HPWM 1, 127, Freq
Should do it. I think.
<br>