Forums

What does backspace mean in UART?

Started by Unknown February 16, 2005
Hi,
  I am doing the simulation for a system-on-chip project, the processor
is PowerPC and in my code I have something like this,


int main (void) {
   print("Hello \r\n");

   print("ByeBye --\r\n");
   return 0;
}


  But in the simulator I can only see the "\r\n" after "Hello", I can
not see it after "ByeBye --". Instead I see all are 0x8, which is
BackSpace.

  I just wonder why the 2nd line return is missing? And where does all
those BackSpace come from?

Thanks.

clinton__bill@hotmail.com writes:

> I just wonder why the 2nd line return is missing? And where does all > those BackSpace come from?
It's really hard to say given your description. Don't worry about the number "8", those backspaces are essentially just random characters and don't mean anything. My first guess is that your program is exiting before it has finished outputting all the characters. The UART may still be churning out data even after your program has finished and its memory space has been reused and overwritten. Try flushing your output first before exiting, or have your exit() function do this. -- Darin Johnson "You used to be big." "I am big. It's the pictures that got small."
<clinton__bill@hotmail.com> wrote in message
news:1108609604.176248.225770@g14g2000cwa.googlegroups.com...
> Hi, > I am doing the simulation for a system-on-chip project, the processor > is PowerPC and in my code I have something like this, > > > int main (void) { > print("Hello \r\n"); > > print("ByeBye --\r\n"); > return 0; > }
You execute a return in the main() of an embedded system. Most compilers either put the CPU on halt or perform a reset. So your system might just reset and therefore re-initialize the UART before it was able to complete the transmission of the last byte(s). Try replacing the return with while(1), which is an endless loop. Meindert
> You execute a return in the main() of an embedded system. Most compilers > either put the CPU on halt or perform a reset. So your system might just > reset and therefore re-initialize the UART before it was able to complete > the transmission of the last byte(s). Try replacing the return with > while(1), which is an endless loop.
Or with something that waits for the UART to confirm that all the characters have been sent.
> int main (void) { > print("Hello \r\n"); > > print("ByeBye --\r\n"); > return 0; > }
> But in the simulator I can only see the "\r\n" after "Hello", I can > not see it after "ByeBye --". Instead I see all are 0x8, which is > BackSpace.
???? Without posting what the 'print' function does, I'm at a loss. Maybe 'print' does something like 'printf' on your system? Oh, K&R died a decade ago, go for ANSI my friend :-) Al.
On 2005-02-17, Al <alnews67@hotmail.com> wrote:
>> int main (void) { >> print("Hello \r\n"); >> >> print("ByeBye --\r\n"); >> return 0; >> }
> Oh, K&R died a decade ago, go for ANSI my friend :-)
?? The snippet looks ANSI to me... -- Grant Edwards grante Yow! I'm in direct contact at with many advanced fun visi.com CONCEPTS.
Hello Grant Edwards,

My suggestion,  to test, is to put a while (1); loop t the end of your
code to see if this is a problem caused by executing a return. You
will face problems if you do not have any OS and execute a return
from your code. Some compilers, such as the GCC for AVR processors
takes care of this return by a clean up code similar to start up
code.

On 2005-02-20, Nayanip <nps@spectrasmart-dot-com.no-spam.invalid> wrote:
> Hello Grant Edwards, > > My suggestion, to test, is to put a while (1); loop t the end > of your code to see if this is a problem caused by executing a > return.
I think you're addressing the wrong person... -- Grant Edwards grante Yow! ... Get me a GIN at and TONIC!!...make it visi.com HAIR TONIC!!
"mc" <mc_no_spam@uga.edu> writes:

> Or with something that waits for the UART to confirm that all the characters > have been sent.
That's also good. I once had a coworker that needed the "simulation" to actually exit when done, instead of being stuck in a loop, so that Purify and other memory leak detectors could work. -- Darin Johnson I'm not a well adjusted person, but I play one on the net.