David Evennou

Simple SCI Polling Receive and Transmit Code

Discussion created by David Evennou on Dec 30, 2006
Latest reply on Dec 31, 2006 by David Evennou
Hi All,
 
I am using the MC908QB8 Demo Board and CW50. I have read through the manual and looked through the posts on this forum for help. I am trying to simply poll the SCI register for an incoming char and then transmit it out the SCI port. My code is listed below, as far as I understand the steps are:
 
1. Check for the SCI Recevier Full Flag. (SCRF)
2. Read the SCI Data Register
3. Check for the SCI Transmitter Empty flag. (SCTE)
4. Write the SCI Data Register
 
 // SCI Loop Test
 for(;:smileywink: /* loop forever */
   {
     __RESET_WATCHDOG(); /* feeds the dog */
   
   if(SCS1_SCRF)  // SCRF Bit - Check for char ready and clear bit
     {
     RChar = SCDR;  // Get SCI Char
     while(!SCS1_SCTE)  //SCTE Bit - wait for transmitter empty
       ;
       SCDR = RChar;   // Send SCI char
     }
   }
My code is not working, any help please?
 
Thanks,
David Evennou
 

Outcomes