高级会员
- 积分
- 879
- 威望
- 528
- 贡献
- 181
- 兑换币
- 87
- 注册时间
- 2009-1-20
- 在线时间
- 85 小时
|
#pragma CODE_SEG __NEAR_SEG NON_BANKED 中断程序要放在非分页区
这句话意思是后面的程序放在非分页区
void interrupt 16 INT_Timer0(void) 中断格式 对应中断号16
{
PORTB++; 自己的代码
TFLG2_TOF=1; //清中断标志位
}
#pragma CODE_SEG DEFAULT 这句话意思是后面的程序放在正常存放区
中断定义在MC9S12XS128.h里找 (见下)
#define VectorNumber_Vsi 119
#define VectorNumber_Vsyscall 118
#define VectorNumber_VReserved118 117
#define VectorNumber_VReserved117 116
#define VectorNumber_VReserved116 115
#define VectorNumber_VReserved115 114
#define VectorNumber_VReserved114 113
#define VectorNumber_VReserved113 112
#define VectorNumber_VReserved112 111
#define VectorNumber_VReserved111 110
#define VectorNumber_VReserved110 109
#define VectorNumber_VReserved109 108
#define VectorNumber_VReserved108 107
#define VectorNumber_VReserved107 106
#define VectorNumber_VReserved106 105
#define VectorNumber_VReserved105 104
#define VectorNumber_VReserved104 103
#define VectorNumber_VReserved103 102
#define VectorNumber_VReserved102 101
#define VectorNumber_VReserved101 100
#define VectorNumber_VReserved100 99
#define VectorNumber_VReserved99 98
#define VectorNumber_VReserved98 97
#define VectorNumber_Vatd0compare 96
#define VectorNumber_VReserved96 95
#define VectorNumber_VReserved95 94
#define VectorNumber_VReserved94 93
#define VectorNumber_VReserved93 92
#define VectorNumber_VReserved92 91
#define VectorNumber_VReserved91 90
#define VectorNumber_VReserved90 89
#define VectorNumber_VReserved89 88
#define VectorNumber_VReserved88 87
#define VectorNumber_VReserved87 86
#define VectorNumber_VReserved86 85
#define VectorNumber_VReserved85 84
#define VectorNumber_VReserved84 83
#define VectorNumber_VReserved83 82
#define VectorNumber_VReserved82 81
#define VectorNumber_VReserved81 80
#define VectorNumber_VReserved79 79
#define VectorNumber_VReserved78 78
#define VectorNumber_VReserved77 77
#define VectorNumber_VReserved76 76
#define VectorNumber_VReserved75 75
#define VectorNumber_VReserved74 74
#define VectorNumber_VReserved73 73
#define VectorNumber_VReserved72 72
#define VectorNumber_VReserved71 71
#define VectorNumber_VReserved70 70
#define VectorNumber_Vpit3 69
#define VectorNumber_Vpit2 68
#define VectorNumber_Vpit1 67
#define VectorNumber_Vpit0 66
#define VectorNumber_Vhti 65
#define VectorNumber_Vapi 64
#define VectorNumber_Vlvi 63
#define VectorNumber_VReserved62 62
#define VectorNumber_VReserved61 61
#define VectorNumber_VReserved60 60
#define VectorNumber_VReserved59 59
#define VectorNumber_VReserved58 58
#define VectorNumber_Vpwmesdn 57
#define VectorNumber_Vportp 56
#define VectorNumber_VReserved55 55
#define VectorNumber_VReserved54 54
#define VectorNumber_VReserved53 53
#define VectorNumber_VReserved52 52
#define VectorNumber_VReserved51 51
#define VectorNumber_VReserved50 50
#define VectorNumber_VReserved49 49
#define VectorNumber_VReserved48 48
#define VectorNumber_VReserved47 47
#define VectorNumber_VReserved46 46
#define VectorNumber_VReserved45 45
#define VectorNumber_VReserved44 44
#define VectorNumber_VReserved43 43
#define VectorNumber_VReserved42 42
#define VectorNumber_VReserved41 41
#define VectorNumber_VReserved40 40
#define VectorNumber_Vcan0tx 39
#define VectorNumber_Vcan0rx 38
#define VectorNumber_Vcan0err 37
#define VectorNumber_Vcan0wkup 36
#define VectorNumber_Vflash 35
#define VectorNumber_Vflashfd 34
#define VectorNumber_VReserved33 33
#define VectorNumber_VReserved32 32
#define VectorNumber_VReserved31 31
#define VectorNumber_VReserved30 30
#define VectorNumber_Vcrgscm 29
#define VectorNumber_Vcrgplllck 28
#define VectorNumber_VReserved27 27
#define VectorNumber_VReserved26 26
#define VectorNumber_Vporth 25
#define VectorNumber_Vportj 24
#define VectorNumber_VReserved23 23
#define VectorNumber_Vatd0 22
#define VectorNumber_Vsci1 21
#define VectorNumber_Vsci0 20
#define VectorNumber_Vspi0 19
#define VectorNumber_Vtimpaie 18
#define VectorNumber_Vtimpaaovf 17
#define VectorNumber_Vtimovf 16
#define VectorNumber_Vtimch7 15
#define VectorNumber_Vtimch6 14
#define VectorNumber_Vtimch5 13
#define VectorNumber_Vtimch4 12
#define VectorNumber_Vtimch3 11
#define VectorNumber_Vtimch2 10
#define VectorNumber_Vtimch1 9
#define VectorNumber_Vtimch0 8
#define VectorNumber_Vrti 7
#define VectorNumber_Virq 6
#define VectorNumber_Vxirq 5
#define VectorNumber_Vswi 4
#define VectorNumber_Vtrap 3
#define VectorNumber_Vcop 2
#define VectorNumber_Vclkmon 1
#define VectorNumber_Vreset 0
分区在Project.prm里找 (见下)
PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
_PRESTART, /* Used in HIWARE format: jump to _Startup at the code start */
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
//.ostext, /* eventually OSEK code */
NON_BANKED, /* runtime routines which must not be banked */
COPY /* copy down information: how to initialize variables */
/* in case you want to use ROM_4000 here as well, make sure
that all files (incl. library files) are compiled with the
option: -OnB=b */
INTO ROM_C000/*, ROM_4000*/;
DEFAULT_ROM INTO PAGE_FE, PAGE_FC, PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8;
//.stackstart, /* eventually used for OSEK kernel awareness: Main-Stack Start */
SSTACK, /* allocate stack first to avoid overwriting variables on overflow */
//.stackend, /* eventually used for OSEK kernel awareness: Main-Stack End */
PAGED_RAM, /* there is no need for paged data accesses on this derivative */
DEFAULT_RAM /* all variables, the default RAM location */
INTO RAM;
DISTRIBUTE DISTRIBUTE_INTO
ROM_4000, PAGE_FE, PAGE_FC, PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8;
CONST_DISTRIBUTE DISTRIBUTE_INTO
ROM_4000, PAGE_FE, PAGE_FC, PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8;
DATA_DISTRIBUTE DISTRIBUTE_INTO
RAM;
//.vectors INTO OSVECTORS; /* OSEK vector table */
END
|
|