How to Read This Manual–2n Manual ConfigurationEach section of this manual consists of a title, summary, main text, supplemental information, precautions andwarnings. The layout and definition of each section are shown below.SubtitleSub-subtitleThe smallest blockin this manual.Main textSummaryIntroduction to thesection.Key informationImportantinformation fromthe text.SupplementaryinformationSupplementaryinformation for themain text. Anexplanation ofterminology is alsoincluded.Precautions andwarningsPrecautions arelisted in case of lostfunctionality ordamage.Be sure to read.Chapter 4 Timer Functions834-3 16-bit Timer Operation (timer 4)4-3-1 OverviewTimer 4 is a 16-bit programmable counter that can be used as an event counter.A signal with frequency of 1/2 of the timer 4 overflow signal can be output from theTM4IO pin. An input capture function and added pulse PWM output function canalso be used.n Timer OperationSettings for timer operation are listed below.(1) Set the TM4EN flag of the timer 4 mode register (TM4MD) to "0" so that the countoperation of timer 4 is stopped.(2) Set the TM4CK2~0 flags of the TM4MD register to select fosc, fs/4, or fs/16 as theclock source.(3) Set the TM4PWM flag of the TM4MD register to "0" so that 16-bit timer operation isselected.Figure 4-3-1 Binary Counter 4 (TM4BC) Count Timing16-bit Timer Operation (timer 4)When servicing an interrupt, resetthe timer 4 interrupt request flagbefore operating timer 4.During a count operation, becareful if the value set in TM4OCHand TM4OCL is smaller than thevalue of binary counter 4, sincethe count-up operation willcontinue until overflow occurs.ClockTM4ENBinarycounter 4Write to registersTM4OCH, TM4OCL0504 06 07 08 09 00If the TM4EN flag of the TM4MD register is changedsimultaneously with other bits, the switching operation may causebinary counter 4 to be incremented.If the value of TM4OCH and TM4OCL registers is overwritten whiletimer 4 has stopped counting, binary counter 4 will be reset toX'0000'.