那位大虾帮忙看一下这个mc9s12xs128的串口程序那里错了!该怎么写!唉!小弟是刚学单片机不久的!!特向各位请教了!在这先感谢了!!!
#include <hidef.h> /* common defines and macros */
#include <MC9S12XS128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12xs128"
#define ReSendStatusR SCI0SR1
#define ReTestBit 5
#define SendTestBit 7
#define ReSendDataR SCI0DLR
unsigned char INT8U;
void SCIInit(void);
//void SCISend1(INT8U o)
//void SCIRel(INT8U *p)
#ifndef ISR_H
#define ISR_H
#define ENABLE_INTERRUPTS _asm_("cli")
#define DISABLE_INTERRUPTS _asm_("sei")
#define EnableSCIReInt SCI0CR2 |=0x20
#define DisableSCIReInt SCI0CR2 &=0xdf
#endif
void SCIInit(void)
{
INT8U t;
SCI0BDL=0x80;
SCI0BDH=0x00;
t=SCI0DRL;
t=SCI0SR1;
SCI0CR2=0x2c;
}
void _attribute_((interrupt)) ISR_Receive(void)
{
INT8U i;
INT8U SerialBuff[1];
DISABLE_INTERRUPTS;
i=SCIReN(1,SerialBuff);
if (i==0) SCISendN(1,SerialBuff);
ENABLE_INTERRUPTS;
}
void _attribute_((interrupt)) ISR_Empty(void)
{
}
void main(void)
{
DISABLE_INTERRUPTS;
SCIInt();
EnableSCIReInt;
ENABLE_INTERRUPTS;
void ISR_Receive(void);
void _attribute_((interrupt)) ISR_Receive(void);
void _start(void);
/* put your own code here */
//EnableInterrupts;
for(;;) {
} /* wait forever */
/* please make sure that you never leave this function */
} |