This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

putchar/printf problem

Dear all,

I am having problem with putchar function.

When i am running a "putchar('A');" instruction, i am getting the
Charater 'A' output on the serial window. But when i run next
"putchar('B');" instruction i am not getting the output and the
program goes in hanging condition. This execution i did in debug with
"F10"
i.e step over option.

Same thing if i do with "F11" step option then i get charaters "AB"
both on the Serial window.

Also if run the program using "F5" i.e "Go" command i am getting only
"A" on the Serial display as with "F10".

The poject files are attached with this mail in file "print.zip"

Regards,

Anil

Parents Reply Children

  • The default putchar supplied with the compiler spin-locks on the transmit interrupt (TI) until space is available to transmit.

    If the serial port isn't initialized properly, you can get stuck.

    If you've written an interrupt routine to handle the serial data, you'll need to reimplement putchar(), or your ISR and the default putchar() will be fighting over the TI bit.

    The default routine obeys the XON/XOFF protocol, so if you have serial input, you can stop the port from transmitting.

    Where exactly does your program get hung? What instructions is it trying to execute?

  • Hi,

    I am not able to see "print.zip" file. Could you pls. mail me at anil@telenetsystems.com



    Thanks,
    Anil.