最新16定时器汇总Word格式文档下载.docx

上传人:b****2 文档编号:1388051 上传时间:2023-04-30 格式:DOCX 页数:28 大小:1.47MB
下载 相关 举报
最新16定时器汇总Word格式文档下载.docx_第1页
第1页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第2页
第2页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第3页
第3页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第4页
第4页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第5页
第5页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第6页
第6页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第7页
第7页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第8页
第8页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第9页
第9页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第10页
第10页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第11页
第11页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第12页
第12页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第13页
第13页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第14页
第14页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第15页
第15页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第16页
第16页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第17页
第17页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第18页
第18页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第19页
第19页 / 共28页
最新16定时器汇总Word格式文档下载.docx_第20页
第20页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

最新16定时器汇总Word格式文档下载.docx

《最新16定时器汇总Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《最新16定时器汇总Word格式文档下载.docx(28页珍藏版)》请在冰点文库上搜索。

最新16定时器汇总Word格式文档下载.docx

16位脉冲累加器

TheTIM16B8CV2includesthesedistinctivefeatures:

•Eightinputcapture/outputcomparechannels.

•Clockprescaling.

•16-bitcounter.

•16-bitpulseaccumulator.

16.1.2ModesofOperation

Stop:

Timerisoffbecauseclocksarestopped.

停止:

因为时钟停止,定时器停止。

冻结:

定时器计数器继续运行,除非TSFRZinTSCR(0x0006)置1.

等待:

计数器继续运行,除非TSWAIinTSCR(0x0006)置1.

正常:

定时器计数器继续运行,除非TENinTSCR(0x0006)被清0.

Freeze:

Timercounterkeeponrunning,unlessTSFRZinTSCR(0x0006)issetto1.

Wait:

Counterskeeponrunning,unlessTSWAIinTSCR(0x0006)issetto1.

Normal:

Timercounterkeeponrunning,unlessTENinTSCR(0x0006)isclearedto0.

16.2.1IOC7—InputCaptureandOutputCompareChannel7Pin

Thispinservesasinputcaptureoroutputcompareforchannel7.这也可以被配置为脉冲累加器输入。

16.2ExternalSignalDescription

TheTIM16B8CV2modulehasatotalofeightexternalpins.

Thispinservesasinputcaptureoroutputcompareforchannel7.Thiscanalsobeconfiguredaspulseaccumulatorinput.

16.2.2IOC6—InputCaptureandOutputCompareChannel6Pin

Thispinservesasinputcaptureoroutputcompareforchannel6.

16.2.3IOC5—InputCaptureandOutputCompareChannel5Pin

Thispinservesasinputcaptureoroutputcompareforchannel5.

16.2.4IOC4—InputCaptureandOutputCompareChannel4Pin

Thispinservesasinputcaptureoroutputcompareforchannel4.Pin

16.2.5IOC3—InputCaptureandOutputCompareChannel3Pin

Thispinservesasinputcaptureoroutputcompareforchannel3.

16.2.6IOC2—InputCaptureandOutputCompareChannel2Pin

16.2.7IOC1—InputCaptureandOutputCompareChannel1Pin

Thispinservesasinputcaptureoroutputcompareforchannel1.

16.2.8IOC0—InputCaptureandOutputCompareChannel0Pin

Thispinservesasinputcaptureoroutputcompareforchannel0.

NOTE

ForthedescriptionofinterruptsseeSection16.6,“Interrupts”.Thispinservesasinputcaptureoroutputcompareforchannel2.

16.3.2RegisterDescriptions

16.3.2.1TimerInputCapture/OutputCompareSelect(TIOS)

0=输入捕捉

1=输出比较

TIOS

TIOS_IOS0

16.3.2.2TimerCompareForceRegister(CFORC)

Read:

Anytimebutwillalwaysreturn0x0000(1stateistransient)

1=强制输出比较

其实当比较寄存器的值和计数器的值相等时,也会输出比较,只不过它的作用是立即输出比较

CFORC

CFORC_FOC0

16.3.2.3OutputCompare7MaskRegister(OC7M)

1=设为输出比较(当TIOS中的IOS7和IOSn被设为输出比较时)

该寄存器的作用是控制0到6的任意一路或全部输出比较

OCPDx(x是0to6)置0:

使能定时器端.

OC7M

OC7M_OC7M0

16.3.2.4OutputCompare7DataRegister(OC7D)

OC7DATE当OC7比较事件发生时,引脚的逻辑电平

OC7D

注意:

不能进行位运算

16.3.2.5TimerCountRegister(TCNT)

The16-bitmaintimerisanupcounter.

Afullaccessforthecounterregistershouldtakeplaceinoneclockcycle.Aseparateread/writeforhighbyteandlowbytewillgiveadifferentresultthanaccessingthemasaword.

Anytime

Write:

Hasnomeaningoreffectinthenormalmode;

onlywritableinspecialmodes(test_mode=1).TheperiodofthefirstcountafterawritetotheTCNTregistersmaybeadifferentsizebecausethewriteisnotsynchronizedwiththeprescalerclock.

这个是向上记数的,记数器寄存器,它是自由记数器,不用写

TCNTHi高八位

TCNTLo低八位,不能进行位运算

TCNT16位

16.3.2.6TimerSystemControlRegister1(TSCR1)

多了第三位:

PRNT

PRNT:

精密定时器

0使用传统的定时器。

TSCR2寄存器的PR0,PR1和PR2位用于定时计数器分频器的选择。

1使精密定时器。

所有PTPSR寄存器的位都用于精密定时器分频器的选择

此位只有在重置时写有效

TEN:

1=定时器使能(开启定时器)

0=不使能

TSWAI–在WAIT模式时,定时器停止

0=不停止

1=停止

TSFRZ:

TSBCK–在DEBUG模式时,定时器停止

0=不停止

1=停止

TFFCA–定时器快速标志位清除使能

0=定时器标志位正常清零

1=输入捕捉时读取寄存器,输出比较时写寄存器,可以对相应通道标志位清零

TSCR1

TSCR1_PRNT

TSCR1_TFFCA

TSCR1_TSFRZ

TSCR1_TSWAI

TSCR1_TEN

16.3.2.7TimerToggleOnOverflowRegister1(TTOV)

TOVx–定时器溢出时,电平翻转

只有当通道被配置成输出比较时,才有效

1=电平翻转

0=不翻转

TTOV

TTOV_TOV0

TTOV_TOV7

16.3.2.8TimerControlRegister1/TimerControlRegister2(TCTL1/TCTL2)

OMn=输出模式

OLn=输出电平

TCTL1

TCTL1_OL4--------》TCTL1_OL7

TCTL1_OM4-------》TCTL1_OM7

TCTL2

TCTL2_OL0------》TCTL2_OL3

TCTL2_OM0--------》TCTL2_OM3

独立运行输入捕捉或输出比较的16位脉冲累加器,用户必须设置相应的位IOSx=1,OMx=0andOLx=0.。

OC7M7在OC7M寄存器还必须清除。

Tooperatethe16-bitpulseaccumulatorindependentlyofinputcaptureoroutputcompare7and0respectivelytheusermustsetthecorrespondingbitsIOSx=1,OMx=0andOLx=0.OC7M7intheOC7Mregistermustalsobecleared.

16.3.2.9TimerControlRegister3/TimerControlRegister4(TCTL3andTCTL4)

输入捕捉边沿控制

TCTL4也是控制8位脉冲记数器PAC0---3的寄存器,控制捕捉方式。

EDGE0B&

EDGE0这两位控制16位脉冲记数器PACB的捕捉方式。

TCTL3

TCTL3_EDG4A----------》TCTL3_EDG7A

TCTL3_EDG4B-----------》TCTL3_EDG7B

TCTL3_EDG4x

TCTL3_EDG5x

TCTL3_EDG6x

TCTL3_EDG7x

TCTL4

TCTL4_EDG0A----------》TCTL4_EDG3A

TCTL4_EDG0B-----------》TCTL4_EDG3B

TCTL4_EDG1x

TCTL4_EDG2x

TCTL4_EDG3x

EDGnBEDGnA:

InputCaptureEdgeControl—Theseeightpairsofcontrolbitsconfiguretheinputcaptureedgedetectorcircuits.

16.3.2.10TimerInterruptEnableRegister(TIE)

定时器输入捕捉/输出比较中断使能

TIE

TIE_C0I---------》TIE_C7I

C7I:

C0I:

InputCapture/OutputCompare“x”InterruptEnable—ThebitsinTIEcorrespondbit-for-bitwiththebitsintheTFLG1statusregister.Ifcleared,thecorrespondingflagisdisabledfromcausingahardwareinterrupt.Ifset,thecorrespondingflagisenabledtocauseainterrupt.

16.3.2.11TimerSystemControlRegister2(TSCR2)

TOI:

1=定时器溢出中断使能

0=中断不使能

TCRE:

1=定时器由OC7比较输出时复位

0=定时器自由运行

PR2,PR1,PR0;

分频系数选择

Thenewlyselectedprescalefactorwillnottakeeffectuntilthenextsynchronizededgewhereallprescalecounterstagesequalzero.

TSCR2

TSCR2_PR0

TSCR2_PR1

TSCR2_PR2

TSCR2_PR

TSCR2_TCRE

TSCR2_TOI

新预定因素直到下一个同步边缘(所有计数等于零)就会有影响,

7TOI:

TimerOverflowInterruptEnable

0Interruptinhibited.

1HardwareinterruptrequestedwhenTOFflagset.

3TCRE

TimerCounterResetEnable—Thisbitallowsthetimercountertoberesetbyasuccessfuloutputcompare7event.Thismodeofoperationissimilartoanup-countingmoduluscounter.

0Counterresetinhibitedandcounterfreeruns.

1Counterresetbyasuccessfuloutputcompare7.

IfTC7=0x0000andTCRE=1,TCNTwillstayat0x0000continuously.IfTC7=0xFFFFandTCRE=1,TOFwillneverbesetwhenTCNTisresetfrom0xFFFFto0x0000.

2PR[2:

0]

TimerPrescalerSelect—ThesethreebitsselectthefrequencyofthetimerprescalerclockderivedfromtheBusClockasshowninTable16-14.

16.3.2.12MainTimerInterruptFlag1(TFLG1)

用于清除标志时(设置相应的位使相应的位清除).写0将不会影响到当前的位状态。

比较/捕捉中断标志位,写“1”清除中断标志位

每次捕捉到两个有效的值,就会产生中断

C0F是16位脉冲记数器B的中断标志位

C3F-C0F是8位脉冲记数器PAC3-PAC0的中断标志位

当TFFCA=1时,这些标志位会被自动清除。

TFLG1

TFLG1_C0F--------》TFLG1_C7F

C[7:

0]F:

InputCapture/OutputCompareChannel“x”Flag—Theseflagsaresetwhenaninputcaptureoroutputcompareeventoccurs.Clearachannelflagbywritingonetoit.

WhenTFFCAbitinTSCRregisterisset,areadfromaninputcaptureorawriteintoanoutputcomparechannel(0x0010–0x001F)willcausethecorrespondingchannelflagCxFtobecleared.

16.3.2.13MainTimerInterruptFlag2(TFLG2)

TFLG2indicateswheninterruptconditionshaveoccurred.Toclearabitintheflagregister,writethebittoone.

Usedinclearingmechanism(setbitscausecorrespondingbitstobecleared).AnyaccesstoTCNTwillclearTFLG2registeriftheTFFCAbitinTSCRregisterisset.

定时器溢出标志位,写“1”清零

TFLG2

TFLG2_TOF

如果在TSCR寄存器中的TFFCA被置,任何访问TCNT将会清除TFLG2寄存器位

7TOF:

TimerOverflowFlag—Setwhen16-bitfree-runningtimeroverflowsfrom0xFFFFto0x0000.ThisbitisclearedautomaticallybyawritetotheTFLG2registerwithbit7set.(SeealsoTCREcontrolbitexplanation.)

16.3.2.14TimerInputCapture/OutputCompareRegistersHighandLow0–7(TCxHandTCxL)

原:

未分高低

根据相应的通道的TIOS位,当定义的过渡段被相应的输入捕捉边缘探测器感知或者促发一个外部比较,这些寄存器就被用于锁存自由运行计数器的值。

随时输出比较功能。

在输入捕捉的时候,写入这些寄存器没有效果。

所有定时器输入捕捉/输出比较寄存器都重置为0x0000。

DependingontheTIOSbitforthecorrespondingchannel,theseregistersareusedtolatchthevalueofthefree-runningcounterwhenadefinedtransitionissensedbythecorrespondinginputcaptureedgedetectorortotriggeranoutputactionforoutputcompare.

Anytimeforoutputcomparefunction.Writestotheseregistershavenomeaningoreffectduringinputcapture.Alltimerinputcapture/outputcompareregistersareresetto0x0000.

Read/Writeaccessinbytemodeforhighbyteshouldtakesplace

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2