📄 opentimer45.c
字号:
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include <timer.h>
/* These devices support Timers 4 and 5 */
#if defined(_TIMER4) && defined(_TIMER5)
/********************************************************************
* Function Name: OpenTimer45 *
* Description: This routine configures the timer control *
* register and timer period register. *
* Parameters: config: bit definitions to configure Timer4 *
* and timer5 period to timer period register *
* Return Value: None *
********************************************************************/
void OpenTimer45(unsigned int config,unsigned long period)
{
TMR4 = 0; /* Reset Timer4 to 0x0000 */
TMR5 = 0; /* Reset Timer5 to 0x0000 */
PR4 = period; /* assigning Period to Timer period register */
PR5 = period>>16; /* Period to PR4 and PR5 Register */
T4CON = config; /* configure timer control reg */
T4CONbits.T32 = 1;
}
#else
#warning "Does not build on this target"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -