中级会员
- 积分
- 391
- 威望
- 283
- 贡献
- 48
- 兑换币
- 24
- 注册时间
- 2010-11-13
- 在线时间
- 30 小时
|
- #include <hidef.h> /* common defines and macros */
- #include <MC9S12XS128.h> /* derivative information */
- #pragma LINK_INFO DERIVATIVE "mc9s12xs128"
- #define LINE_MAX 100
- #define ROW_MAX 480
- //int start;
- int i;
- int row;
- void SetBusClock(void){
- CLKSEL=0X00; // disengage PLL to system
- PLLCTL_PLLON=1; // turn on PLL
- SYNR=0x1F; // VCOFRQ[7:6];SYNDIV[5:0];fVCO= 2*fOSC*(SYNDIV + 1)/(REFDIV + 1);fPLL= fVCO/(2 × POSTDIV);BUS= fPLL/2
- REFDV=0x07; // REFFRQ[7:6];REFDIV[5:0]
- _asm(nop); // BUS CLOCK=32M
- _asm(nop);
- while(!(CRGFLG_LOCK==1)); //when pll is steady ,then use it;
- CLKSEL_PLLSEL =1; //engage PLL to system;
- }
- void InitSci(void)
- {
- SCI0CR1 =0x00;
- SCI0CR2 =0x2c; //enable Receive Full Interrupt,RX enable,Tx enable
- SCI0BDH =0x01;
- SCI0BDL =0xA0; //SCI0BDL=busclk/(16*SCI0BDL)
- //busclk 8MHz, 9600bps,SCI0BD=0x34
- //busclk 16MHz, 9600bps,SCI0BD=0x68
- //busclk 24MHz, 9600bps,SCI0BD=0x9C
- //busclk 32MHz, 9600bps,SCI0BD=0xD0
- //busclk 40MHz, 9600bps,SCI0BD=0x106
- //busclk 48MHz, 9600bps,SCI0BD=0x138
- //busclk 56MHz, 9600bps,SCI0BD=0x16D
- //busclk 64MHz, 9600bps,SCI0BD=0x1A0
- //busclk 72MHz, 9600bps,SCI0BD=0x1D5
- //PORTA=0X00;
- }
- /**************发射端程序************************/
- void SciTx(char text)
- {
- while (!(SCI0SR1&0x80));
- SCI0DRH=0;
- SCI0DRL=text;
- }
- void send() {
- for(row=0;row<11000;row++){
-
- for(i=0;i<1000;i++)
-
- SciTx('d');
- }
-
- SciTx('\n');
- }
- void main(void) {
- /* put your own code here */
-
- SetBusClock();
- InitSci();
- EnableInterrupts;
- send();
- for(;;) {
- }
-
- }
复制代码 这是我写的串口程序,为什么串口助手里面什么东西都不显示呢?程序我查了好久都没查出什么问题呀。然后我用舵机调试工具也试了一下,也不行,之前用清化那块蕊片是可以用舵机调试工具的,因为烧了,所以买了块龙丘的,现在用不了呀,请问各位高手,是不是龙丘的串口和清华的蕊片串口不一样呀?要怎么改才行呀? |
|