📄 int.c
字号:
//****************************************************************************
// @Module Interrupt Controller (INT)
// @Filename INT.C
// @Project svm.dav
//----------------------------------------------------------------------------
// @Controller Infineon XC167CI-16F40
//
// @Compiler Keil
//
// @Codegenerator 2.1
//
// @Description This file contains functions that use the INT module.
//
//----------------------------------------------------------------------------
// @Date 19.12.2003 11:31:23
//
//****************************************************************************
// USER CODE BEGIN (INT_General,1)
// USER CODE END
//****************************************************************************
// @Project Includes
//****************************************************************************
#include "MAIN.H"
// USER CODE BEGIN (INT_General,2)
// USER CODE END
//****************************************************************************
// @Macros
//****************************************************************************
// USER CODE BEGIN (INT_General,3)
// USER CODE END
//****************************************************************************
// @Defines
//****************************************************************************
// USER CODE BEGIN (INT_General,4)
// USER CODE END
//****************************************************************************
// @Typedefs
//****************************************************************************
// USER CODE BEGIN (INT_General,5)
// USER CODE END
//****************************************************************************
// @Imported Global Variables
//****************************************************************************
// USER CODE BEGIN (INT_General,6)
// USER CODE END
//****************************************************************************
// @Global Variables
//****************************************************************************
// USER CODE BEGIN (INT_General,7)
// USER CODE END
//****************************************************************************
// @External Prototypes
//****************************************************************************
// USER CODE BEGIN (INT_General,8)
// USER CODE END
//****************************************************************************
// @Prototypes Of Local Functions
//****************************************************************************
// USER CODE BEGIN (INT_General,9)
// USER CODE END
//****************************************************************************
// @Function void INT_vInit(void)
//
//----------------------------------------------------------------------------
// @Description This is the initialization function of the INT function
// library. It is assumed that the SFRs used by this library
// are in its reset state.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 19.12.2003
//
//****************************************************************************
// USER CODE BEGIN (Init,1)
// USER CODE END
void INT_vInit(void)
{
// USER CODE BEGIN (Init,2)
// USER CODE END
/// -----------------------------------------------------------------------
/// Configuration of the external interrupt 7:
/// -----------------------------------------------------------------------
/// - interrupt on positive edge
/// - input from pin P2.15 (EX7IN)
MAIN_vUnlockProtecReg(); // unlock EXISEL0
EXISEL0 = 0x0000; // load the external Interrupt select
// register 0
MAIN_vUnlockProtecReg(); // unlock EXISEL1
EXISEL1 = 0x0000; // load the external Interrupt select
// register 1
MAIN_vUnlockProtecReg(); // unlock EXICON
EXICON = 0x4000; // load the external Interrupt control
// register
PECISNC = 0x0000; // clear PEC interrupt sub node control
// register
PECISNC = 0x0000; // load PEC interrupt sub node control
// register
/// -----------------------------------------------------------------------
/// Configuration of the used INT Port Pins:
/// -----------------------------------------------------------------------
/// - P2.15 is used for Fast External Interrupt 7 Input (EX7IN)
/// -----------------------------------------------------------------------
/// Configuration of the used INT Interrupts:
/// -----------------------------------------------------------------------
/// Ext. 7 _ CC1 Ch. 15 service request node configuration:
/// - Ext. 7 _ CC1 Ch. 15 interrupt priority level (ILVL) = 13
/// - Ext. 7 _ CC1 Ch. 15 interrupt group level (GLVL) = 0
/// - Ext. 7 _ CC1 Ch. 15 group priority extension (GPX) = 0
CC1_CC15IC = 0x0074;
/// Use PEC channel 4 for Ext 7 Ch 15 INT:
/// - normal interrupt
/// - pointers are not modified
/// - transfer a word
/// - service End of PEC interrrupt by a EOP interrupt node is disabled
PECC4 = 0x1000; // load PECC4 control register
/// EOP service request node configuration:
/// - EOP interrupt priority level (ILVL) = 12
/// - EOP interrupt group level (GLVL) = 0
/// - EOP group priority extension (GPX) = 0
EOPIC = 0x0070;
// USER CODE BEGIN (INT_Function,3)
// USER CODE END
} // End of function INT_vInit
//****************************************************************************
// @Function void INT_viEx7(void)
//
//----------------------------------------------------------------------------
// @Description This is the interrupt service routine for the external
// interrupt 7 EX7IN (P2.15). It is called when the configured
// event is captured.
// Please note that you have to add application specific code
// to this function.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 19.12.2003
//
//****************************************************************************
// USER CODE BEGIN (Ex7,1)
// USER CODE END
void INT_viEx7(void) interrupt CC1_CC15INT
{
// USER CODE BEGIN (Ex7,4)
// Top 0 recognition on P 2.15
GPT12E_T3CON_T3R=1; //start of T3 for Encoder
GPT12E_T3=0;
// USER CODE END
} // End of function INT_viEx7
//****************************************************************************
// @Function void INT_viEOP(void)
//
//----------------------------------------------------------------------------
// @Description This is the interrupt service routine for the End of PEC
// interrupt. It is called when the configured PEC channel
// counter decrements from 0x01 to 0x00.
// Please note that you have to add application specific code
// to this function.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 19.12.2003
//
//****************************************************************************
// USER CODE BEGIN (EOP,1)
// USER CODE END
void INT_viEOP(void) interrupt EOPINT
{
// USER CODE BEGIN (EOP,2)
// USER CODE END
} // End of function INT_viEOP
// USER CODE BEGIN (INT_General,10)
// USER CODE END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -