📄 opentimer5.c
字号:
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include <timer.h>
/* These devices support Timer 5 */
#ifdef _TIMER5
/*******************************************************************************
Function Prototype : void OpenTimer5(unsigned int config,unsigned int period)
Include : timer.h
Description : This function configures the 16-bit timer module.
Arguments : config - This contains the parameters to be configured in
the T5CON register as defined below
Timer Module On/Off
T5_ON
T5_OFF
Timer Module Idle mode On/Off
T5_IDLE_CON
T5_IDLE_STOP
Timer Gate time accumulation enable
T5_GATE_ON
T5_GATE_OFF
Timer prescaler
T5_PS_1_1
T5_PS_1_8
T5_PS_1_64
T5_PS_1_256
Timer Synchronous clock enable
T5_SYNC_EXT_ON
T5_SYNC_EXT_OFF
Timer clock source
T5_SOURCE_EXT
T5_SOURCE_INT
period - This contains the period match value to be stored
into the PR register
Return Value : None
Remarks : This function configures the 16-bit Timer Control register and
sets the period match value into the PR register.
**********************************************************************************/
void OpenTimer5(unsigned int config,unsigned int period)
{
TMR5 = 0; /* Reset Timer5 to 0x0000 */
PR5 = period; /* Assigning Period to Timer period register.*/
T5CON = config; /* configure timer control reg */
}
#else
#warning "Does not build on this target"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -