📄 tim.h
字号:
/********************************************************************
created: 2007/04/13
created: 13:4:2007 15:34
filename: G:\DataBak\VCWorks\04.09\McoreReg\TIM.h
author: CryinRain & YxY
Page: 97<->112
purpose: Timer module regs.So many,^^
*********************************************************************/
#if !defined(_CORE_HF)
#define _CORE_HF
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//For TIM1
#define TIMIOS_TIM1 (*(volatile unsigned char*)(0x00ce0000)) //8bit Access:S R/W : Always get 0 if Read
#define TIMCFORC_TIM1 (*(volatile unsigned char*)(0x00ce0001)) //8bit Access:S R/W
#define TIMOC3M_TIM1 (*(volatile unsigned char*)(0x00ce0002)) //8bit Access:S R/W
#define TIMOC3D_TIM1 (*(volatile unsigned char*)(0x00ce0003)) //8bit Access:S R/W
#define TIMCNT_TIM1 (*(volatile unsigned short*)(0x00ce0004)) //16bit Access:S R/W
#define TIMSCR1_TIM1 (*(volatile unsigned char*)(0x00ce0006)) //8bit Access:S R/W
//unused 0x00ce0007
#define TIMTOV_TIM1 (*(volatile unsigned char*)(0x00ce0008)) //8bit Access:S R/W
#define TIMCTL1_TIM1 (*(volatile unsigned char*)(0x00ce0009)) //8bit Access:S R/W
//unused 0x00ce000a
#define TIMCTL2_TIM1 (*(volatile unsigned char*)(0x00ce000b)) //8bit Access:S R/W
#define TIMIE_TIM1 (*(volatile unsigned char*)(0x00ce000c)) //8bit Access:S R/W
#define TIMSCR2_TIM1 (*(volatile unsigned char*)(0x00ce000d)) //8bit Access:S R/W
#define TIMFLG1_TIM1 (*(volatile unsigned char*)(0x00ce000e)) //8bit Access:S R/W
#define TIMFLG2_TIM1 (*(volatile unsigned char*)(0x00ce000f)) //8bit Access:S R/W
#define TIMC0_TIM1 (*(volatile unsigned short*)(0x00ce0010)) //16bit Access:S R/W
#define TIMC1_TIM1 (*(volatile unsigned short*)(0x00ce0012)) //16bit Access:S R/W
#define TIMC2_TIM1 (*(volatile unsigned short*)(0x00ce0014)) //16bit Access:S R/W
#define TIMC3_TIM1 (*(volatile unsigned short*)(0x00ce0016)) //16bit Access:S R/W
#define TIMPACTL_TIM1 (*(volatile unsigned char*)(0x00ce0018)) //8bit Access:S R/W
#define TIMPAFLG_TIM1 (*(volatile unsigned char*)(0x00ce0019)) //8bit Access:S R/W
#define TIMPACNT_TIM1 (*(volatile unsigned short*)(0x00ce001a)) //16bit Access:S R/W
//unused 0x00ce001c
#define TIMPORT_TIM1 (*(volatile unsigned char*)(0x00ce001d)) //8bit Access:S R/W
#define TIMDDR_TIM1 (*(volatile unsigned char*)(0x00ce001e)) //8bit Access:S R/W
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//For TIM2
#define TIMIOS_TIM2 (*(volatile unsigned char*)(0x00cf0000)) //8bit Access:S R/W : Always get 0 if Read
#define TIMCFORC_TIM2 (*(volatile unsigned char*)(0x00cf0001)) //8bit Access:S R/W
#define TIMOC3M_TIM2 (*(volatile unsigned char*)(0x00cf0002)) //8bit Access:S R/W
#define TIMOC3D_TIM2 (*(volatile unsigned char*)(0x00cf0003)) //8bit Access:S R/W
#define TIMCNT_TIM2 (*(volatile unsigned short*)(0x00cf0004)) //16bit Access:S R/W
#define TIMSCR1_TIM2 (*(volatile unsigned char*)(0x00cf0006)) //8bit Access:S R/W
//unused 0x00cf0007
#define TIMTOV_TIM2 (*(volatile unsigned char*)(0x00cf0008)) //8bit Access:S R/W
#define TIMCTL1_TIM2 (*(volatile unsigned char*)(0x00cf0009)) //8bit Access:S R/W
//unused 0x00cf000a
#define TIMCTL2_TIM2 (*(volatile unsigned char*)(0x00cf000b)) //8bit Access:S R/W
#define TIMIE_TIM2 (*(volatile unsigned char*)(0x00cf000c)) //8bit Access:S R/W
#define TIMSCR2_TIM2 (*(volatile unsigned char*)(0x00cf000d)) //8bit Access:S R/W
#define TIMFLG1_TIM2 (*(volatile unsigned char*)(0x00cf000e)) //8bit Access:S R/W
#define TIMFLG2_TIM2 (*(volatile unsigned char*)(0x00cf000f)) //8bit Access:S R/W
#define TIMC0_TIM2 (*(volatile unsigned short*)(0x00cf0010)) //16bit Access:S R/W
#define TIMC1_TIM2 (*(volatile unsigned short*)(0x00cf0012)) //16bit Access:S R/W
#define TIMC2_TIM2 (*(volatile unsigned short*)(0x00cf0014)) //16bit Access:S R/W
#define TIMC3_TIM2 (*(volatile unsigned short*)(0x00cf0016)) //16bit Access:S R/W
#define TIMPACTL_TIM2 (*(volatile unsigned char*)(0x00cf0018)) //8bit Access:S R/W
#define TIMPAFLG_TIM2 (*(volatile unsigned char*)(0x00cf0019)) //8bit Access:S R/W
#define TIMPACNT_TIM2 (*(volatile unsigned short*)(0x00cf001a)) //16bit Access:S R/W
//unused 0x00cf0001c
#define TIMPORT_TIM2 (*(volatile unsigned char*)(0x00cf001d)) //8bit Access:S R/W
#define TIMDDR_TIM2 (*(volatile unsigned char*)(0x00cf001e)) //8bit Access:S R/W
//以下定义为方便编程而设
// | or 操作使能某通道的功能, & and ~值 屏蔽这个通道的功能
#define C0IE_En 0x01;//通道0中断使能
#define C1IE_En 0x02;//通道1中断使能
#define C2IE_En 0x04;//通道2中断使能
#define C3IE_En 0x08;//通道3中断使能
#define C0IO_OutputEn 0x01;//通道0输入输出选择,0为输入,1为输出
#define C1IO_OutputEn 0x02;//通道1输入输出选择,0为输入,1为输出
#define C2IO_OutputEn 0x04;//通道2输入输出选择,0为输入,1为输出
#define C3IO_OutputEn 0x08;//通道3输入输出选择,0为输入,1为输出
#define C0FOC_En 0x01;//通道0强制比较符合
#define C1FOC_En 0x02;//通道1强制比较符合
#define C2FOC_En 0x04;//通道2强制比较符合
#define C3FOC_En 0x08;//通道3强制比较符合
#define C0OVReversal_En 0x01;//通道0当计数器溢出时翻转使能
#define C1OVReversal_En 0x02;//通道1当计数器溢出时翻转使能
#define C2OVReversal_En 0x04;//通道2当计数器溢出时翻转使能
#define C3OVReversal_En 0x08;//通道3当计数器溢出时翻转使能
#define TIMEN 0x80;//定时器功能使能位
#define TIMOV_IEEN 0x80;//定时器溢出中断使能位
#define C3_TCRE 0x08;//计数器的复位使能位,由通道3比较符合控制
#define TIMFClr 0x10;//定时器标志位快速清除使能
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -