AD9833 irrelevant phase change

I am trying to change phase of my signal on ad9833. I can set the frequency to 1KHz sine wave and then display it on scope with another 1KHz square wave from my scope. Then when I try to change phase of my sine wave using the code below, phase changes unexpectedly(trigger is set to 1KHz square wave so I can see the phase drift on sine wave when I change it). I am incrementing phase register by 1 or decrementing it by 1 in somewhere else of my code(Phase register max value is 4095). In which I am expecting steady change on my sine wave but the change is huge sometimes small it does not change according to my code.

Bottom line I am expecting a steady change in phase when I increase/decrease it with a rotary encoder in comparison to another 1KHz square wave which the scope is triggered to.



I send Sıgnal[10] from spi whenever frequency or phase changes as whole.

Can not do this without reference of another 1KHz signal because if I were to use single wave I could not see the phase change due to signal being triggered to its own edges which results in same signal being shown on scope.

Is it possible to change phase in reference to another signal the way I am doing it?



Fixed topic
[edited by: Yorem at 1:00 AM (GMT -5) on 29 Nov 2020]