First thing that seems unusual to me is LCDOUT inside the ISR handler. That is something I would not do.
Secondly, there is a statement if freq < 68 then freq = 136 followed by freq = freq/68. As this is happening every 100mSec, could it be that freq is changing frequently leading to ScaledDelay jumping around?
Then there is goto mainloop followed by low in1, low in2. These statements will never execute as they come after goto mainloop.
My guess is that the LCDOUT inside the ISR and also in mainloop could be the cause of your trouble.
Bookmarks