Byte output port D interfering input port C problem

I am developing a signal generator using the popular Amanda Chassaei engine.
I have added a 1602 LCD and a rotary encoder with switch to replace the 2 pots and 4 buttons in her design.
The problem I am having is when set to Triangle or Sine wave the micro jumps back into the menu. This should only happen after pressing the rotary encoder button.
The wave is output on port D, the rotary and switch is on port C.
I have tried everything I can think of but it seems an internal processor problem, its nothing to do with de-bouncing. Its fine with Sawtooth and square waves. The switch is also hardware de-bounced.
Help please, I have never been so puzzled !

attached SignalGenerator.ino and Waveforms3.h

Waveforms3.h (86.8 KB)

SignalGenerator.ino (17 KB)

You use pin A3 for the rotary encoder.
It appears that a library you are using also uses pin A3. Double usage of pins could conflict.

Library code (if this is similar to the code you found):

(look for if (digitalRead(A3)==LOW) , for example )

As I said, I'm not using the buttons.

As I said, I’m not using the buttons.

OK. If you require further assistance here, you may get better results if you post a link to the complete Waveforms3 library you are using. You appear only to have attached only a sine table from a fragment of the header file.