<strong id="0toem"><dl id="0toem"></dl></strong><b id="0toem"><menuitem id="0toem"></menuitem></b>

      <b id="0toem"><menuitem id="0toem"></menuitem></b>
    1. <code id="0toem"><abbr id="0toem"></abbr></code>
      <strong id="0toem"><dl id="0toem"></dl></strong>
      <kbd id="0toem"></kbd>
              1. <code id="0toem"></code>
                <th id="0toem"><progress id="0toem"></progress></th><strong id="0toem"><form id="0toem"></form></strong>

                <th id="0toem"></th>
              2. 131 1300 0010
                其他
                當前位置: 首頁>> 元件技術>>其他>>
              3. 導航欄目
              4. 二極管
              5. 整流橋
              6. MOS管
              7. 其他
              8. 如何將單片機的TMR用作定時器和計數器使用
                如何將單片機的TMR用作定時器和計數器使用
              9. 如何將單片機的TMR用作定時器和計數器使用
              10.   發(fā)布日期: 2019-09-12  瀏覽次數: 1,738

                TMR0為8位寬,有一個可選的預分頻器,用于通用目的,可用于定時和計數。

                TMR1為16位寬,附帶一個可編程的預分頻器和一個可選的低頻時基振蕩器,適合與CPP模塊配合使用來實現(xiàn)輸入捕扣或輸出比較功能,也可于定時和計數。

                 

                TMR2為8位寬,附帶一個配合使用來實現(xiàn)PWM脈沖寬度調制信號的產生,只能用于定時。

                TMR0用作定時器時,定時器時鐘=系統(tǒng)時鐘/4;

                如何將單片機的TMR用作定時器和計數器使用

                寫TMR0時,會產生2個周期的的延時,如果不使用前置分頻器,可通過設置

                初值進行補償。

                例如 需要定時200個時鐘周期時,TMR0 = 256 -200 + 2= 58

                OPTION_REG:

                bit5 T0CS:TMR0 Clock Source Select bit

                1 = TransiTIon on T0CKI pin

                0 = Internal instrucTIon cycle clock(CLKO)

                bit 4 T0SE:TMR0 Source Edge Select bit

                1 = Increment on high-to-low transiTIon on T0CKI pin

                0 = Increment on low-to-high transiTIon on T0CKI pin

                bit 3 PSA:Prescaler Assignment bit

                1 = Prescaler is assigned to the WDT

                0 = Prescaler is assigned to the Timer0 module

                bit2-0 PS2:PS0:Prescaler Rate Select bits

                任何時候對TMR0寄存器進行一次寫操作后,其計數功能將被禁止2個指令周期。

                給大家一個意見:如果想用TMR0實現(xiàn)精確的定時,一旦用了預分頻器后就不要對TMR0做任何寫操作。

                注意:在中斷服務程序中查詢TMR0中斷時,既要查詢T0IE位,還要查詢T0IF位。
                來源;21ic


              11. ·上一篇:
                ·下一篇:
              12. 其他關聯(lián)資訊
                深圳市日月辰科技有限公司
                地址:深圳市寶安區(qū)松崗鎮(zhèn)潭頭第二工業(yè)城A區(qū)27棟3樓
                電話:0755-2955 6626
                傳真:0755-2978 1585
                手機:131 1300 0010
                郵箱:[email protected]

                深圳市日月辰科技有限公司 版權所有:Copyright?2010-2023 www.xydibang.com 電話:13113000010 粵ICP備2021111333號
                <strong id="0toem"><dl id="0toem"></dl></strong><b id="0toem"><menuitem id="0toem"></menuitem></b>

                    <b id="0toem"><menuitem id="0toem"></menuitem></b>
                  1. <code id="0toem"><abbr id="0toem"></abbr></code>
                    <strong id="0toem"><dl id="0toem"></dl></strong>
                    <kbd id="0toem"></kbd>
                            1. <code id="0toem"></code>
                              <th id="0toem"><progress id="0toem"></progress></th><strong id="0toem"><form id="0toem"></form></strong>

                              <th id="0toem"></th>
                            2. 五月丁香网色 | 黄色成人视频在线免费观看 | 人妻人人摸 | 欧美成人一级 | 俺也去在线视频 |