The frequency slows down continously but takes time to spped up!

henrimontreal:
No this works properly. Check out the IDE you work with.

Thanks anyway.

sketch_apr08a.cpp: In function 'void TC0_Handler()':
sketch_apr08a:9: error: 'REG_TC0_SR0' was not declared in this scope
sketch_apr08a.cpp: In function 'void loop()':
sketch_apr08a:42: error: 'REG_PIOB_PDR' was not declared in this scope
sketch_apr08a:43: error: 'REG_PIOB_ABSR' was not declared in this scope
sketch_apr08a:44: error: 'REG_TC0_CMR0' was not declared in this scope
sketch_apr08a:45: error: 'REG_TC0_IER0' was not declared in this scope
sketch_apr08a:47: error: 'REG_TC0_RC0' was not declared in this scope
sketch_apr08a:48: error: 'TC0_IRQn' was not declared in this scope
sketch_apr08a:48: error: 'NVIC_EnableIRQ' was not declared in this scope

To me, that doesn't look like it works perfectly....