📄 timer_config.h
字号:
#define TM01_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
/* external count clock only*/
#define TM01_PRM0nValue TM01_Clock
#define TM01_CRC0nValue TM0n_CRC0n_CR00nMode_Compare
/* Interrupt settings */
#define TM01_INTTM001 1
#define TM01_INTTM011 0
#elif TM01_SquareOut==1
/*
***************************************
** TM01 squarewave output
**
** user set square width = 0.01s
***************************************
*/
/* Count clock and compare value */
/* Use register bit macro
TM0n_PRM0n_CountClock_Internal0 : fprs or
TM0n_PRM0n_CountClock_Internal1 : fprs/2^4 or
TM0n_PRM0n_CountClock_Internal2 : fprs/2^6 or
TM0n_PRM0n_CountClock_TI00nEdge
TM0n_PRM0n_TI00nEdge_Falling or
TM0n_PRM0n_TI01nEdge_Rising or
TM0n_PRM0n_TI01nEdge_Both
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM01_Clock TM0n_PRM0n_CountClock_Internal1
/*
Value range : 0x0001 - 0xffff
Square width = (CR00n_value + 1) * count_clock
*/
#define TM01_CR00nValue 0x1387
#define TM01_CR01nValue 0xffff
/* Register settings */
#define TM01_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
#define TM01_PRM0nValue TM01_Clock
#define TM01_CRC0nValue TM0n_CRC0n_CR00nMode_Compare
#define TM01_TOC0nValue /* Value selection
TM0n_TOC0n_TO0nOut_NoChange
TM0n_TOC0n_TO0nOut_Clear0
TM0n_TOC0n_TO0nOut_Set1
*/\
TM0n_TOC0n_TO0nOut_Clear0|\
TM0n_TOC0n_TO0nReverseByCR00n_Enable|\
TM0n_TOC0n_TO0nOut_Enable
/* Interrupt settings */
#define TM01_INTTM001 0
#define TM01_INTTM011 0
#elif TM01_PPGOut==1
/*
***************************************
** TM01 PPG output
**
** user set cycle = 0.006s, duty = 60%
***************************************
*/
/* Count clock and compare value */
/* Use register bit macro
TM0n_PRM0n_CountClock_Internal0 : fprs or
TM0n_PRM0n_CountClock_Internal1 : fprs/2^4 or
TM0n_PRM0n_CountClock_Internal2 : fprs/2^6 or
TM0n_PRM0n_CountClock_TI00nEdge
TM0n_PRM0n_TI00nEdge_Falling or
TM0n_PRM0n_TI01nEdge_Rising or
TM0n_PRM0n_TI01nEdge_Both
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM01_Clock TM0n_PRM0n_CountClock_Internal0
/*
Value range : 0x0001 - 0xffff
Pulse cycle = (CR00n_value + 1) * count_clock
Duty = (CR01n_value + 1) / (CR00n_value + 1)
CR01n_value < CR00n_value
*/
#define TM01_CR00nValue 0xbb7f
#define TM01_CR01nValue 0x707f
/* Register settings */
#define TM01_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
#define TM01_PRM0nValue TM01_Clock
#define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Compare|\
TM0n_CRC0n_CR00nMode_Compare
#define TM01_TOC0nValue TM0n_TOC0n_OneshotMode_Successive|\
TM0n_TOC0n_ReverseTO0nByCR01n_Enable|\
/* Value selection
TM0n_TOC0n_TO0nOut_NoChange
TM0n_TOC0n_TO0nOut_Clear0
TM0n_TOC0n_TO0nOut_Set1
*/\
TM0n_TOC0n_TO0nOut_Clear0|\
TM0n_TOC0n_TO0nReverseByCR00n_Enable|\
TM0n_TOC0n_TO0nOut_Enable
/* Interrupt settings */
#define TM01_INTTM001 0
#define TM01_INTTM011 0
#elif TM01_OneshotOut==1
/*
***************************************
** TM01 oneshot output
**
** user set delay = 0.02s, width = 0.01s
***************************************
*/
/* Count clock and compare value */
/* Use register bit macro
TM0n_PRM0n_CountClock_Internal0 : fprs or
TM0n_PRM0n_CountClock_Internal1 : fprs/2^4 or
TM0n_PRM0n_CountClock_Internal2 : fprs/2^6 or
TM0n_PRM0n_CountClock_TI00nEdge(Note : software trigger only)
TM0n_PRM0n_TI00nEdge_Falling or
TM0n_PRM0n_TI01nEdge_Rising or
TM0n_PRM0n_TI01nEdge_Both
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM01_Clock TM0n_PRM0n_CountClock_Internal1
/*
Value range : 0x0001 - 0xffff
Delay time = (CR01n_value + 1) * count_clock
Pulse width = (CR00n_value - CR01n_value) * count_clock
CR01n_value < CR00n_value
*/
#define TM01_CR00nValue 0x3a97
#define TM01_CR01nValue 0x270f
/* Register settings */
/* Value selection
TM0n_TMC0n_Operation_FreeRunning : software trigger
TM0n_TMC0n_Operation_ClearByTI00nEdge : External trigger
*/
#define TM01_TMC0nValue TM0n_TMC0n_Operation_FreeRunning
/* Note : If use external trigger, use internal count clock only */
#define TM01_PRM0nValue TM01_Clock|\
/* Use register bit macro
TM0n_PRM0n_CountClock_TI00nEdge
TM0n_PRM0n_TI00nEdge_Falling or
TM0n_PRM0n_TI01nEdge_Rising or
TM0n_PRM0n_TI01nEdge_Both
Note : External trigger set only
*/\
TM0n_PRM0n_TI00nEdge_Falling
#define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Compare|\
TM0n_CRC0n_CR00nMode_Compare
#define TM01_TOC0nValue TM0n_TOC0n_OneshotMode_Oneshot|\
TM0n_TOC0n_ReverseTO0nByCR01n_Enable|\
/* Value selection
TM0n_TOC0n_TO0nOut_NoChange
TM0n_TOC0n_TO0nOut_Clear0
TM0n_TOC0n_TO0nOut_Set1
*/\
TM0n_TOC0n_TO0nOut_Clear0|\
TM0n_TOC0n_TO0nReverseByCR00n_Enable|\
TM0n_TOC0n_TO0nOut_Enable
/* Interrupt settings */
#define TM01_INTTM001 0
#define TM01_INTTM011 0
#elif TM01_PulseMeasurement==1
/*
***************************************
** TM01 pulse measurement
**
** user set mode =
***************************************
*/
/* Count clock */
/* Use register bit macro
TM0n_PRM0n_CountClock_Internal0 : fprs or
TM0n_PRM0n_CountClock_Internal1 : fprs/2^4 or
TM0n_PRM0n_CountClock_Internal2 : fprs/2^6 or
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM01_Clock TM0n_PRM0n_CountClock_Internal0
#if TM01_Pulse_TI00nAndTI01nFreeRunning==1
/* Register settings */
#define TM01_TMC0nValue TM0n_TMC0n_Operation_FreeRunning
#define TM01_PRM0nValue TM0n_PRM0n_TI01nEdge_Both|\
TM0n_PRM0n_TI00nEdge_Both|\
TM01_Clock /* internal count clock only */
#define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Capture|\
TM0n_CRC0n_CR00nMode_Capture
/* Interrupt settings */
#define TM01_INTTM001 1
#define TM01_INTTM011 1
#elif TM01_Pulse_TI00nFreeRunning==1
/* Register settings */
#define TM01_TMC0nValue TM0n_TMC0n_Operation_FreeRunning
#define TM01_PRM0nValue TM0n_PRM0n_TI01nEdge_Rising|\
TM0n_PRM0n_TI00nEdge_Rising|\
TM01_Clock /* internal count clock only */
#define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Capture|\
TM0n_CRC0n_CR00nTrigger_TI00nEdgeReverse|\
TM0n_CRC0n_CR00nMode_Capture
/* Interrupt settings */
#define TM01_INTTM001 0
#define TM01_INTTM011 1
#elif TM01_Pulse_TI00nRestart==1
/* Register settings */
#define TM01_TMC0nValue TM0n_TMC0n_Operation_ClearByTI00nEdge
#define TM01_PRM0nValue TM0n_PRM0n_TI01nEdge_Rising|\
TM0n_PRM0n_TI00nEdge_Rising|\
TM01_Clock /* internal count clock only */
#define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Capture|\
TM0n_CRC0n_CR00nTrigger_TI00nEdgeReverse|\
TM0n_CRC0n_CR00nMode_Capture
/* Interrupt settings */
#define TM01_INTTM001 0
#define TM01_INTTM011 1
#endif
#else /*not use*/
/* Interrupt settings */
#define TM01_INTTM001 0
#define TM01_INTTM011 0
#endif
/*
***************************************
** TM50 configure
**
** Please set operation mode here
***************************************
*/
/* if no use set nouse = 1, if use some function set function = 1 */
#define TM50_NotUse 1
#define TM50_Interval 0
#define TM50_ExternalEvent 0
#define TM50_SquareOut 0
#define TM50_PWMOut 0
#if TM50_Interval==1
/*
***************************************
** TM50 interval
**
** user set interval time = 0.25s
***************************************
*/
/* Count clock and compare value */
/* Use register bit macro
TM5n_TCL5n_CountClock_TI5nFalling
TM5n_TCL5n_CountClock_TI5nRising
TM5n_TCL5n_CountClock_Internal0 : fprs
TM5n_TCL5n_CountClock_Internal1 : fprs/2
TM5n_TCL5n_CountClock_Internal2 : fprs/2^2
TM5n_TCL5n_CountClock_Internal3 : fprs/2^6
TM5n_TCL5n_CountClock_Internal4 : fprs/2^8
TM5n_TCL5n_CountClock_Internal5 : fprs/2^13
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM50_Clock TM5n_TCL5n_CountClock_Internal5
/*
Value range : 0x00 - 0xff
Interval time = (CR5n_value + 1) * count_clock
*/
#define TM50_CR5nValue 0xf3
/* Register settings */
#define TM50_TCL5nValue TM50_Clock
#define TM50_TMC5nValue TM5n_TMC5n_Operation_Start|\
TM5n_TMC5n_Mode_ClearByMatchCR5n
/* Interrupt settings */
#define TM50_INTTM50 1
#elif TM50_ExternalEvent==1
/*
***************************************
** TM50 external event
**
** user set valid edges = 10
***************************************
*/
/* Count clock and compare value */
/* Use register bit macro
TM5n_TCL5n_CountClock_TI5nFalling
TM5n_TCL5n_CountClock_TI5nRising
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM50_Clock TM5n_TCL5n_CountClock_TI5nFalling
/*
Value range : 0x00 - 0xff
Valid edges = CR5n_value + 1
*/
#define TM50_CR5nValue 0x09
/* Register settings */
#define TM50_TCL5nValue TM50_Clock /* external count clock only*/
#define TM50_TMC5nValue TM5n_TMC5n_Operation_Start|\
TM5n_TMC5n_Mode_ClearByMatchCR5n
/* Interrupt settings */
#define TM50_INTTM50 1
#elif TM50_SquareOut==1
/*
***************************************
** TM50 square wave output
**
** user set square width = 0.01s
***************************************
*/
/* Count clock and compare value */
/* Use register bit macro
TM5n_TCL5n_CountClock_Internal0 : fprs
TM5n_TCL5n_CountClock_Internal1 : fprs/2
TM5n_TCL5n_CountClock_Internal2 : fprs/2^2
TM5n_TCL5n_CountClock_Internal3 : fprs/2^6
TM5n_TCL5n_CountClock_Internal4 : fprs/2^8
TM5n_TCL5n_CountClock_Internal5 : fprs/2^13
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM50_Clock TM5n_TCL5n_CountClock_Internal5
/*
Value range : 0x00 - 0xff
Square width = (CR5n_value + 1) * count_clock
*/
#define TM50_CR5nValue 0x09
/* Register settings */
#define TM50_TCL5nValue TM50_Clock /* internal count clock only*/
#define TM50_TMC5nValue TM5n_TMC5n_Operation_Start|\
TM5n_TMC5n_Mode_ClearByMatchCR5n|\
/* Value selection
TM5n_TMC5n_OutPut_NoChange
TM5n_TMC5n_OutPut_Clear0
TM5n_TMC5n_OutPut_Set1
*/\
TM5n_TMC5n_OutPut_Clear0|\
TM5n_TMC5n_OutPut_InversionActiveLow|\
TM5n_TMC5n_OutPut_Enable
/* Interrupt settings */
#define TM50_INTTM50 0
#elif TM50_PWMOut==1
/*
***************************************
** TM50 PWM output
**
** user set cycle = 0.002048s, duty = 40%
***************************************
*/
/* Count clock and compare value */
/* Use register bit macro
TM5n_TCL5n_CountClock_Internal0 : fprs
TM5n_TCL5n_CountClock_Internal1 : fprs/2
TM5n_TCL5n_CountClock_Internal2 : fprs/2^2
TM5n_TCL5n_CountClock_Internal3 : fprs/2^6
TM5n_TCL5n_CountClock_Internal4 : fprs/2^8
TM5n_TCL5n_CountClock_Internal5 : fprs/2^13
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM50_Clock TM5n_TCL5n_CountClock_Internal3
/*
Value range : 0x00 - 0xff
Pulse cycle = 256 * count_clock
Duty = CR5n_value / 256
*/
#define TM50_CR5nValue 0x66
/* Register settings */
#define TM50_TCL5nValue TM50_Clock /* internal count clock only*/
#define TM50_TMC5nValue TM5n_TMC5n_Operation_Start|\
TM5n_TMC5n_Mode_PWMFreeRunning|\
/* Value selection
TM5n_TMC5n_OutPut_NoChange
TM5n_TMC5n_OutPut_Clear0
TM5n_TMC5n_OutPut_Set1
*/\
TM5n_TMC5n_OutPut_Clear0|\
/* Value selection
TM5n_TMC5n_OutPut_NoInversionActiveHigh
TM5n_TMC5n_OutPut_InversionActiveLow
*/\
TM5n_TMC5n_OutPut_InversionActiveLow|\
TM5n_TMC5n_OutPut_Enable
/* Interrupt settings */
#define TM50_INTTM50 0
#else /*not use*/
/* Interrupt settings */
#define TM50_INTTM50 0
#endif
/*
***************************************
** TM51 configure
**
** Please set operation mode here
***************************************
*/
/* if no use set nouse = 1, if use some function set function = 1 */
#define TM51_NotUse 1
#define TM51_Interval 0
#define TM51_ExternalEvent 0
#define TM51_SquareOut 0
#define TM51_PWMOut 0
#if TM51_Interval==1 /* interval */
/*
***************************************
** TM51 interval
**
** user set interval time = 0.125s
***************************************
*/
/* Count clock and compare value */
/* Use register bit macro
TM5n_TCL5n_CountClock_TI5nFalling
TM5n_TCL5n_CountClock_TI5nRising
TM5n_TCL5n_CountClock_Internal0 : fprs
TM5n_TCL5n_CountClock_Internal1 : fprs/2
TM5n_TCL5n_CountClock_Internal2 : fprs/2^4
TM5n_TCL5n_CountClock_Internal3 : fprs/2^6
TM5n_TCL5n_CountClock_Internal4 : fprs/2^8
TM5n_TCL5n_CountClock_Internal5 : fprs/2^12
Note : Please select the higher frequency you can,
so the precision will be higher.
*/
#define TM51_Clock TM5n_TCL5n_CountClock_Internal5
/*
Value range : 0x00 - 0xff
Interval time = (CR5n_value + 1) * count_clock
*/
#define TM51_CR5nValue 0xf3
/* Register settings */
#define TM51_TCL5nValue TM51_Clock
#define TM51_TMC5nValue TM5n_TMC5n_Operation_Start|\
TM5n_TMC5n_Mode_ClearByMatchCR5n
/* Interrupt settings */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -