Daniel Morley

rs 485 bus

Discussion created by Daniel Morley on Feb 7, 2007
Latest reply on Oct 14, 2009 by Alex O'Donnell
I am trying to recieve a message via the Uart for a MC9S08GT16A.  The following code is my attempt to read a line of text and send it out.  I cannot seem to find any indication that I am recieving data.  
 
 
 
 void RecMsg() {
 byte ix=0;    // String pointer
 byte dummy;    // dummy var for reading SCIS1
 byte nxt_char;
 char msg[8] ;
    SEREN == OFF ;
  SCI1C2_RE = 1;    // enable Rx
 
        
 dummy = SCI1S1;   // 1st half of TDRE clear procedure
 msg[ix++] = dummy;
 while( msg[ix++] != 0x00) {
   nxt_char =SCI1D ; // 2nd half of TDRE clear procedure
    msg[ix++]=nxt_char ;
   while(!SCI1S1_TDRE){
     feedCOP();
   };
 } //end while((SCI1D
 while(!SCI1S1_TC){
   feedCOP();
 };
 if(ix>>1)
 SendMsg(msg);
 
 SCI1C2_TE = 0;
  
} //end RecMsg

Outcomes