EnhancedCaptureTimerModuleReferenceManualECT_16B8CBlockUserGuide(EnhancedCaptureTimer16bbufferedReg.&8b.counter)ECTHardwareOverview•A16-bitmasterup-counter&A16-bitmodulusdown-counter,withprogrammableprescaler.•8independenttimerchannels,eachcapableofinputcaptureandoutputcomparefunctions.•4x8-bitpulseaccumulatorswhichmaybeconfiguredas2x16-bitpulseaccumulators.TIMERSTRUCTUREPRE-SCALERPR[2:0]MainClock1248163264128TCNT15...........................................0DATABUSPAPULSEAccumulatorPINRRRR1-CLOCKSCOUNTERENABLE0-CLOCKSCOUNTERDISABLETENTSWAITSFRZTFFCATSCR1-TIMERSYSTEMCONTROLREGISTERRST:00000000TCNTCLK.TENB0.......……...B7B8……..........B15R=Reserved$0006AddressOffset$0004,05$FFFE$FFFF$0000TOFTimer,PrescalerandCounter1.TCNT2.TFLG2TimerOverflowFlagWritea‘1’toclear16BITFREERUNNING/MODULOCOUNTERPRESCALERSELECTION1-TIMEROVERFLOWINTERRUPTENABLE0-TIMEROVERFLOWINTERRUPTDISABLETOF0000000B7......................................................................B0B15.....................................................................................................…B0REGISTERS:DIVIDEBY1248163264128000011110101010100110011PR2PR1PR0RST:00000000RST:0................................................................................0$000F$000DAddressOffset$0004,$00053.TSCR2RST:000000001-TIMERRESETBYOC7MATCH0-COUNTERISFREERUNINGTCRE-ALLOWSFORPULSEWIDTHMODULATIONFUNCTION.B7....................................................................................B0TOI000TCREPR2PR1PR0TIMEROPERATIONUSEFULFOR:1.BASISFORALLTHETIMINGFUNCTIONS2.PROVIDINGTIMEINFORMATIONTOPROGRAMSDESCRIPTION:THEE-CLOCKDRIVESAPRESCALER,DIVIDEBY1,T0128,WHICHINTURNDRIVESA16BITCOUNTER.WHENTHETIMERGOESFROM$FFFFTO$0000:-THETIMEROVERFLOWFLAGBITISSETINADDITION:-ANOVERFLOWINTERRUPTMAYOCCURRESETCONDITIONS:TCNTISINITIALIZEDTOALLZEROESANDDisabledTIMEROVERFLOWINTERRUPTSAREDisabledTC7-TC0REGISTERSARECLEAREDTIMEROVERFLOWFLAGISCLEAREDPRESCALERIS1INTERRUPT:FORTIMEROVERFLOW•TOCLEARINTERRUPTWRITE1TOTOFBITTFLG2.DONOTUSEBITMANIPULATIONINSTRUCTIONS(SINCERM/WOPERATION).•TIMEROVERFLOWVECTORUSED.TimerOverflowInterruptOutputCompareFunctionCompare/CaptureUnit16-BitFree-RunningCounter16-BitOutputCompareRegister(programmedbysoftware)PinControlLogicInterruptRequesttoCPUOCxFStatusFlagissetuponcomparematchOCxIOptionalLocalInterruptMask(Enabledthroughsoftware)•UPTO8separateOutputCompareFunctions•EachOutputCompareFunctionhasitsownVectorandControls•ProvidesamechanismtooutputasignalataspecifictimeActiontakenuponmatchofcompareregisterwithcounterTCNTTOCxPinOCxCOMPAREComparatorMATCH!SetPinPERFORMACTIONORORClearPinTogglePinOutputCompare,OC7-OC0(1of4)USEFULFOR:1.OUTPUTWAVEFORMCONTROL(SOFTWARECONTROLLED)2.ELAPSEDTIMEINDICATOR(TOEXTERNALCIRCUITRY)DESCRIPTION:DURINGEACHE-CLOCKCYCLE,THEOUTPUTCOMPAREREGISTERSARECOMPAREDTOTHEFREE-RUNNINGCOUNTER.IFTHEREISACOMPARETHEN:1.THEINTERRUPTFLAGBITISSETINADDITION,EITHERORBOTHOFTHEFOLLOWINGMAYOCCUR:1.THESTATEOFTHEASSOCIATEDOUTPUTPINMAYBECHANGED2.ANINTERRUPTISGENERATEDTOCPU,IFEnabledOutputCompare(2of4)C7FC6FC5FC4FC3FC2FC1FC0FC7IC6IC5IC4IC3IC2IC1IC0IOM7OL7OM6OL6OM5OL5OM4OL41.TC7–TC02.TFLG13.TIE4.TCTL1COMPARE/CAPTUREFLAGSWrite‘1’toClearInterruptFlagCOMPARE/CAPTUREMASK0=InterruptRequestMasked1=InterruptRequestEnabledOMXOLXActiononOCx00110101NoActionOCxToggleOCxDriveOCxLODriveOCxHIOUTPUTMODEANDOUTPUTLEVEL(O7–OC0)B6B5B4B3B7B2B1B0REGISTERS:OM3OL3OM2OL2OM1OL1OM0OL05.TCTL2B6B5B4B3B7B2B1B0RST:00000000$0008RST:00000000RST:00000000RST:00000000$000C$000E$0009B6B5B4B3B7B2B1B0B6B5B4B3B7B2B1B0AddressOffset$0010-$0011--$001E-$001F16BITCAPTURECOMPAREREGISTER(TC7)16BITCAPTURECOMPAREREGISTER(TC0)--ForceOutputCompare(3of4)FOC7FOC6FOC5FOC4FOC3FOC2FOC1FOC05.CFORCB7B6B5B4B3B2B1B0-FORCEOUTPUTCOMPAREPINS:1.OC7–OC0(PORTTPINS7-0)USEDTOSTABLISHINITIALTIMERPINSTATES.NOTE:FORCEOUTPUTCOMPAREDOESNOTSETOCxFLAGS.FORCEOUTPUTCOMPARE7MAYAFFECTANYORALLOUTPUTCOMPAREPINS.RST:00000000$0001OutputCompare,OC7-OC0(4of4)INTERRUPTS:FOROUTPUTCOMPARESOC7–OC0TOCLEARINTERRUPT,WRITE1TOOCxFBITINTFLG1DONOTUSEBITMANIPULATIONINSTRUCTIONS(SINCERM/WOPERATION)OC7–OC0VECTORSAREUSEDRESETCONDITIONS:••OUTPUTCOMPAREREGISTERSAREINITIALIZEDTO$0000OUTPUTCOMPAREPINSAREDISCONNECTEDFROMOUTPUTCOMPAREFUNCTIONSINTERRUPTSareDisabledFLAGBITSARECLEAREDFORCECOMPAREBITSARECLEARED••••••FREERUNNINGCOUNTER(TCNT)INITIALIZEDTO$0000ANDDisabled.OutputCompare,OC7(1of2)CONTROLOFMULTIPLEOUTPUTCOMPAREPINSCONTROLOFASINGLEPINBYTWOOUTPUTCOMPARES(THUS,SHORTPULSESAREPOSSIBLE).DURINGEACHE-CLOCKCYCLE,THEOUTPUTCOMPAREREGISTER1ISCOMPAREDTOTHEFREE-RUNNINGCOUNTER.IFTHEREISACOMPARETHEN:INADDITION,EITHERORBOTHOFTHEFOLLOWINGMAYOCCUR:1.THEINTERRUPTFLAGBITISSET1.THESTATEOFOUTPUTPINSOC7–OC0MAYBECHANGED2.ANINTERRUPTMAYOCCURUSEFULFOR:DESCRIPTION:1.2.•OC7CANAFFECTMULTIPLEPINS(OC7–OC0)•OC7ACTIONOVERRIDESANYCONFLICTINGOC7–OC0ACTIONFORAGIVENPIN.OutputCompare7(2of2)C7IC6FC5FC4FC3FC2FC1FC0FOC7M7OC7M6OC7M5OC7M4OC7M3OC7M2OC7M1OC7M04.TIE-TIMERINTERRUPTENABLE5.OC7M-OC7MASKB7.............................................................................................B01-TC7-16BITCOMPARER