getchar() / putchar()
c = getchar()
- returns the character in the buffer, if there is one
- returns NULL otherwise
- could check for error (character overrun)
r = putchar(c)
- sends the character to the serial port, if it is not busy
- returns c for normal operation, NULL if port was busy
Simple operation, no need for interrupts while ((c = getchar) == NULL) { }; while (putchar(c) == NULL) { };
Polling doesn’t allow us to do anything else
If we are busy, we might miss a character