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

📄 main.c

📁 XGATE Training2_Xgate_Software_Interrupts
💻 C
字号:
#include <hidef.h>      /* common defines and macros */
#include <MC9S12XEP100.h>     /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12xep100"
#include <string.h>
#include "xgate.h"


#define ROUTE_INTERRUPT(vec_adr, cfdata)                \
  INT_CFADDR= (vec_adr) & 0xF0;                         \
  INT_CFDATA_ARR[((vec_adr) & 0x0F) >> 1]= (cfdata)
  

#pragma DATA_SEG SHARED_DATA
unsigned char Variable0=0;
unsigned char Variable1=0;
#pragma DATA_SEG DEFAULT
  
  


static void SetupXGATE(void) {
  //initialize the XGATE vector block and
  //set the XGVBR register to its start address 
  XGVBR= (unsigned int)(XGATE_VectorTable - 0x1E);

  //switch software trigger 0 interrupt to XGATE
  ROUTE_INTERRUPT(0x72,0x81); 
  
  //switch software trigger 1 interrupt to XGATE
  ROUTE_INTERRUPT(0x70, 0x86); 

  //enable XGATE mode and interrupts
  XGMCTL= 0xFBC1;
}


void main(void)
{
  SetupXGATE();
  EnableInterrupts;
  
  //Trigger software trigger 0
  XGSWT=0x0101;
  for(;;) {} 
  
}
  
  
























/*


static void SetupXGATE(void) {
  //initialize the XGATE vector block and
  //set the XGVBR register to its start address 
  XGVBR= (unsigned int)(XGATE_VectorTable - XGATE_VECTOR_OFFSET);

  //switch software trigger 0 interrupt to XGATE
  ROUTE_INTERRUPT(0x72, 0x81); //RQST=1 and PRIO=1
  
  //switch software trigger 1 interrupt to XGATE
  ROUTE_INTERRUPT(0x70, 0x81); //RQST=1 and PRIO=1

  //enable XGATE mode and interrupts
  XGMCTL= 0xFBC1; //XGE | XGFRZ | XGIE
}


void main(void)
{
  SetupXGATE();
  EnableInterrupts;
  //triggers software trigger 0
  XGSWT=0x0101;
  for(;;) {} 
  
}
  */

⌨️ 快捷键说明

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