Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/28/08 17:49
Read: times


 
#160380 - Extra "R" in printf
Using an Interrupt based UART0 in a Silabs F020 kit.

Also using the following putchar() and putbuf() bsed on a AppNote from Keil :
void putbuf (char c)                             // Write a Character to SBUF

{
  if (!FLG_Sendfull)                             // Transmitt only if buffer not full
     {
       if (!FLG_Sendactive)                      //  and currently not transmitting.
	  {
	    FLG_Sendactive = 1 ; 
	    SBUF0 = c ;                          // Start direct transmission.
         }
       else
	  {
 	   IE = 0xA2 ;                           // Disable serial interrupt during buffer update.
	   outbuf [oend++ & (OLEN-1)] = c ;      // Put char to transmission buffer..
           if (((oend ^ ostart ) & (OLEN-1)) == 0)
              {
		FLG_Sendfull = 1;                // Buffer full
	      }
	   IE = 0xB2 ;                          // Enable Serial Interrupt again
	   }
       }
 }
/*===============================================//

// Replacement routine for standard "putchar" routine. 
The printf function uses this to output a character */

char putchar ( char c )

{
  if ( c == 'n')                                // Expand new line character..
     {
	     while (FLG_Sendfull);               // Wait for space in buffer
	     putbuf (0x0A) ;                     // Send CR before LF for <new line>
     }
  while (FLG_Sendfull);
  putbuf (c);                                    // Send chartacter.
  return (c);
}


WIth the following statement :
printf(" r %02u %02u %02u Hrs AIN0.mV:%#04i AIN1.mV:%#04i n", hour,minute, second, mV_Ch_0, mV_Ch_1);

I get the following on Hyper Terminal:

23 01 00 Hrs AIN0.mV:0021 AIN1.mV:0012R

The "R" at the end is very obstinate. Do not know why ??

Any ideas ??

Thanks

Raghu

List of 3 messages in thread
TopicAuthorDate
Extra "R" in printf            01/01/70 00:00      
   Retyping or copying?            01/01/70 00:00      
      The escaping escape character            01/01/70 00:00      

Back to Subject List