您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 6_通用定时器(Timer)
1(Timer)......................................................................................11.1Timer.............................................................................................................11.2Timer.............................................................................................................21.3Timer.................................................................................................................31.4Timer...................................................................................................................11i1(Timer)voidTimerConfigure(unsignedlongulBase,unsignedlongulConfig)4voidTimerControlStall(unsignedlongulBase,unsignedlongulTimer,tBooleanbStall)5voidTimerControlTrigger(unsignedlongulBase,unsignedlongulTimer,tBooleanbEnable)6voidTimerControlEvent(unsignedlongulBase,unsignedlongulTimer,unsignedlongulEvent)6voidTimerControlLevel(unsignedlongulBase,unsignedlongulTimer,tBooleanbInvert)6voidTimerLoadSet(unsignedlongulBase,unsignedlongulTimer,unsignedlongulValue)7unsignedlongTimerLoadGet(unsignedlongulBase,unsignedlongulTimer)7unsignedlongTimerValueGet(unsignedlongulBase,unsignedlongulTimer)7voidTimerEnable(unsignedlongulBase,unsignedlongulTimer)7voidTimerDisable(unsignedlongulBase,unsignedlongulTimer)8voidTimerRTCEnable(unsignedlongulBase)8voidTimerRTCDisable(unsignedlongulBase)8voidTimerQuiesce(unsignedlongulBase)8voidTimerMatchSet(unsignedlongulBase,unsignedlongulTimer,unsignedlongulValue)9unsignedlongTimerMatchGet(unsignedlongulBase,unsignedlongulTimer)9voidTimerPrescaleSet(unsignedlongulBase,unsignedlongulTimer,unsignedlongulValue)9unsignedlongTimerPrescaleGet(unsignedlongulBase,unsignedlongulTimer)9voidTimerIntEnable(unsignedlongulBase,unsignedlongulIntFlags)10voidTimerIntDisable(unsignedlongulBase,unsignedlongulIntFlags)10voidTimerIntClear(unsignedlongulBase,unsignedlongulIntFlags)10unsignedlongTimerIntStatus(unsignedlongulBase,tBooleanbMasked)10voidTimerIntRegister(unsignedlongulBase,unsignedlongulTimer,void(*pfnHandler)(void))10voidTimerIntUnregister(unsignedlongulBase,unsignedlongulTimer)111.1TimerStellarisARM24General-PurposeTimerModuleGPTMTimer0Timer1Timer2Timer3Timer3232RTC16/TimerATimerBPWMTimerz32one-shotperiodicRTCRealTimeClockRTCz168one-shot1periodicz16z16PWMPWMPulse-WidthModulationPWM1.2TimerTimer321632TimerATimerB32TimerTimerA32TimerB16TimerATimerATimerBTimerBTimerCCPCCPCaptureComparePWM//32CCPGPIO32RTCCCPCCP0CCP2CCP4RTCCCPCCP1CCP3CCP516PWMCCPTimer0ACCP0Timer0BCCP1Timer1ACCP2Timer1BCCP3132/Timer320x00000000ADC232RTCTimer32RTCCCPLM3S101/102RTC32KHz32.768KHzRTC32768RTC1Hz1RTC1RTC0x00000000232136RTCTimerRTCRTCHibernationModuleRTCVDD2316/32Timer16/81682432/TimerATimerB416TimerATimerB3CCP11516TimerATimerB160xFFFF0CCP616PWMTimerPWMStellarisARMPWMTimer16PWMPWMPWMTimerPWMTimerATimerB16PWMPWMPWMCCPTimerControlLevel()1.3TimerTimer#defineSysCtlPeriEnableSysCtlPeripheralEnableSysCtlPeriEnable(SYSCTL_PERIPH_TIMERn);//n0123RTCPWMCCP3CCPGPIOCCP2PD5#defineCCP2_PERIPHSYSCTL_PERIPH_GPIOD#defineCCP2_PORTGPIO_PORTD_BASE#defineCCP2_PINGPIO_PIN_5SysCtlPeripheralEnable(CCP2_PERIPH);//CCP2GPIODGPIOPinTypeTimer(CCP2_PORT,CCP2_PIN);//CCP2Timer1TimerConfigure()Timer323232RTC161616PWM16Timer/TimerATimerB1.1TimerControlStall()TimerTimer32RTCRTC1.2TimerControlTrigger()Timer/ADC1.3TimerControlEvent()1631.4TimerControlLevel()Timer16PWMPWM1.51.1TimerConfigure()TimervoidTimerConfigure(unsignedlongulBase,unsignedlongulConfig)ulBaseTimerTIMERn_BASEn0123ulConfigTimer32TIMER_CFG_32_BIT_OS//32TIMER_CFG_32_BIT_PER//32TIMER_CFG_32_RTC//32RTC1632TimerTimerATimerBTimerAulConfigTIMER_CFG_16_BIT_PAIRTIMER_CFG_A_ONE_SHOT//TimerATIMER_CFG_A_PERIODIC//TimerATIMER_CFG_A_CAP_COUNT//TimerATIMER_CFG_A_CAP_TIME//TimerATIMER_CFG_A_PWM//TimerAPWMTimerBulConfigTIMER_CFG_16_BIT_PAIR4TIMER_CFG_B_ONE_SHOT//TimerBTIMER_CFG_B_PERIODIC//TimerBTIMER_CFG_B_CAP_COUNT//TimerBTIMER_CFG_B_CAP_TIME//TimerBTIMER_CFG_B_PWM//TimerBPWM//Timer032TimerConfigure(TIMER0_BASE,TIMER_CFG_32_BIT_OS);//Timer132TimerConfigure(TIMER1_BASE,TIMER_CFG_32_BIT_PER);//Timer232RTCTimerConfigure(TIMER2_BASE,TIMER_CFG_32_RTC);//Timer0TimerATimerBTimerConfigure(TIMER0_BASE,TIMER_CFG_16_BIT_PAIR|TIMER_CFG_A_ONE_SHOT);//Timer0TimerBTimerATimerConfigure(TIMER0_BASE,TIMER_CFG_16_BIT_PAIR|TIMER_CFG_B_PERIODIC);//Timer0TimerATimerBTimerConfigure(TIMER0_BASE,TIMER_CFG_16_BIT_PAIR|TIMER_CFG_A_ONE_SHOT|TIMER_CFG_B_PERIODIC);//Timer1TimerATimerBTimerConfigure(TIMER1_BASE,TIMER_CFG_16_BIT_PAIR|TIMER_CFG_A_CAP_COUNT|TIMER_CFG_B_CAP_TIME);//Timer2TimerATimerBPWMTimerConfigure(TIMER2_BASE,TIMER_CFG_16_BIT_PAIR|TIMER_CFG_A_PWM|TIMER_CFG_B_PWM);1.2TimerControlStall()Timer32RTCvoidTimerControlStall(unsignedlongulBase,unsignedlongulTimer,tBooleanbStall)ulBaseTimerTIMERn_BASEn0123ulTimerTimerTIMER_ATIMER_BTIMER_BOTH32TIMER_ATIMER_BTIMER_BOTH16TIMER_ATimerATIMER_BTimerB5TIMER_BOTHTimerATimerBbStalltruefalse1.3TimerControlTrigger()TimervoidTimerControlTrigger(unsignedlongulBase,unsignedlongulTimer,tBooleanbEnable)ulBaseTimerTIM
本文标题:6_通用定时器(Timer)
链接地址:https://www.777doc.com/doc-5123718 .html