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

📄 gpt1.h

📁 Infineon单片机XC164CMADC模数转换模块和定时器中断例程
💻 H
📖 第 1 页 / 共 2 页
字号:
//
//----------------------------------------------------------------------------
// @Description   This macro loads the selected GPT1 timer with the forwarded 
//                value. The timer is not stopped. The access of the CPU to 
//                the registers of the timers is of higher priority than a 
//                timer increment, a reload or a capture event. The following 
//                definitions are available for TimerNr:
//                GPT1_TIMER_2
//                GPT1_TIMER_3
//                GPT1_TIMER_4
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    TimerNr: 
//                The name of the timer to be loaded
// @Parameters    Value: 
//                16-bit value to be loaded
//
//----------------------------------------------------------------------------
// @Date          2007-5-4
//
//****************************************************************************

#define GPT1_vLoadTmr(TimerNr, Value) GPT1_vLoadTmr_##TimerNr(Value)
#define GPT1_vLoadTmr_GPT1_TIMER_2(Value) GPT12E_T2 = Value
#define GPT1_vLoadTmr_GPT1_TIMER_3(Value) GPT12E_T3 = Value
#define GPT1_vLoadTmr_GPT1_TIMER_4(Value) GPT12E_T4 = Value


//****************************************************************************
// @Macro         GPT1_vSetToggLatch() 
//
//----------------------------------------------------------------------------
// @Description   This macro sets the T3OTL (timer output toggle latch) bit 
//                in timer 3 control register. This bit is toggled on each 
//                over/underflow of timer 3. If the alternative output 
//                function is enabled, the port T3OUT is set depending on 
//                T3OTL. This macro sets the bit T3OTL on high. This can 
//                influence the output signal at T3OUT by SW.
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    None
//
//----------------------------------------------------------------------------
// @Date          2007-5-4
//
//****************************************************************************

#define GPT1_vSetToggLatch() GPT12E_T3CON_T3OTL = 1


//****************************************************************************
// @Macro         GPT1_vClrToggLatch() 
//
//----------------------------------------------------------------------------
// @Description   This macro resets the T3OTL (timer output toggle latch) bit 
//                in timer 3 control register. This bit is toggled on each 
//                over/underflow of timer 3. If the alternative output 
//                function is enabled, the port T3OUT is set depending on 
//                T3OTL. This macro sets the bit T3OTL on low. This can 
//                influence the output signal at T3OUT by SW.
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    None
//
//----------------------------------------------------------------------------
// @Date          2007-5-4
//
//****************************************************************************

#define GPT1_vClrToggLatch() GPT12E_T3CON_T3OTL = 0


//****************************************************************************
// @Macro         GPT1_vCountUp(TimerNr) 
//
//----------------------------------------------------------------------------
// @Description   This macro sets the counter direction of the selected timer 
//                to up. The timer is not stopped.
//                Note:
//                Concerning timer x it is possible to make the counter 
//                direction dependent on the level at TxEUD. If this 
//                functionality has been selected, then function 
//                GPT1_vCountUp() set a  0 at TxEUD enabling counting up of 
//                timer x and a 1 at TxEUD enabling counting down of timer x. 
//                The following definitions are available for TimerNr:
//                GPT1_TIMER_2
//                GPT1_TIMER_3
//                GPT1_TIMER_4
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    TimerNr: 
//                The name of the timer to be used
//
//----------------------------------------------------------------------------
// @Date          2007-5-4
//
//****************************************************************************

#define GPT1_vCountUp(TimerNr) GPT1_vCountUp_##TimerNr()
#define GPT1_vCountUp_GPT1_TIMER_2() GPT12E_T2CON_T2UD = 0
#define GPT1_vCountUp_GPT1_TIMER_3() GPT12E_T3CON_T3UD = 0
#define GPT1_vCountUp_GPT1_TIMER_4() GPT12E_T4CON_T4UD = 0


//****************************************************************************
// @Macro         GPT1_vCountDown(TimerNr) 
//
//----------------------------------------------------------------------------
// @Description   This macro sets the counter direction of the selected timer 
//                to down. The timer is not stopped.
//                Note:
//                Concerning timer x it is possible to make the counter 
//                direction dependent on the level at TxEUD. If this 
//                functionality has been selected, then function 
//                GPT1_vCountDown() set a 0 at TxEUD enabling counting down 
//                of timer x and a 1 at TxEUD enabling counting up of timer 
//                x. The following definitions are available for TimerNr:
//                GPT1_TIMER_2
//                GPT1_TIMER_3
//                GPT1_TIMER_4
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    TimerNr: 
//                The name of the timer to be used
//
//----------------------------------------------------------------------------
// @Date          2007-5-4
//
//****************************************************************************

#define GPT1_vCountDown(TimerNr) GPT1_vCountDown_##TimerNr()
#define GPT1_vCountDown_GPT1_TIMER_2() GPT12E_T2CON_T2UD = 1
#define GPT1_vCountDown_GPT1_TIMER_3() GPT12E_T3CON_T3UD = 1
#define GPT1_vCountDown_GPT1_TIMER_4() GPT12E_T4CON_T4UD = 1


//****************************************************************************
// @Macro         GPT1_ubGetCountDirection(TimerNr) 
//
//----------------------------------------------------------------------------
// @Description   This macro returns the status of the bit TxRDIR of selected 
//                TimerNr. If return value is 0 the selceted timer counts up, 
//                else the timer counts down.
//                Note:
//                Use this macro only for TimerNr wich works in incremental 
//                interface mode.
//                The following definitions are available for TimerNr:
//                GPT1_TIMER_2
//                GPT1_TIMER_3
//                GPT1_TIMER_4
//
//----------------------------------------------------------------------------
// @Returnvalue   0 if timer counts up, else 1
//
//----------------------------------------------------------------------------
// @Parameters    TimerNr: 
//                The name of the timer to be used
//
//----------------------------------------------------------------------------
// @Date          2007-5-4
//
//****************************************************************************

#define GPT1_ubGetCountDirection(TimerNr) GPT1_ubGetCountDirection_##TimerNr()
#define GPT1_ubGetCountDirection_GPT1_TIMER_2() GPT12E_T2CON_T2RDIR
#define GPT1_ubGetCountDirection_GPT1_TIMER_3() GPT12E_T3CON_T3RDIR
#define GPT1_ubGetCountDirection_GPT1_TIMER_4() GPT12E_T4CON_T4RDIR


//****************************************************************************
// @Macro         GPT1_vSetTmrRemoteControl(TimerNr) 
//
//----------------------------------------------------------------------------
// @Description   This macro sets the remote control bit of selected timer. 
//                In this mode the timer is controlled by the run bit of 
//                timer T3. To reset this mode call the macros GPT1_vStopTmr 
//                or GPT1_vClearTmr.
//                Note:
//                Use this macro only for TimerNr wich is stopped
//                
//                The following definitions are available for TimerNr:
//                GPT1_TIMER_2
//                GPT1_TIMER_4
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    TimerNr: 
//                The name of the timer to be used
//
//----------------------------------------------------------------------------
// @Date          2007-5-4
//
//****************************************************************************

#define GPT1_vSetTmrRemoteControl(TimerNr) GPT1_vSetTmrRemoteControl_##TimerNr()
#define GPT1_vSetTmrRemoteControl_GPT1_TIMER_2() GPT12E_T2CON_T2RC = 1
#define GPT1_vSetTmrRemoteControl_GPT1_TIMER_4() GPT12E_T4CON_T4RC = 1


//****************************************************************************
// @Interrupt Vectors
//****************************************************************************


// USER CODE BEGIN (GPT1_Header,9)

// USER CODE END


#endif  // ifndef _GPT1_H_

⌨️ 快捷键说明

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