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

Serial.c file in the Blinky example

Hi,

What exactly is the purpose for the functions in the file Serial.c (putchar(), getchar()) included w/ the Blinky example? Does the Keil C not have these itself? Or for that matter, the delay() function in Blinky.c uses printf directly, which works fine. Are these for illustrative purpose only?

Confused -

Todd

Parents
  • "So in this case, when printf is called, it uses the putchar included in the project, right?"

    Yes, that's the idea.

    "I somewhat knew this was the case, but I was expecting that there would have to be some sort of explicit linking to have the printf pick up the putchar in the project - I guess that happens automatically?"

    The linker tries to resolve external references in a predetermined order. If it finds a putchar in one of your .obj files it won't go looking for one in the standard library.

Reply
  • "So in this case, when printf is called, it uses the putchar included in the project, right?"

    Yes, that's the idea.

    "I somewhat knew this was the case, but I was expecting that there would have to be some sort of explicit linking to have the printf pick up the putchar in the project - I guess that happens automatically?"

    The linker tries to resolve external references in a predetermined order. If it finds a putchar in one of your .obj files it won't go looking for one in the standard library.

Children