?? lle_int_handler.cxgate
字號:
/*
***************************************************************************//*!
*
* @file int_handler.cxgate
*
* @author RC574C
*
* @version 1.0.1.0
*
* @date Oct-12-2006
*
* @brief XGATE RTI handler.
*
* @note Compiler CodeWarrior HCS12X V4.1
*
******************************************************************************/
/******************************************************************************
* INCLUDE
******************************************************************************/
/** S12X derivative information */
#include <MC9S12XEP100.h>
/** Common defines and macros */
#include <hidef.h>
//#include "main.h"
#include "lle_XGATE_PWM.h"
#include "lle_XGATE_PWM_defs.h"
/**************************************************************************//*!
*
* @brief xPWM generator implementation
*
* @remarks Implementation of xPWM functionality in PIT interrupt handler
*
* @return None
*
* @note To use it don't forget to add reference to appropriate int. vector
* Virtual xPWM uses selected parts of PIT module (see xPWMDEFS.h)
*
******************************************************************************/
void interrupt XGATE_PWM_int(byte PIT_Channel)
{
// channel counter
byte i;
// Clear interrupt flag
PITTF = PIT_Channel;
i=0;
while (i < XPWM_CH_MAX)
{
// if period is over...
if(xPWM_ch[i].cnt == 0)
{
// reload new period information
xPWM_ch[i].cnt = xPWM_ch[i].period;
// to achieve real 100% and 0% duty cycles
if(xPWM_ch[i].cnt == xPWM_ch[i].duty)
{
// switch channel on by write a one to corresponding pin
*xPWM_ch[i].port |= (xPWM_ch[i].port_mask);
}
else
{
// ...switch channel off
*xPWM_ch[i].port &= ~xPWM_ch[i].port_mask;
}
}
else
{
// if duty (switch on point) has been reached
if(xPWM_ch[i].cnt == xPWM_ch[i].duty)
{
// switch channel on by write a one to the corresponding pin
*xPWM_ch[i].port |= xPWM_ch[i].port_mask;
}
}
// decrease counter which represents position within period
xPWM_ch[i].cnt--;
// increase xPWM channel counter
i++;
}
}
/***************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -