大家好!
我们用MC9S08QE32发现串口数据紊乱,但是用MC9S08QE128发现程序正常,请问大家是什么原因? 下面是我们的测试代码:
unsigned char *string1=" Welcome
";
MCU_Init(); /* Function that initializes the MCU */
ISC_init();
SCI_init();
GPIO_Init(); /* Function that initializes the Ports of the MCU */
SCI_TX(string1);
EnableInterrupts; /* enable interrupts */
void SCI_TX(unsigned char * data)
{
char temp;
do
{
while(SCI1S1_TC==0); /*等待发送缓冲区空 */
temp=SCI1S1;
SCI1D=*data; /*向发送缓冲区写入待发送数据 */
data++;
}
while ((*data)!=' ');
while(SCI1S1_TC==0); /*等待发送结束 */
}
void SCI1_SendChar(byte data)
{
char temp;
while(SCI1S1_TC==0);
temp=SCI1S1;
SCI1D = data;
}
此帖出自
小平头技术问答
一周热门 更多>