⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer_config.bak

📁 the timer control demo source for the NEC mcu
💻 BAK
📖 第 1 页 / 共 3 页
字号:
	#define	TM51_INTTM51	1
#elif TM51_ExternalEvent==1
	/*
	***************************************
	**  TM51 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	TM51_Clock	TM5n_TCL5n_CountClock_TI5nFalling
	/* 
		Value range :	0x00 - 0xff
		Valid edges = CR5n_value + 1
	*/
	#define	TM51_CR5nValue	0x09
	
	/* Register settings */
	#define	TM51_TCL5nValue	TM51_Clock	/* external count clock only*/
	#define	TM51_TMC5nValue	TM5n_TMC5n_Operation_Start|\
							TM5n_TMC5n_Mode_ClearByMatchCR5n
	
	/* Interrupt settings */
	#define	TM51_INTTM51	1
#elif TM51_SquareOut==1
	/*
	***************************************
	**  TM51 square wave output
	**
	**  user set square width = 0.015s
	***************************************
	*/
	
	/* 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^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
		Square width = (CR5n_value + 1) * count_clock
	*/
	#define	TM51_CR5nValue	0x1c
	
	/* Register settings */
	#define	TM51_TCL5nValue	TM51_Clock	/* internal count clock only*/
	#define	TM51_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	TM51_INTTM51	0
#elif TM51_PWMOut==1
	/*
	***************************************
	**  TM51 PWM output
	**
	**  user set cycle = 0.002048s, duty = 80%
	***************************************
	*/
	
	/* 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^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_Internal3
	/* 
		Value range :	0x00 - 0xff
		Pulse cycle = 256 * count_clock
		Duty = CR01n_value / 256
	*/
	#define	TM51_CR5nValue	0xcc
	
	/* Register settings */
	#define	TM51_TCL5nValue	TM51_Clock	/* internal count clock only*/
	#define	TM51_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	TM51_INTTM51	0
#else	/*not use*/
	/* Interrupt settings */
	#define	TM51_INTTM51	0
#endif

/*
***************************************
**  TMH0 configure
**
**  Please set operation mode here
***************************************
*/
/* if no use set nouse = 1, if use some function set function = 1 */
#define	TMH0_NotUse	1
#define	TMH0_Interval	0
#define	TMH0_SquareOut	0
#define	TMH0_PWMOut	0

#if TMH0_Interval==1
	/*
	***************************************
	**  TMH0 interval
	**
	**  user set interval time = 0.03125s
	***************************************
	*/
	
	/* Count clock and compare value */
	/* Use register bit macro
		TMHn_TMHMDn_CountClock_Internal0	:	fprs
		TMHn_TMHMDn_CountClock_Internal1	:	fprs/2
		TMHn_TMHMDn_CountClock_Internal2	:	fprs/2^2
		TMHn_TMHMDn_CountClock_Internal3	:	fprs/2^6
		TMHn_TMHMDn_CountClock_Internal4	:	fprs/2^10
		TMHn_TMHMDn_CountClock_Internal5	:	TM50Output
		Note :	Please select the higher frequency you can,
			so the precision will be higher.
	*/
	#define	TMH0_Clock	TMHn_TMHMDn_CountClock_Internal4
	/* 
		Value range :	0x00 - 0xfe
		Interval time = (CMP0n_value + 1) * count_clock
	*/
	#define	TMH0_CMP0nValue 0xf3
	
	/* Register settings */
	#define	TMH0_TMHMDnValue	TMHn_TMHMDn_Operation_Enable|\
								TMH0_Clock|\
								TMHn_TMHMDn_Mode_Interval|\
								TMHn_TMHMDn_OutPut_Disable
	
	/* Interrupt settings */
	#define	TMH0_INTTMH0	1
#elif TMH0_SquareOut==1
	/*
	***************************************
	**  TMH0 square wave out
	**
	**  user set square width = 0.015s
	***************************************
	*/
	
	/* Count clock and compare value */
	/* Use register bit macro
		TMHn_TMHMDn_CountClock_Internal0	:	fprs
		TMHn_TMHMDn_CountClock_Internal1	:	fprs/2
		TMHn_TMHMDn_CountClock_Internal2	:	fprs/2^2
		TMHn_TMHMDn_CountClock_Internal3	:	fprs/2^6
		TMHn_TMHMDn_CountClock_Internal4	:	fprs/2^10
		TMHn_TMHMDn_CountClock_Internal5	:	TM50Output
		Note :	Please select the higher frequency you can,
			so the precision will be higher.
	*/
	#define	TMH0_Clock	TMHn_TMHMDn_CountClock_Internal4
	/* 
		Value range :	0x00 - 0xfe
		Square width = (CMP0n_value + 1) * count_clock
	*/
	#define	TMH0_CMP0nValue 0x74
	
	/* Register settings */
	#define	TMH0_TMHMDnValue	TMHn_TMHMDn_Operation_Enable|\
								TMH0_Clock|\
								TMHn_TMHMDn_Mode_Interval|\
								/* Value selection
									TMHn_TMHMDn_Level_Low
									TMHn_TMHMDn_Level_High
								*/\
								TMHn_TMHMDn_Level_Low|\
								TMHn_TMHMDn_Output_Enable
	
	/* Interrupt settings */
	#define	TMH0_INTTMH0	0
#elif TMH0_PWMOut==1
	/*
	***************************************
	**  TMH0 PWM out
	**
	**  user set cycle = 0.005s, duty = 25%
	***************************************
	*/
	
	/* Count clock and compare value */
	/* Use register bit macro
		TMHn_TMHMDn_CountClock_Internal0	:	fprs
		TMHn_TMHMDn_CountClock_Internal1	:	fprs/2
		TMHn_TMHMDn_CountClock_Internal2	:	fprs/2^2
		TMHn_TMHMDn_CountClock_Internal3	:	fprs/2^6
		TMHn_TMHMDn_CountClock_Internal4	:	fprs/2^10
		TMHn_TMHMDn_CountClock_Internal5	:	TM50Output
		Note :	Please select the higher frequency you can,
			so the precision will be higher.
	*/
	#define	TMH0_Clock	TMHn_TMHMDn_CountClock_Internal4
	/* 
		Value range :	0x00 - 0xfe
		Pulse cycle = (CMP0n_value + 1) * count_clock
		Duty = (CMP1n_value + 1) / (CMP0n_value + 1)
		CMP1n_value < CMP0n_value
	*/
	#define	TMH0_CMP0nValue 0x26
	#define	TMH0_CMP1nValue 0x09
	
	/* Register settings */
	#define	TMH0_TMHMDnValue	TMHn_TMHMDn_Operation_Enable|\
								TMH0_Clock|\
								TMHn_TMHMDn_Mode_PWM|\
								/* Value selection
									TMHn_TMHMDn_Level_Low
									TMHn_TMHMDn_Level_High
								*/\
								TMHn_TMHMDn_Level_Low|\
								TMHn_TMHMDn_Output_Enable
	
	/* Interrupt settings */
	#define	TMH0_INTTMH0	0
#else	/*not use*/
	/* Interrupt settings */
	#define	TMH0_INTTMH0	0
#endif

/*
***************************************
**  TMH1 configure
**
**  Please set operation mode here
***************************************
*/
/* if no use set nouse = 1, if use some function set function = 1 */
#define	TMH1_NotUse	1
#define	TMH1_Interval	0
#define	TMH1_SquareOut	0
#define	TMH1_PWMOut	0
#define	TMH1_CarrierOut	0

#if TMH1_Interval==1
	/*
	***************************************
	**  TMH1 interval
	**
	**  user set interval time = 0.125s
	***************************************
	*/
	
	/* Count clock and compare value */
	/* Use register bit macro
		TMHn_TMHMDn_CountClock_Internal0	:	fprs
		TMHn_TMHMDn_CountClock_Internal1	:	fprs/2
		TMHn_TMHMDn_CountClock_Internal2	:	fprs/2^4
		TMHn_TMHMDn_CountClock_Internal3	:	fprs/2^6
		TMHn_TMHMDn_CountClock_Internal4	:	fprs/2^12
		TMHn_TMHMDn_CountClock_Internal5	:	frl/2^7
		TMHn_TMHMDn_CountClock_Internal6	:	frl/2^9
		TMHn_TMHMDn_CountClock_Internal7	:	frl
		Note :	Please select the higher frequency you can,
			so the precision will be higher.
	*/
	#define	TMH1_Clock	TMHn_TMHMDn_CountClock_Internal4
	/* 
		Value range :	0x00 - 0xfe
		Interval time = (CMP0n_value + 1) * count_clock
	*/
	#define	TMH1_CMP0nValue  0xf3	/* User set 0.125s */
	
	/* Register settings */
	#define	TMH1_TMHMDnValue	TMHn_TMHMDn_Operation_Enable|\
								TMH1_Clock|\
								TMHn_TMHMDn_Mode_Interval|\
								TMHn_TMHMDn_OutPut_Disable
	
	/* Interrupt settings */
	#define	TMH1_INTTMH1	1
#elif TMH1_SquareOut==1
	/*
	***************************************
	**  TMH1 square wave out
	**
	**  user set square width = 0.02s
	***************************************
	*/
	
	/* Count clock and compare value */
	/* Use register bit macro
		TMHn_TMHMDn_CountClock_Internal0	:	fprs
		TMHn_TMHMDn_CountClock_Internal1	:	fprs/2
		TMHn_TMHMDn_CountClock_Internal2	:	fprs/2^4
		TMHn_TMHMDn_CountClock_Internal3	:	fprs/2^6
		TMHn_TMHMDn_CountClock_Internal4	:	fprs/2^12
		TMHn_TMHMDn_CountClock_Internal5	:	frl/2^7
		TMHn_TMHMDn_CountClock_Internal6	:	frl/2^9
		TMHn_TMHMDn_CountClock_Internal7	:	frl
		Note :	Please select the higher frequency you can,
			so the precision will be higher.
	*/
	#define	TMH1_Clock	TMHn_TMHMDn_CountClock_Internal4
	/* 
		Value range :	0x00 - 0xfe
		Square width = (CMP0n_value + 1) * count_clock
	*/
	#define	TMH1_CMP0nValue  0x27	/* User set 0.125s */
	
	/* Register settings */
	#define	TMH1_TMHMDnValue	TMHn_TMHMDn_Operation_Enable|\
								TMH1_Clock|\
								TMHn_TMHMDn_Mode_Interval|\
								/* Value selection
									TMHn_TMHMDn_Level_Low
									TMHn_TMHMDn_Level_High
								*/\
								TMHn_TMHMDn_Level_Low|\
								TMHn_TMHMDn_Output_Enable
	
	/* Interrupt settings */
	#define	TMH1_INTTMH1	0
#elif TMH1_PWMOut==1
	/*
	***************************************
	**  TMH1 PWM out
	**
	**  user set cycle = 0.01, duty = 50%
	***************************************
	*/
	
	/* Count clock and compare value */
	/* Use register bit macro
		TMHn_TMHMDn_CountClock_Internal0	:	fprs
		TMHn_TMHMDn_CountClock_Internal1	:	fprs/2
		TMHn_TMHMDn_CountClock_Internal2	:	fprs/2^4
		TMHn_TMHMDn_CountClock_Internal3	:	fprs/2^6
		TMHn_TMHMDn_CountClock_Internal4	:	fprs/2^12
		TMHn_TMHMDn_CountClock_Internal5	:	frl/2^7
		TMHn_TMHMDn_CountClock_Internal6	:	frl/2^9
		TMHn_TMHMDn_CountClock_Internal7	:	frl
		Note :	Please select the higher frequency you can,
			so the precision will be higher.
	*/
	#define	TMH1_Clock	TMHn_TMHMDn_CountClock_Internal5
	/* 
		Value range :	0x00 - 0xfe
		Pulse cycle = (CMP0n_value + 1) * count_clock
		Duty = (CMP1n_value + 1) / (CMP0n_value + 1)
		CMP1n_value < CMP0n_value
	*/
	#define	TMH1_CMP0nValue 0x12
	#define	TMH1_CMP1nValue 0x9
	
	/* Register settings */
	#define	TMH1_TMHMDnValue	TMHn_TMHMDn_Operation_Enable|\
								TMH1_Clock|\
								TMHn_TMHMDn_Mode_PWM|\
								/* Value selection
									TMHn_TMHMDn_Level_Low
									TMHn_TMHMDn_Level_High
								*/\
								TMHn_TMHMDn_Level_Low|\
								TMHn_TMHMDn_Output_Enable
	
	/* Interrupt settings */
	#define	TMH1_INTTMH1	0
#elif TMH1_CarrierOut==1
	/*
	***************************************
	**  TMH1 carrier out
	**
	**  user set cycle =, duty =
	***************************************
	*/
	
	/* Count clock and compare value */
	/* Use register bit macro
		TMHn_TMHMDn_CountClock_Internal0	:	fprs
		TMHn_TMHMDn_CountClock_Internal1	:	fprs/2
		TMHn_TMHMDn_CountClock_Internal2	:	fprs/2^4
		TMHn_TMHMDn_CountClock_Internal3	:	fprs/2^6
		TMHn_TMHMDn_CountClock_Internal4	:	fprs/2^12
		TMHn_TMHMDn_CountClock_Internal5	:	frl/2^7
		TMHn_TMHMDn_CountClock_Internal6	:	frl/2^9
		TMHn_TMHMDn_CountClock_Internal7	:	frl
		Note :	Please select the higher frequency you can,
			so the precision will be higher.
	*/
	#define	TMH1_Clock	TMHn_TMHMDn_CountClock_Internal4
	/* 
		Value range :	0x00 - 0xff
		Carrier cycle = (CMP0n_value + CMP1n_value + 2) * count_clock
		Duty = (CMP1n_value + 1) / (CMP0n_value + CMP1n_value + 2)
	*/
	#define	TMH1_CMP0nValue 0x80
	#define	TMH1_CMP1nValue 0x40
	
	/* Register settings */
	#define	TMH1_TMHMDnValue	TMHn_TMHMDn_Operation_Enable|\
								TMH1_Clock|\
								TMHn_TMHMDn_Mode_Carrier|\
								/* Value selection
									TMHn_TMHMDn_Level_Low
									TMHn_TMHMDn_Level_High
								*/\
								TMHn_TMHMDn_Output_Enable
	#define	TMH1_TMCYC1Value 	TMHn_TMCYC1_Remote_Carrier|\
								TMHn_TMCYC1_Carrier_Enable
	
	/* Interrupt settings */
	#define	TMH1_INTTMH1	0
#else	/*not use*/
	/* Interrupt settings */
	#define	TMH1_INTTMH1	0
#endif

#endif		/* _TIMERCFG_*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -