Nice one Mike. The code execution is estremely fast (as would be expected from removing the 32bit:32bit comparison).
I had never put a DDS 1 second generator up on the page although I know we discussed it previously, i think it was in the ZEZJ thread where we did some sinewave inverter stuff together?
There's a couple of small issues; 1. The math for deriving the constant is a little unpleasant and off putting for a beginner. With the other 1 second examples they can just input their xtal freq as a neat constant #define and it's quite intiutive.
May I suggest adding a #define calc at the top so the compiler itself can derive the constant to be added to the accumulator? I think that would be a valuable addition as the user never needs to know (or even understand) how the constant is derived.
Something like;
#define XTAL 8000000 // your xtal freq
#define INT_TMR_PRESCALE 1 // your TMR0 prescale, ie 1:1 (or use int period in instructions, ie; #define INT_PERIOD 256 ?)
#define ADD_VALUE (calc) // this is the auto-calculated value they add each int
The second issue is that *most* compilers won't support direct bit access on 32bit vars. That's very non-ANSI C. And of course without the direct bit access it's back to being a bresenham 32bit add + 32:32 compare but without the benefit of clean numbers. It would be good to have a simple pointer version or something beginners would understand that keeps the speed but doesn't require a compiler that can handle direct bit access.
Another minor issue is that it can't generate a perfect accumulated period like the bresenham can, although with 3.6 PPm error that is not really an issue, most xtals are 30 PPM error range or greater.
If you wanted to add the auto calc for the period and maybe consider a second pointer version, I would be proud to add the two versions to the 1 second page for people to use.