write and test timer interrupt handler