What does backspace mean in UART?

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.

Reply to
clinton__bill
Loading thread data ...

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."
Reply to
Darin Johnson

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

Reply to
Meindert Sprang

????

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.

Reply to
Al

??

The snippet looks ANSI to me...

--
Grant Edwards                   grante             Yow!  I'm in direct contact
                                  at               with many advanced fun
                               visi.com            CONCEPTS.
Reply to
Grant Edwards

Hello Grant Edwards

My suggestion, to test, is to put a while (1); loop t the end of you

code to see if this is a problem caused by executing a return. Yo will face problems if you do not have any OS and execute a retur from your code. Some compilers, such as the GCC for AVR processor takes care of this return by a clean up code similar to start u code

Reply to
Nayanip

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!!
Reply to
Grant Edwards

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.
Reply to
Darin Johnson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.