I have attached a copy of the code which worked perfectly on the QD4 and the QG8.
I monitored the waveform on an oscilloscope and watched the pulse widen as I altered the potentiometer. When the pulse was about 50% of the duty cycle, it collapsed into a pulse of about 5% wide. But as I increased the pot., the pulse reappeared at about 55% and grew as I continued to increase the pot.
The only difference I can find between the QD/QG devices and the SH is that the SH runs at twice the speed, and the SH has a different revision of TPM module.
I hope this helps to resolve this problem as I like to use the SH in many of my projects.
Best regards,
Derek Jones.