
Originally Posted by
HenrikOlsson
Hi,
It might be the DIV32, we'll have to get Darrel to answer that or have someone dig into the ASM code and figure out if the PBP registers used by DIV32 are being saved by DT-Ints or not (I still think they are).
My guess is that it isn't actually DIV32 that is causing it but something else with the way the frequency is changed. Why not try constantly ramping the frequency up and down in your main loop? Don't use DIV32, just "sweep" the reload value up and down between your MIN and MAX values. Does it still glitch? If so we know that it's not DIV32 that's causing it but something else.
If it turns out that it IS DIV32 then we can look at other solutions. The DIV32 thing was in response to your request of directly calculating the reload value based on the desired output frequency scaled in Hz. Simply rescaling to some arbitrary "unit" might allow the calculations to be done without DIV32 but it comes with a couple of commitments which I won't go into until we know that that DIV32 is the problem.
Can you explain to me where the values 34696 and 32 comes from?
/Henrik.
I've done like you said a simple ramp in the main loop :
Code:
reload=reload-1
if reload<40000 then reload=64600
The sine frequency ramped down, and after many cycles, no glitch appeared on the oscilloscope. During this time I've played with the potentiometer to vary the amplitude and also I navigate into the inverter menu, the sine wave was not disturbed at all.
So the problem is clearly DIV32. Apparently this command disturbs DT Instant Interrupts.
I've already changed the "34696" and "32" dummy values to "1120" and "1000", it's far better to understand.
Bookmarks