user 37518 said:
So your drum tunner is programmed in assembler? Nice!
Thousands of lines of code, that even I probably couldn't figure out now...
I would love to use high level languages but I almost always pursue unusual solutions...
For example to speed up level vs pitch scans to identify resonances, I play 3 octave spaced sine waves at the same time, then read the levels of each coming back from the drum. Trust me you won't find a C routine for that. The trick I used was to sample synchronously, in the octaves I was looking for,,, summing 2x or 4x samples would cancel themselves out... crude and not perfect, but good enough to perform a fast rough scan across 3 octaves in the time of only one scan.
Later on using a DSP prototype platform I was able to make something like 8 or 10 sine waves simultaneously with the built in 16B dac, then use FFT to ID loudest return... This was fast enough I could iteratively zero in on the exact resonances much faster. Where I stalled was extracting the phase information... I found the math for FFT phase, just not how to execute the math I needed in code.
of course this model would also benefit from a much richer graphic display, and I even considered adding a touch screen (bought a prototype display and overlay) but.... and I am repeating myself... drummers think my current model is too expensive so, never mind.
AFAIK the only difference between using the free C compiler on MPLAB VS buying it is that the paid version has a code optimizer so the instructions are less redundant and take less time to compute
IIRC the last programing interface I used also compiled C (not optimized) but almost everything I did was too complicated for me to trust C for important stuff... like try generating 8 sine waves simultaneously (not hard just a bunch of detail work). The built in DAC was sweet compared to my current model drum tuner where I make sine waves with the PWM output (good enough to wiggle drumheads at desired pitches).
JR
@squarewave... yes if I was paying programmers I'd insist on the most cost effective way...I am personally more comfortable coding down at machine level. These days not very comfortable even doing that... Assembly is useful for managing critical timing issues, and limited processor overhead... the modern stuff is so powerful when overclocked I never came close to running out of clock ticks to do something.... For the console meter project I wrote my own algorithm to perform square root (for RMS calculation).. I didn't even bother to see how C would do that (not as fast as mine I'm sure). FWIW I could have avoided the RMS calculation by using a look up table, but ended up not using the RMS at all.