Timer interrupt handling using interrupt service routine