HCS12ECTPWM增強(qiáng)型捕捉定時(shí)器模塊_第1頁(yè)
HCS12ECTPWM增強(qiáng)型捕捉定時(shí)器模塊_第2頁(yè)
HCS12ECTPWM增強(qiáng)型捕捉定時(shí)器模塊_第3頁(yè)
HCS12ECTPWM增強(qiáng)型捕捉定時(shí)器模塊_第4頁(yè)
HCS12ECTPWM增強(qiáng)型捕捉定時(shí)器模塊_第5頁(yè)
已閱讀5頁(yè),還剩41頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、Freescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.TMFreescale HCS12 微控制器微控制器MC9S12DP2562

2、005年年8月月Freescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.TMEnhanced Capture Timer Modul

3、e增強(qiáng)型捕捉定時(shí)器模塊增強(qiáng)型捕捉定時(shí)器模塊TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 2ECT 模塊結(jié)構(gòu)

4、模塊結(jié)構(gòu)一個(gè)16位向上帶可編程預(yù)分頻的主計(jì)數(shù)器.一個(gè)16位的帶可編程預(yù)分頻的模數(shù)向下計(jì)數(shù)器8個(gè)獨(dú)立的定時(shí)器通道,每個(gè)通道具備輸入捕捉和輸出比較功能4個(gè)8位脈沖累加器,也可設(shè)置成2個(gè)16位脈沖累加器.通過對(duì)寄存器編程可以實(shí)現(xiàn)不同的功能TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names

5、are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 3定時(shí)器結(jié)構(gòu)定時(shí)器結(jié)構(gòu)預(yù)分頻選擇 PR2:0M Clock1 2 4 8 16 32 64 128TCNT15.0DATA BUSPINRRRR1 計(jì)數(shù)器使能0 計(jì)數(shù)器禁止TEN TSWAI TSFRZ TFFCATSCR1 -定時(shí)器控制寄存器定時(shí)器控制寄存器RST: 0 0 0 0 0 0 0 0TCNT CLK.TENB0.B7 B8.B15R = Reserved$0006Address Offset $0004, 0

6、5$FFFE$FFFF$0000*TOF模塊時(shí)鐘模塊時(shí)鐘計(jì)數(shù)器寄存器計(jì)數(shù)器寄存器脈沖累加器脈沖累加器計(jì)時(shí)器溢出時(shí),對(duì)溢出標(biāo)志位置位,如允許中斷,則向CPU發(fā)出中斷請(qǐng)求TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respect

7、ive owners. Freescale Semiconductor, Inc. 2005.Slide 4定時(shí)器,預(yù)分頻,計(jì)數(shù)器定時(shí)器,預(yù)分頻,計(jì)數(shù)器寄存器:1. TCNT 16 位自由運(yùn)行/模計(jì)數(shù)器B15.B0RST: 0.0 Address Offset $0004, $00051 定時(shí)器溢出中斷使能0 定時(shí)器中斷禁止$000D3. TSCR2 RST: 0 0 0 0 0 0 0 0 1 定時(shí)器由OC7比較符合時(shí)復(fù)位0 定時(shí)器自由運(yùn)行TCRE - 允許使用PWM功能B7.B0TOI 0 0 0 TCRE PR2 PR1 PR02. TFLG2定時(shí)器溢出標(biāo)志位,寫 1 清零TOF 0 0

8、 0 0 0 0 0B7.B0RST: 0 0 0 0 0 0 0 0$000F標(biāo)志寄存器標(biāo)志寄存器除以1248163264128000011110101010100110011PR2 PR1 PR0 預(yù)分頻系數(shù)選擇預(yù)分頻系數(shù)選擇TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names a

9、re the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 5定時(shí)器編程步驟定時(shí)器編程步驟用途: 產(chǎn)生周期中斷初始化設(shè)定預(yù)分頻系數(shù)定時(shí)器溢出中斷使能定時(shí)器使能中斷函數(shù)清標(biāo)志位1.用戶自己的代碼void ECT_Init(void) TSCR2_PR = 7; /prescale factor is 8, bus clock/128=8Mhz/8 TSCR2_TOI = 1; /timer overflow interrupt enable TSCR1_TEN = 1; /timer e

10、nable#pragma CODE_SEG NON_BANKED#pragma TRAP_PROCvoid Int_TimerOverFlow(void) TFLG2_TOF = 1; /clear timer overflow flag /用戶自己的代碼 .#pragma CODE_SEG DEFAULT在PRM文件中,加入VECTOR ADDRESS 0 xFFDE Int_TimerOverFlowTMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale

11、logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 6輸出比較功能輸出比較功能16位自由運(yùn)行計(jì)數(shù)器16位輸出比較寄存器 比如:0 x5678 軟件可以修改引腳控制邏輯中斷請(qǐng)求OCxF狀態(tài)標(biāo)志位置位,當(dāng)比較發(fā)生時(shí)(值相等時(shí))OCxI中斷屏蔽(通過軟件使能) 共有8個(gè)輸出比較通道 每個(gè)通道有自己的向量表和控

12、制寄存器 在特定的時(shí)刻輸出一個(gè)信號(hào)在特定的時(shí)刻輸出一個(gè)信號(hào)當(dāng)比較寄存器的值和計(jì)數(shù)器的值相等時(shí),采取行動(dòng)比如:當(dāng)TCNT=0 x5678TCNTTOCxPinOCx比較比較比較器相等相等置位置位OROR清零清零翻轉(zhuǎn)翻轉(zhuǎn)TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the

13、property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 7輸出比較寄存器輸出比較寄存器 C7F C6F C5F C4F C3F C2F C1F C0FOM7OL7OM6OL6OM5OL5OM4OL41. TC7 TC02. TFLG13. TIE4. TCTL1 比較/捕捉標(biāo)志位寫 1清除中斷狀態(tài)標(biāo)志位 比較/捕捉屏蔽位 0 = 屏蔽中斷請(qǐng)求 1 = 中斷請(qǐng)求允許 OMXOLXAction on OCx00110101No Action OCxToggle OCxDrive OCx LODriv

14、e OCx HI輸出模式和輸出電平 (O7OC0)B6B5B4B3B7B2B1B05. TCTL2B6B5B4B3B7B2B1B0RST: 0 0 0 0 0 0 0 0$0008RST: 0 0 0 0 0 0 0 0RST: 0 0 0 0 0 0 0 0RST: 0 0 0 0 0 0 0 0$000C$000E$0009Address Offset$0010 - $0011 - -$001E - $001F16 位捕捉/比較寄存器 (TC7) 16 位捕捉/比較寄存器 (TC0) - C7F C6F C5F C4F C3F C2F C1F C0FB6B5B4B3B7B2B1B0OM3O

15、L3OM2OL2OM1OL1OM0OL0B6B5B4B3B7B2B1B0FOC7 FOC6 FOC5 FOC4 FOC3 FOC2 FOC1 FOC06. CFORCB7 B6 B5 B4 B3 B2 B1 B0RST: 0 0 0 0 0 0 0 0$0001TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or

16、 service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 8輸出比較輸出比較, OC7-OC0中斷: 清除中斷,對(duì)TFLG1 其中的OCxF寫1不要使用位操作使用OC7-OC0向量表復(fù)位條件: 自由運(yùn)行計(jì)數(shù)器(TCNT)被初始化為$0000,并且被禁止 輸出比較寄存器被初始化為$0000捕捉/比較引腳與比較功能斷開中斷被禁止標(biāo)志位被清零強(qiáng)制比較位被清零TMFreescale Semiconductor Confidential and Propriet

17、ary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 9輸出比較輸出比較, 通道通道7 OC7 (1 of 2)用途: 1、多個(gè)輸出比較引腳的控制2、通過2個(gè)輸出比較來控制1個(gè)引腳,可以輸出短脈沖在每個(gè)時(shí)鐘周期內(nèi),輸

18、出比較寄存器7和自由運(yùn)行的計(jì)數(shù)器進(jìn)行比較如果它們的值相等,則:1、中斷標(biāo)志位被置12、輸出引腳OC7-OC0的狀態(tài)被改變 或/和 產(chǎn)生中斷OC7可以影響多個(gè)引腳(OC7-OC0)當(dāng)OC7和OC7-OC0某個(gè)引腳的動(dòng)作有沖突時(shí),OC7的動(dòng)作將被執(zhí)行 TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or servic

19、e names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 10輸出比較輸出比較 7 (2 of 2) C7I C6F C5F C4F C3F C2F C1F C0F OC7M7 OC7M6 OC7M5 OC7M4 OC7M3 OC7M2 OC7M1 OC7M04. TIE 定時(shí)器中斷允許使能5. OC7M - OC7MASKB7.B0 1 - TC7 -16 位比較寄存器7. RST: 0 0 0 0 0 0 0 0RST: 0 0 0 0 0 0 0 0$0002

20、$000C C7F C6F C5F C4F C3F C2F C1F C0FRST: 0 0 0 0 0 0 0 0$000EB7.B02. TCNT - 16-位計(jì)數(shù)器B15.B0RST: 0.0$0004, $05B7.B03. TFLG1 標(biāo)志位 OC7D7 OC7D6 OC7D5 OC7D4 OC7D3 OC7D2 OC7D1 OC7D06. OC7D - OC7DATARST: 0 0 0 0 0 0 0 0$0003B7.B0OC7MASK 根據(jù)寄存器的設(shè)置,可以控制任意一路或全部輸出比較引腳 OC7DATA 當(dāng)OC7比較事件發(fā)生時(shí),引腳的邏輯電平TMFreescale Semico

21、nductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 11定時(shí)器溢出時(shí)電平翻轉(zhuǎn)定時(shí)器溢出時(shí)電平翻轉(zhuǎn)TOV7 TOV6 TOV5 TOV4 TOV3 T

22、OV2 TOV1 TOV0 TOVx 定時(shí)器溢出時(shí),電平翻轉(zhuǎn)只有當(dāng)通道被配置成輸出比較時(shí),才有效Address Offset $0007RST: 0.01. TTOV -定時(shí)器溢出時(shí)電平翻轉(zhuǎn)寄存器$000D2. TSCR2 定時(shí)器系統(tǒng)控制寄存器 RST: 0 0 0 0 0 0 0 0 B7.B0TOI 0 0 0 TCRE PR2 PR1 PR01 定時(shí)器由 OC7 比較事件發(fā)生來復(fù)位0 定時(shí)器自由運(yùn)行TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale

23、logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 12輸入捕捉輸入捕捉, IC7-IC0 (1 of 3)用途用途:1、測(cè)量事件發(fā)生的間隔時(shí)間、測(cè)量事件發(fā)生的間隔時(shí)間2、對(duì)實(shí)時(shí)時(shí)間進(jìn)行響應(yīng)、對(duì)實(shí)時(shí)時(shí)間進(jìn)行響應(yīng)輸入捕捉能感應(yīng)到引腳上的電平的變化輸入捕捉能感應(yīng)到引腳上的電平的變化如果發(fā)現(xiàn)電平變化,則:如果

24、發(fā)現(xiàn)電平變化,則:1、計(jì)數(shù)器的值被保存到到輸入捕捉寄存器中,狀態(tài)、計(jì)數(shù)器的值被保存到到輸入捕捉寄存器中,狀態(tài)標(biāo)志位被置標(biāo)志位被置12、如果中斷允許,則向、如果中斷允許,則向CPU發(fā)出中斷請(qǐng)求發(fā)出中斷請(qǐng)求TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the propert

25、y of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 13輸入捕捉功能輸入捕捉功能比較/捕捉 單元16位自由運(yùn)行計(jì)數(shù)器16位輸入捕捉鎖存器捕捉發(fā)生時(shí),狀態(tài)位置1向CPU發(fā)出中斷請(qǐng)求Edge沿選擇檢測(cè)ICxICxFICxI上升/下降沿可選中斷屏蔽當(dāng)外部事件發(fā)生時(shí),或外部信號(hào)輸入發(fā)生變化時(shí),記錄當(dāng)前時(shí)間TCNTTICx延時(shí)計(jì)數(shù)器 0 0 0 0 0 0 DLY1 DLY0Bit 7 6 5 4 3 2 1 0DLYCT 延時(shí)計(jì)數(shù)器控制寄存器DLY1:0 - Delay Counter Values 00 = D

26、isabled 01 = 256 M Clocks 10 = 512 M Clocks 11 = 1024 M ClocksAddress Offset $0029注: 如果輸入信號(hào)電平和跳變之前的電平相反時(shí),延時(shí)計(jì)數(shù)器在當(dāng)前時(shí)鐘計(jì)數(shù)時(shí)刻產(chǎn)生一個(gè)脈沖,它用來去除噪聲OROR16位保持寄存器應(yīng)用: ABS 剎車. 雷達(dá)測(cè)距,發(fā)動(dòng)機(jī)引腳 共有8個(gè)輸入捕捉通道 每個(gè)通道有自己的向量表和控制寄存器TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are

27、 trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 14輸入捕捉輸入捕捉, IC7-IC0 (2 of 3)B2B1B0EDGxB 輸入捕捉沿控制(IC7IC0)EDGxAICx EDGE0101無邊沿 ICx 禁止上升沿下降沿任何沿4. TCTL3 C7F C6F C5F C4F C3F C2F C1F C0FC7I

28、 C6I C5I C4I C3I C2I C1I C0I2. TFLG13. TMSK11. TC7 TC0EDG7B EDG7A EDG6B EDG6A EDG5B EDG5A EDG4B EDG4A5. TCTL4EDG3B EDG3A EDG2B EDG2A EDG1B EDG1A EDG0B EDG0AB6B5B4B3B7B2B1B0RST: 0 0 0 0 0 0 0 0RST: 0 0 0 0 0 0 0 0RST: 0 0 0 0 0 0 0 0RST: 0 0 0 0 0 0 0 0B6B5B4B3B7B2B1B0B6B5B4B3B7B2B1B0B6B5B4B3B7B2B1B0

29、$000E$000C$000A$000BAddress Offset$0010 - $0011 - -$001E - $001F16 位捕捉/比較寄存器 (TC7) 16 位捕捉比較寄存器 (TC0) - 比較/捕捉標(biāo)志位寫 1清除中斷狀態(tài)標(biāo)志位 比較/捕捉屏蔽位 0 = 屏蔽中斷請(qǐng)求 1 = 中斷請(qǐng)求允許 0011TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconducto

30、r, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 15輸入捕捉輸入捕捉/輸出比較選擇輸出比較選擇IOS7 IOS6 IOS5 IOS4 IOS3 IOS2 IOS1 IOS0TIOS 定時(shí)器輸入捕捉定時(shí)器輸入捕捉/輸出比較選擇寄存器輸出比較選擇寄存器 IOSx = 1 輸出比較功能 = 0 輸入捕捉功能RST: 0 0 0 0 0 0 0 0$0000B6B5B4B3B7B2B1B0TIM

31、ER 定時(shí)器使能1 計(jì)數(shù)器使能0 計(jì)數(shù)器禁止TSCR 定時(shí)器系統(tǒng)控制寄存器RST: 00$0006TEN TSWAI TSFRZ TFFCA Reserved TSWAI 在WAIT模式時(shí),定時(shí)器停止 0 = 不停止 1 = 停止TSBCK 在DEBUG模式時(shí), 定時(shí)器停止 0 = 不停止 1 = 停止TFFCA 定時(shí)器快速標(biāo)志位清除使能 0 = 定時(shí)器標(biāo)志位正常清零 1 = 輸入捕捉時(shí)讀取寄存器, 輸出比較時(shí)寫寄存器,可以對(duì)相應(yīng)通道標(biāo)志位清零TMFreescale Semiconductor Confidential and Proprietary Information. Freescal

32、e and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 16脈沖累加模式脈沖累加模式8 位計(jì)數(shù)器PA7/PAI 脈沖累加器輸入引腳 事件計(jì)數(shù)模式引腳作為計(jì)數(shù)器時(shí)鐘軟件選擇以什么沿來計(jì)數(shù)計(jì)數(shù)器溢出時(shí),產(chǎn)生中斷(可選)在PAI引腳每個(gè)主動(dòng)電平將產(chǎn)生中斷 8 位計(jì)數(shù)器PA7

33、/PAI 脈沖累加器輸入引腳 時(shí)間累加模式引腳作為計(jì)數(shù)器軟件選擇主動(dòng)電平作為門的輸入當(dāng)計(jì)數(shù)器溢出時(shí)產(chǎn)生中斷在使能的引腳上后面的邊緣時(shí)產(chǎn)生中斷 自由運(yùn)行E/64時(shí)鐘對(duì)事件計(jì)數(shù)模式,PEDGE 選擇哪個(gè)PAI的沿用來增加 PACNT寄存器對(duì)門累加模式,PEDGE選擇哪個(gè)PAI 狀態(tài)用來禁止計(jì)數(shù)(比如. PEDGE = 1 - 禁止計(jì)數(shù) 當(dāng)PAI = HI). TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Fr

34、eescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 17脈沖累加結(jié)構(gòu)脈沖累加結(jié)構(gòu)PINTCx PIN Logic DIV by 64Control Reg.+ 8/16 BIT CNTRHolding RegisterPOLARITYCONTROL PTxIRQDATABUS注 1: PTx 可以被用作脈沖累加,輸入捕捉或輸出比較這里 PTx = PT

35、0 - PT3SELECTED CLOCKDelayCounterEdgeDetector 0 0 0 0 0 0 DLY1 DLY0Bit 7 6 5 4 3 2 1 0DLYCT - Delay Counter Control RegisterDLY1:0 - Delay Counter Values 00 = Disabled 01 = 256 M Clocks 10 = 512 M Clocks 11 = 1024 M ClocksAddress Offset $0029注: 如果輸入信號(hào)電平和跳變之前的電平相反時(shí),延時(shí)計(jì)數(shù)器在當(dāng)前時(shí)鐘計(jì)數(shù)時(shí)刻產(chǎn)生一個(gè)脈沖,它用來去除噪聲TMFrees

36、cale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 18增強(qiáng)型捕捉增強(qiáng)型捕捉ECT比標(biāo)準(zhǔn)的比標(biāo)準(zhǔn)的TIM增強(qiáng)的特點(diǎn)增強(qiáng)的特點(diǎn)

37、4個(gè)輸入捕捉通道有16位緩沖寄存器 4個(gè)8位 / 2個(gè)16位脈沖累加器 16位帶4位預(yù)分頻的模數(shù)向下計(jì)數(shù)器 4個(gè)用戶選擇的延時(shí)計(jì)數(shù)器用來消除噪聲 主定時(shí)器預(yù)分頻擴(kuò)展至7位 隊(duì)列和鎖定模式 主定時(shí)器輸入捕捉寄存器保持寄存器外部事件外部事件拷貝拷貝拷貝拷貝拷貝拷貝讀取數(shù)據(jù)讀取數(shù)據(jù)讀取數(shù)據(jù)讀取數(shù)據(jù)外部事件外部事件TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, In

38、c. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 19模向下計(jì)數(shù)器模向下計(jì)數(shù)器二進(jìn)制向下計(jì)數(shù)器. 可以完全控制計(jì)數(shù)起始值 應(yīng)用于精確事件計(jì)時(shí)-用于產(chǎn)生周期性的標(biāo)志位和中斷主定時(shí)器單獨(dú)運(yùn)行。時(shí)鐘來自總線時(shí)鐘,并經(jīng)過預(yù)分頻??梢员辉O(shè)置為定時(shí)中斷或產(chǎn)生標(biāo)志位?;蜓b載初始值后向下計(jì)數(shù)到$0000。ParameterValueUnitsCrystal Frequency16MHzBus Frequency8M

39、HzBus Tick Time125.0000nSPeriodic Interrupt Time191uSBus Ticks Required1528.00TicksModulus Counter Prescaler4Modulus Counter Start Value382裝載向下計(jì)數(shù)至0執(zhí)行動(dòng)作執(zhí)行動(dòng)作TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, I

40、nc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 20ABS 應(yīng)用舉例應(yīng)用舉例PT0PT1PT2SENSOR 1SENSOR 2SENSOR 3SENSOR 4PB1PB2PB3PB4BRAKEFLUIDPUMPSYSTEMSIGNALCONDITIONINGLOGIC IC/PASIGNALCONDITIONINGLOGICSIGNALCONDITIONINGLOGICSIGNALCONDITI

41、ONINGLOGICPT3左前輪左前輪 右前輪右前輪 左后輪左后輪右后輪右后輪HCS12TIMER 定時(shí)器輸入捕捉測(cè)量車輪轉(zhuǎn)速 發(fā)送命令到剎車壓力調(diào)節(jié)閥來調(diào)節(jié)壓力 IC/PA IC/PA IC/PA如果左右輪速脈沖周期不等則則調(diào)節(jié)電磁閥調(diào)節(jié)電磁閥TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service

42、 names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 21低功耗模式低功耗模式TSCR 定時(shí)器系統(tǒng)控制寄存器RST: 00$0006TEN TSWAI TSFRZ TFFCA Reserved TSWAI 在WAIT模式時(shí),定時(shí)器停止 0 = 不停止 1 = 停止TSBCK 在DEBUG模式時(shí), 定時(shí)器停止 0 = 不停止 1 = 停止TFFCA 定時(shí)器快速標(biāo)志位清除使能 0 = 定時(shí)器標(biāo)志位正常清零 1 = 輸入捕捉時(shí)讀取寄存器, 輸出比較時(shí)寫寄存器,可以對(duì)相應(yīng)

43、通道標(biāo)志位清零TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 22PULSE WIDTH MODULATIO

44、N(PWM)脈寬調(diào)制模塊脈寬調(diào)制模塊TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 23什么是什么是PWM?

45、periodonTTRatio Width PulseTonToffTperiodAverage0 %10 %50 %90 %99 %應(yīng)用: D/A轉(zhuǎn)換 馬達(dá)控制 音調(diào)生成 正弦波生成占空比占空比=高電平時(shí)間高電平時(shí)間/周期周期 =Ton/TperiodTMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or ser

46、vice names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 24PWM信號(hào)的產(chǎn)生信號(hào)的產(chǎn)生(邊緣對(duì)齊邊緣對(duì)齊)開始周期 TPWMTPWM占空比 TDutyPWMDTYxPWMPERxPWMPERxfClock, TClock8-bit CounterPWMCNTx時(shí)鐘8-bit Compare =PWMDTYx8-bit Compare =PWMPERx0 x000 x00ResetPin當(dāng)當(dāng)8位計(jì)數(shù)器的值等于位計(jì)數(shù)器的值等于PWMDTY(duty cycle寄

47、存器寄存器)時(shí),電平從有效跳到無效;時(shí),電平從有效跳到無效;當(dāng)當(dāng)8位計(jì)數(shù)器的值等于位計(jì)數(shù)器的值等于PWMPER(周期寄存器)時(shí),電平從無效跳到有效,然(周期寄存器)時(shí),電平從無效跳到有效,然后計(jì)數(shù)器清后計(jì)數(shù)器清0,重新開始計(jì)數(shù),重新開始計(jì)數(shù)TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service na

48、mes are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 25PWM 模塊特點(diǎn)模塊特點(diǎn) 8個(gè)帶周期占空比可程控的PWM獨(dú)立通道 4個(gè)可程控選擇的時(shí)鐘源 每個(gè)PWM通道有專用的計(jì)數(shù)器 PWM每個(gè)通道脈沖極性可以選擇 每個(gè)PWM通道可使能/禁止 周期和占空比雙緩沖 每個(gè)通道有中心對(duì)齊和邊緣對(duì)齊方式 分辨率: 8位 (8通道), 16位 (4通道) 帶中斷功能的緊急切斷 工作模式TMFreescale Semiconductor Confidential and Propriet

49、ary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 26PWM 結(jié)構(gòu)框圖結(jié)構(gòu)框圖通道通道 7周期和占空比計(jì)數(shù)器通道通道 6周期和占空比計(jì)數(shù)器.通道通道 0周期和占空比計(jì)數(shù)器管腳使能選擇極性選擇對(duì)齊方式選擇管腳管腳T

50、MFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 27PWM 初始化步驟初始化步驟禁止PWM Disable P

51、WMPWME選擇時(shí)鐘 Select clock (prescaler and scale) for the PWM PWMPRCLK, PWMSCLA, PWMSCLB, PWMCLK選擇極性 Select polarityPWMPOL選擇對(duì)齊模式 Select center or left aligned modePWMCAE對(duì)占空比和周期編程Program duty cycle and periodPWMDTYx, PWMPERx使能PWM通道 Enable used PWM channelsPWMETMFreescale Semiconductor Confidential and Pr

52、oprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 28PWM 時(shí)鐘選擇時(shí)鐘選擇 (1 of 4)Clock A (Ch 0, Ch 1, Ch 4, Ch 5)Clock SA (scaled A;

53、Ch 0, Ch 1, Ch 4, Ch 5)Clock B (Ch 2, Ch 3, Ch 6, Ch 7)Clock SB (scaled B; Ch 2, Ch 3, Ch 6, Ch 7)4個(gè)時(shí)鐘源:Bus ClockDivide by Prescaler Taps:248163264128預(yù)分頻PWMPRCLK $_03Clock SAClock SBClock AFurther Division of the clock:2468.512Clock BFurther Division of the clock:2468.512PWMSCLA $_08PWMSCLB $_09分頻TM

54、Freescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 29PWM 時(shí)鐘選擇時(shí)鐘選擇 預(yù)分頻寄存器預(yù)分頻寄存器 (2 o

55、f 4)0PCKB2 PCKB1 PCKB00PCKA2 PCKA1 PCKA0RWReset: 00000000= Unimplemented or ReservedPWMPRCLK $_03PCKx2PCKx1PCKx0Value of Clock x000Bus Clock001Bus Clock / 2010Bus Clock / 4011Bus Clock / 8100Bus Clock / 16101Bus Clock / 32110Bus Clock / 64111Bus Clock / 128可在任意時(shí)刻讀寫!x = A or B設(shè)置 PRESCALE 寄存器:PWMPRCLK

56、 = 0 x22;/ B= Bus/4, A = Bus/4PWMPRCLK = 0 x07;/ B = Bus, A = Bus/128Software ExamplesBit 0Bit 1Bit 2Bit 3Bit 4Bit 5Bit 6Bit 0TMFreescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or serv

57、ice names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 30PWM 時(shí)鐘選擇時(shí)鐘選擇 分頻寄存器分頻寄存器(3 of 4)總線時(shí)鐘fBusDivide by Prescaler Taps:2481632641288-Bit Down CounterBit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0PWMSCLx分頻值SxClockxClockPWMSCLxPWMSCLxxClockSxClock_2_2_PWMSCL

58、x = $00 PWMSCLx value is 256可在任意時(shí)刻讀寫!x = A or B/ 2Clock SxClock xClock x = fBus / PWMPRCLKCount = 1PWMPRCLK $_03PWMSCLB $_09PWMSCLA $_08例如:要求: Clock Sx = 1 kHz總線時(shí)鐘 = 16 MHzPrescaler = 128 Prescaler = 64Clock x = 125 kHzClock x = 250 kHzPWMSCLx = 63 PWMSCLx = 125 Clock Sx = 992 HzClock Sx = 1000 HzTM

59、Freescale Semiconductor Confidential and Proprietary Information. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2005.Slide 31PWM 時(shí)鐘選擇寄存器時(shí)鐘選擇寄存器 (4 of 4)PCL

60、K6 PCLK5 PCLK4 PCLK3 PCLK2 PCLK1 PCLK0RWReset: 00000000PWMCLK $_02PCLK7選擇時(shí)鐘源:PCLK0 = 1;/ SA is source of ch 0PCLK6 = 0;/ B is source of ch 6PWMCLK = 0 x11; / all channels軟件示例軟件示例Bit 0Bit 1Bit 2Bit 3Bit 4Bit 5Bit 6Bit 0PCLK5 通道 5時(shí)鐘選擇 1 =時(shí)鐘源為SA 0 =時(shí)鐘源為APCLK4 通道 4時(shí)鐘選擇 1 =時(shí)鐘源為SA 0 =時(shí)鐘源為APCLK3 通道 3時(shí)鐘選擇 1

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論