MC9S12XS128驅動LEDP10顯示屏
void hangxuan(unsigned char P)
{ A=P&0x01; B=(P>>1)&0x01; C=(P>>2)&0X01; D=(P>>3)&0X01; CT=1;
}
void init()
{ DisableInterrupts; SC=0; CP=0; A=0; B=0; C=0; D=0; RI=0; CT=1; DIR=0XFF; EnableInterrupts;
}
void INIT_PLL(void)
{ CLKSEL &= 0x7f; //set OSCCLK as sysclk PLLCTL &= 0x8F; //Disable PLL circuit CRGINT &= 0xDF; #if(BUS_CLOCK == 40000000) SYNR = 0x44; #elif(BUS_CLOCK == 32000000) SYNR = 0x43; #elif(BUS_CLOCK == 24000000) SYNR = 0x42; #endif REFDV = 0x81; //PLLCLK=2×OSCCLK×(SYNDIV+1)/(REFDIV+1)=64MHz ,fbus=32M PLLCTL =PLLCTL|0x70; //Enable PLL circuit asm NOP; asm NOP; while(!(CRGFLG&0x08)); //PLLCLK is Locked already CLKSEL |= 0x80; //set PLLCLK as sysclk
}
void timer_init()
{ //CLKSEL &= 0x7f; //set OSCCLK as sysclk TSCR1_PRNT=0;//使能預分頻 TSCR2=0x87;//使能溢出中斷 128分頻 TCNTH=((unsigned int)(-20000))/256; //500ms TCNTL=((unsigned int)(-20000))%6; TFLG2_TOF=1; //清除溢出中斷標志位 TSCR1_TEN=1; //使能定時器
}
#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt void timer()
{ TFLG2_TOF=1; //清除溢出中斷標志位 TCNTH=((unsigned int)(-20000))/256; //500ms TCNTL=((unsigned int)(-20000))%6; shu++; if(shu==128) { shu=0; }
看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
評論