3 ms·
The numerically controlled oscillator (NCO) aka Direct Digital Synthesizer (DDS) at the heart of this is one of the most elegant things I've encountered. I once
by mikewarot 5y ago
The numerically controlled oscillator (NCO) aka Direct Digital Synthesizer (DDS) at the heart of this is one of the most elegant things I've encountered. I once used an NCO to adjust for belt speed variation in a machine that applied hot glue to corrugated boxes in a production environment. The CPU I had at the time was constrained to 512 Bytes of EEPROM to store the program in, and it (the NCO) really helped fit that along with all the I/O to read the input thumbwheels into the thing.
The customer kept adding features, and when I was all done, I had all the code in 511 bytes.
All a phase accumulator is is a long register you add to, and only take the top N bits off of. It's quite easy to have 64 bits of frequency resolution, regardless of how many bits your SINE table lookup is going to the DAC.
- jacquesm 5y ago> I had all the code in 511 bytes What a waste ;) It's funny how this works though: customer makes yet another request, at first your response is 'forget it'. Then, late at night when the house is quiet you really start to think about it and bit by bit the solution starts to present itself. Then a highly annoying bout of code golf later you manage to squeeze the feature in, and end up with more free space than you had before...
- HeyLaughingBoy 5y agoI have to ask. Was the MCU by chance an MC68HC705K1? Asking for a friend :-)
- mikewarot 5y agoIt was a 68HC11, I forget the specific model number, they had a few development boards for $68.11 in the local college bookstore, so that's how I prototyped it. ;-)
- HeyLaughingBoy 5y agoI asked because in interviews I used to mention the amount of functionality I stuffed into a 'K1, which ISTR had 511 bytes of program memory. I recall that HC11 version too! I bought the PLCC version and made my own dev board with a through hole PLCC socket :-) [edit] memory just caught up to me. The HC05K1 had 504 bytes of program memory, not 511.