opentimer45.c

来自「基於 c51/8051 的 nand Flash Memory HY27US08」· C语言 代码 · 共 31 行

C
31
字号
#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 + =
减小字号Ctrl + -
显示快捷键?