main.c
来自「XGATE Training2_Xgate_Software_Interrupt」· C语言 代码 · 共 101 行
C
101 行
#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 + =
减小字号Ctrl + -
显示快捷键?