📄 timer.h
字号:
VISIBLE void apd_TIMERSetPrescale(APD_TIMER_NUM timer_num, APD_TIMER_PRESCALE_TYPE prescale);
VISIBLE void apd_StartTimer(APD_TIMER_NUM timer_num,unsigned long int_src);
VISIBLE void apd_StopTimer(APD_TIMER_NUM timer_num,unsigned long int_src);
/******************************************************************************
@@
@@ [Name] : apd_TIMEREnable
@@
@@ [Summary] : This function enables the specified timer hardware.
@@
@@ [Argument] : timer_num: specify which timer/counter
@@ APD_TIMER0 for timer 0
@@ APD_TIMER1 for timer 1
@@ APD_TIMER2 for timer 2
@@ APD_TIMER3 for timer 3 (For LH79532 and LH79533 only)
@@
@@ [Return] : None
@@
@@ [Desc] : Enables the specified timer hardware.
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMEREnable(timer_num) \
apd_TIMERSetControlRegBit(timer_num, APD_TIMER_ENABLE_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMERDisable
@@
@@ [Summary] : This function disables the specified timer hardware.
@@
@@ [Argument] : timer_num: specify which timer/counter
@@ APD_TIMER0 for timer 0
@@ APD_TIMER1 for timer 1
@@ APD_TIMER2 for timer 2
@@ APD_TIMER3 for timer 3 (For LH79532 and LH79533 only)
@@
@@ [Return] : None
@@
@@ [Desc] : Disables the specified timer hardware.
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMERDisable(timer_num) \
apd_TIMERClrControlRegBit(timer_num, APD_TIMER_ENABLE_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMERSetPeriodicMode
@@
@@ [Summary] : This function sets the selected timer to periodic mode
@@
@@ [Argument] : timer_num: specify which timer/counter
@@ APD_TIMER0 for timer 0
@@ APD_TIMER1 for timer 1
@@ APD_TIMER2 for timer 2
@@ APD_TIMER3 for timer 3 (For LH79532 and LH79533 only)
@@
@@ [Return] : None
@@
@@ [Desc] : Sets the specified timer hardware to periodic mode.
@@
@@ [Note] : APD_TIMER3 is only avalible for LH79532 and LH79533.
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMERSetPeriodicMode(timer_num) \
apd_TIMERSetControlRegBit(timer_num, APD_TIMER_MODE_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMERSetFreeRunningMode
@@
@@ [Summary] : This function sets the selected timer to free running mode
@@
@@ [Argument] : timer_num: specify which timer/counter
@@ APD_TIMER0 for timer 0
@@ APD_TIMER1 for timer 1
@@ APD_TIMER2 for timer 2
@@ APD_TIMER3 for timer 3 (For LH79532 and LH79533 only)
@@
@@ [Return] : None
@@
@@ [Desc] : Sets the specified timer hardware to free running mode.
@@
@@ [Note] : APD_TIMER3 is only avalible for LH79532 and LH79533.
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMERSetFreeRunningMode(timer_num) \
apd_TIMERClrControlRegBit(timer_num, APD_TIMER_MODE_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMEREnableCarry
@@
@@ [Summary] : This function enables carry from the selected timer - 1.
@@
@@ [Argument] : timer_num: specify which timer/counter
@@ APD_TIMER0 for timer 0
@@ APD_TIMER1 for timer 1
@@ APD_TIMER2 for timer 2
@@ APD_TIMER3 for timer 3 (For LH79532 and LH79533 only)
@@
@@ [Return] : None
@@
@@ [Desc] : Enable carry from the selected timer - 1. Used to cascade the
@@ timers to realise 32/48-bits timers. For LH79532 and LH79533
@@ can be used to cascade up to 64 bits.
@@ 32-bit counter can be realised by cascading:
@@ ~ For LH79531: timer 1 to timer 0 OR timer 2 to timer 1
@@ ~ For LH79532 and LH79533: timer 1 to timer 0 OR
@@ timer 2 to timer 1 OR timer 3 to timer 2
@@ 48-bit counter can be realised by cascading
@@ ~ For LH79531: timer 1 to timer 0 AND timer 2 to timer 1
@@ ~ For LH79532 and LH79533: timer 1 to timer 0 AND timer 2 to timer 1
@@ OR timer 2 to timer 1 AND timer 3 to timer 2
@@ 64-bit counter can be realised by cascading
@@ ~ For LH79532 and LH79533: timer 1 to timer 0 AND timer 2 to timer 1 AND timer 3 to timer 2
@@
@@ [Note] : (1)For LH79531: Valid only for CT1 or CT2
@@ (2)For LH79532 and LH79533: Valid only for CT1, CT2 or CT3
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMEREnableCarry(timer_num) \
apd_TIMERSetControlRegBit(timer_num, APD_TIMER_CI_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMERDisableCarry
@@
@@ [Summary] : This function disables carry from the selected timer - 1.
@@
@@ [Argument] : timer_num: specify which timer/counter
@@ APD_TIMER1 for timer 1
@@ APD_TIMER2 for timer 2
@@ APD_TIMER3 for timer 3 (For LH79532 and LH79533 only)
@@
@@ [Return] : None
@@
@@ [Desc] : Disables carry from the selected timer - 1.
@@ The selected timer will become an independent 16-bit timer.
@@
@@ [Note] : (1)For LH79531: Valid only for CT1 or CT2
@@ (2)For LH79532 and LH79533: Valid only for CT1, CT2 or CT3
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMERDisableCarry(timer_num) \
apd_TIMERClrControlRegBit(timer_num, APD_TIMER_CI_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMER3SetExtClk
@@
@@ [Summary] : This function sets timer 3 of LH79532 or LH79533 to use external clock
@@
@@ [Argument] : None
@@
@@ [Return] : None
@@
@@ [Desc] : Sets timer 3 of LH79532 or LH79533 to use external clock
@@
@@ [Note] : For LH79532 and LH79533: Only timer 3 can choose to use internal or external clock
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMER3SetExtClk() \
apd_TIMERSetControlRegBit(APD_TIMER3, APD_TIMER_X_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMER3SetIntClk
@@
@@ [Summary] : This function sets timer 2 of LH79532 or LH79533 to use internal clock
@@
@@ [Argument] : None
@@
@@ [Return] : None
@@
@@ [Desc] : Sets timer 3 of LH79532 or LH79533 to use internal clock
@@
@@ [Note] : For LH79532 and LH79533: Only timer 3 can chose to use internal or external clock
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMER3SetIntClk() \
apd_TIMERClrControlRegBit(APD_TIMER3, APD_TIMER_X_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMER3SetNormalOp
@@
@@ [Summary] : This function sets timer 3 of LH79532 or LH79533 to normal operation
@@
@@ [Argument] : None
@@
@@ [Return] : None
@@
@@ [Desc] : Sets timer 3 of LH79532 or LH79533 to normal operation
@@
@@ [Note] : For LH79532 and LH79533: Only valid for timer 3. Timer 0,1 and 2 always set to normal operation.
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMER3SetNormalOp() \
apd_TIMERClrControlRegBit(APD_TIMER3, APD_TIMER_CLEAR_BIT)
/******************************************************************************
@@
@@ [Name] : apd_TIMER3TrackExtClk
@@
@@ [Summary] : This function set timer 3 of LH79532 or LH79533 to track external clock.
@@
@@ [Argument] : None
@@
@@ [Return] : None
@@
@@ [Desc] : Set timer 3 of LH79532 or LH79533 to track number of external clocks with respect to internal clock.
@@
@@ [Note] : For LH79532 and LH79533: Only valid for timer3.
@@ Timer 0, 1 and 2 cannot operate this special feature.
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
#define apd_TIMER3TrackExtClk() \
apd_TIMERSetControlRegBit(APD_TIMER3, APD_TIMER_CLEAR_BIT)
/*-------------------------- Global context - END --------------------------*/
#undef VISIBLE
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -