#include <MC9S08AW60.h>
extern byte sci_data;
void SCI1_Init(void)
{
/* ### Init_SCI init code */
/* SCI1BD: SBR12=0,SBR11=0,SBR10=0,SBR9=0,SBR8=0,SBR7=0,SBR6=0,SBR5=0,SBR4=1,SBR3=1,SBR2=0,SBR1=1,SBR0=0 */
SCI1BD = 0x1A;
/* SCI1C1: LOOPS=0,SCISWAI=0,RSRC=0,M=0,WAKE=0,ILT=0,PE=0,PT=0 */
SCI1C1 = 0x00;
/* SCI1C2: TIE=0,TCIE=0,RIE=1,ILIE=0,TE=1,RE=1,RWU=0,SBK=0 */
SCI1C2 = 0x2C;
/* SCI1C3: R8=0,T8=0,TXDIR=0,TXINV=0,ORIE=0,NEIE=0,FEIE=0,PEIE=0 */
SCI1C3 = 0x00;
/* SCI1S2: BRK13=0,RAF=0 */
SCI1S2 = 0x00;
}
void SCI1_ReceiveChar(byte *data)
{
*data = SCI1D;
}
void SCI1_SendChar(byte data)
{
while(!SCI1S1_TDRE);
SCI1D = data;
}
void printf0(char *str)
{
while((*str != '\r'))
{
SCI1_SendChar(*str);
if(*str++=='\n')
SCI1_SendChar('\r');
}
__RESET_WATCHDOG(); /* feeds the dog */
}
interrupt 17 void isrSCI1Receive(void)
{
byte data;
SCI1S1_RDRF;
SCI1_ReceiveChar(&data);
sci_data = data;
}
|