# PIC24FJ128GA106_timer1 [PIC24FJ128GA106 datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/PIC24FJ256GA110-Family-Data-Sheet-DS30009905F.pdf) ###### tags:`PIC24FJ128GA106` <style> .red {color:red;} </style> ## IC封裝與腳位  ## 介紹 :::info Timer1模塊是一個16位定時器,可以用作真實時鐘(RTC)的時間計數器,或者用作自由運行的間隔定時器/計數器。\ \ Timer1可以在三種模式下運行: * 16位定時器 * 16位同步計數器 * 16位異步計數器 \ Timer1還支持以下功能: * 定時器門操作 * 可選的預分頻器設置 * CPU空閒模式下的定時器操作 * 16-中斷 位週期寄存器匹配或外部門信號的下降沿 ::: :::danger 配置Timer1的操作: 1. TON = 1 2. 使用TCKPS [1:0]位選擇定時器預分頻比 3. 使用TCS和TGATE位設置時鐘和門控模式 4. 同步:TSYNC = 1 / 非同步:YSYNC = 0 6. 將定時器週期值加載到PR1寄存器中 7. 使用中斷:T1IE=1 & T1IP [2:0]設置中斷優先級 ::: ## 寫入控制暫存器  ### <span class ="red">TON</span>:Timer1開關位 1 =啟動16位Timer1 0 =停止16位Timer1 ### <span class ="red">TSIDL</span>:在空閒模式下停止位 1 =當設備進入空閒模式時停止模塊運行 0 =在空閒模式下繼續模塊運行 ### <span class ="red">TGATE</span>:Timer1閘控時間累加使能位 當TCS = 1時: 該位被忽略 \ 當TCS = 0時: 1 =智能門控時間累積 0 =禁止門控時間累積 ### <span class ="red">TCKPS[1:0]</span>:Timer1輸入時鐘預分頻選擇位 11 = 1:256 10 = 1:64 01 = 1:8 00 = 1:1 ### <span class ="red">TSYNC</span>:Timer1外部時鐘輸入同步選擇位 當TCS = 1時: 1 =同步外部時鐘輸入 0 =不同步外部時鐘輸入 \ 當TCS = 0時: 該位被忽略 ### <span class ="red">TCS</span>:Timer1時鐘源選擇位 1 =來自T1CK引腳的外部時鐘(在上升沿) 0 =內部時鐘(FOSC / 2) \ \  ### <span class ="red">T1IE</span>:Timer1中斷允許位 1 =允許中斷請求 0 =未允許中斷請求 \ \  ### <span class ="red">T1IF</span>:Timer1中斷標誌狀態位 1 =發生中斷請求 0 =未發生中斷請求 <!-- ## 使用方式 ### 接線方式 畫張圖拉 ### 要來寫程式了喔 DATASHEET裡的波型圖 ### 程式說明 ```c= 用這個啦 ``` ## 注意 -->
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up