Hi,
I am trying to control the volume of a piezo by PWM, but
not a great deal of success.

I have also tried HPWM, but the same.

Peizo operating freq 4100 hz

PIC 16F628A

Int Osc, CMON = 7 Vol var word
etc done

For Vol=100 to 250 step 10
PWM PortB.3,vol,10
Pause 200
next

For Vol=100 to 250 step 10
HPWM 1,vol,10
Pause 200
next

Both cause a scratchy sound, with a little volume control.

I am trying to eliminate a resistive pot, and use to PB, for up/down.

kind regards

Peter