我买的是M68KIT912DP256的评估板,编了一个SCI的程序,怎么都调不通,请问什么问题,我的程序如下:
#include <hidef.h> /* common defines and macros */
#include <mc9s12dp256.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dp256b"
void main(void) {
/* put your own code here */
int i;
SCI1BDL = 0x34; //设置波特率为19200
SCI1CR1 = 0x00; //设置8位数据格式,关闭循环模式与奇偶校验
SCI1CR2 = 0x08; //禁止中断,允许发送
TSCR1_TEN = 0x01;
for(i=0;i<10;i++)
{
SCI1DRL = 20;
do{;
}
while(SCI1SR1_TDRE == 0);
SCI1SR1_TDRE = 0;
}
//EnableInterrupts;
/* wait forever */
}
各位大虾能看看什么问题吗?谢谢
SCI1SR1_TDRE被置位1以后,需要读一下SCI1SR1寄存器把TDRE清除传送完成是看SCI1SR1的TC位 给一个例子程序参考
void SCIStartTransmit(char cData)
{
while (!SCI1SR1_TDRE)
{ // ensure Tx data buffer empty }
SCI1DRL = cData; // load data to data register
while (!SCI1SR1_TC) { // wait for Tx complete }
}
[此贴子已经被作者于2005-11-7 10:00:27编辑过]
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |