[求助]超级终端接收不到dg128用sci发送的数据??
- UID
- 343956
- 性别
- 男
|
[求助]超级终端接收不到dg128用sci发送的数据??
大侠们帮帮忙
我写的简单的程序
#include /* common defines and macros */
#include /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
void sci_ini() {
SCI0BDL = 0x9C;
SCI0CR2 = 0x2C;
}
void WriteToSCI0(const char *text){
while (*text != '\0'){
while (!(SCI0SR1 & 0x80)); /* wait for output buffer empty */
SCI0DRL = *text++;
}
}
void WriteToSCI0Data(int a){
while(!(SCI0SR1 & 0x80));
SCI0DRL=a/100+48;
while(!(SCI0SR1 & 0x80));
SCI0DRL=a%100/10+48;
while(!(SCI0SR1 & 0x80));
SCI0DRL=a%10+48;
while(!(SCI0SR1 & 0x80));
SCI0DRL=26;
}
void main(void) {
/* put your own code here */
// DDRB = 0xFF;
sci_ini();
EnableInterrupts;
WriteToSCI0("*");
// WriteToSCI0("\nEnter number (1-9) to change speed or\n'stop' to halt simulation.\n");
for(;;) { WriteToSCI0Data(20);} /* wait forever */
/* please make sure that you never leave this function */
}
|
|
|
|
|
|
- UID
- 175217
- 性别
- 男
|
也许是波特率设置得不对,今天我就碰到这样的问题,改一下波特率也许就行了 |
|
|
|
|
|
- UID
- 343956
- 性别
- 男
|
|
|
|
|
|
- UID
- 161036
- 性别
- 男
|
|
|
|
|
|
- UID
- 343956
- 性别
- 男
|
|
|
|
|
|