I have put these line which are supposed to "make my life easier" when I switch clock frequency and still want to keep the same backgroung timer ticks of 10ms in this case.
#define clock_divisor 1024 #define tick_time 10 // In ms OCR2A = (uint8_t) ((tick_time / 1000) / ((uint32_t) (1/F_CPU) * (uint32_t) (clock_divisor)));
It doesn't work, of course! :evil: tried various formats which work correctly with my calculator but I always get a "divide by 0" warning.
Tried loading up all the floating point libraries too. Am I missing something in the linker settings? At the moment I have nothing there but have tried the same "magic words" I use for floating point printf without any imrpovement.
In the simulator a simple 11/2 gives me a result of 5 (watch window) rather than 5.5 for a variable which is declared as float. So something is not well somewhere.
ARGGGHHH just realised I have spend 2 hours "making my life easier" :twisted: