John Douglas

Newbie SCI1 question

Discussion created by John Douglas on Oct 30, 2006
Latest reply on Nov 1, 2006 by Daniel Lundin
HI all.  I'm new to using the HCS12 for serial applications.  I just started using Codewarrior last week so bear with me.  I'm trying to set it up so it receives information from my GPS and displays it on the LCD.  I can hook my GPS up to my computer with a baud rate of 4800 and i can read it through hyperterminal.  All I want to do at this point is trip the SCI1SR1 register so it is equal to 0x02.  When I hook it up to my HCS12 board it doesn't receive anything, and the SCI1SR1 register is 0xC0 when I look at the memory.  I have it hooked up to my SC1 port on my evaluation board (the Dragon 12).   I've been looking in the SCI1SR1 for the RDRF flag to trip.  It doesn't.  Here is my code.  Any help would be great.
 
#define RDRF 0x20   // Receive Data Register Full Bit
#define TDRE 0x80   // Transmit Data Register Empty Bit
 
void SCI1_Init(void) {
 
 
 SCI1BDH=1;  //9600 Baud rate
 SCI1BDL=56;
 
   
 SCI1CR1 = 0;
/*
   7   0    LOOPS
   6   0    WOMS
   5   0    RSRC
   4   0    M
   3   0    WAKE
   2   0    ILT
   1   0    PE
   0   0    PT */
 SCI1CR2 = 0x0C;
/*
   7   0    TIE,
   6   0    TCIE
   5   0    RIE
   4   0    ILIE
   3   1    TE
   2   1    RE
   1   0    RWU
   0   0    SBK */
}
   
char InChar(void) {
 while((RDRF & SCI1SR1)== 0){};  //It gets caught HERE and loops infinitely       
 return(SCI1DRL);
}
       
void InString(char *string, unsigned short max) { 
int length=0;
char character;
 char character1;
 character = InChar();
 
   while(length<max){
     *string++=character;
     length++;
    
   character = InChar();
   }
   
 
writeLine(string, 1);//Writes to LCD
}

Outcomes