I have been using Elm Chan's tiny88 player for a convention greeting card like project due in 2013. The prototypes have been working for over a year.
Mostly I write assembly code. In wanting to learn more about C, I looked at this code which pretty much worked out of the box. I stripped some of the overhead guff out and made it work on a tiny45, although the price difference to the 85 had me return to the full bloated code.
Question is, the compiler flag F_CPU. Seeing this mentioned in other threads it looks like it should be set to the processor clock. Since all the pins of the tiny85 are used for I/O this should be set to 8000000L right?
The makefile has this at 16000000L, which seems to be working as the songs play at normal speed. I did a search here and the other usual places, but there is no real explanation of this compiler directive, mostly the usual snarky comments. Which sort of form a recursive loop.
Is this an error in the makefile? or would changing it require all the values in the timing loops to be changed too?
Ideally I would like to get rid of the delay loops (which are bad programming) and use timer semaphores and low power sleep modes. Something easy to do in ASM. Not quite sure in C how much overhead in the ISR is required as C tends to want to save the whole stack frame.
Are there any directives, that can reserve a register so that it is not pooled, but owned by the ISR and the wait time out function? These would probably be written in ASM.
I did find the tutorial on C interrupts helpful, but most deal with obfuscating the details from the newer user. With *caugh* close to 40 years of programming, It is too ingrained in me to not save every byte or processor cycle possible.