Ttelmah Guest
|
|
Posted: Sat Nov 05, 2005 5:27 am |
|
|
You are running off the 'end' of the main, in the transmit program.
This is a 'key' difference between the 'embedded' C, and normal C. In a normal C program, the 'main' is called by the OS, and when it ends, the computer returns to the OS, and any outstanding jobs will be finished. With the embedded C, the 'main' is all that exists, and if you drop off the end, you hit a hidden 'sleep' instruction, which prevents the code running over the whole of memory, but also stops anything else from happening. The 'printf', transfers the characters to the hardware buffers in the chip, and will return, when only one character has transferred. At this point, the code runs off the end of the program, and the UART stops.
If you look at posted examples, you will find 'traps' added at the end of the main, to avoid this. Typically:
while(TRUE) ;
Best Wishes |
|