金牌会员
 
- 积分
- 1367
- 威望
- 797
- 贡献
- 344
- 兑换币
- 12
- 注册时间
- 2011-11-7
- 在线时间
- 114 小时
|
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#define PITTIME 5000
#pragma LINK_INFO DERIVATIVE "mc9s12xs128"
unsigned int vtmpPIT=0;
void PLL_init() {
CLKSEL=0X00;
PLLCTL=0XE1;
SYNR=2;
REFDV=1;
PLLCTL=0X60;
_asm(nop);
_asm(nop);
_asm(nop);
while((CRGFLG&0X08)==0);
CLKSEL=0X80;
}
void initIOBoutput() {
DDRB=0XFF;
PORTB=0XFF;
}
void initPIT() {
PITCFLMT_PITE=0;
PITCE_PCE0=1;
PITMTLD0=240-1;
PITLD0=PITTIME-1;
PITINTE_PINTE0=1;
PITCFLMT_PITE=1;
}
void main(void) {
/* put your own code here */
PLL_init();
initIOBoutput();
initPIT();
EnableInterrupts;
for(;;) {
_FEED_COP(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave main */
}
#pragma CODE_SEG_NEAR_SEG NON_BANKED
interrupt VectorNumber_Vtimch0 void PIT0(){
vtmpPIT++;
if(vtmpPIT==10) {
PORTB=~PORTB;
vtmpPIT=0;
}
PITTF_PTF0=1;
}
#pragma CODE_SEG DEFAULT.....
link error 1907:fixup overflow in _Vector8(why it's 8),to PIT0 type1,at offset 0x0 |
|