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

How does getchar() work for Serial Communication?

For serial communication programming,
can I simply use getchar() as in CSample
or do I have to use interrupt-driven
one as in INTSIO? What is the difference
between these 2 sample projects?

In CSample, the serial port interrupt is
even not enabled(?), so I wonder if it
can really capture input stream from serial port, or it justs simulate keyboard input as serial port.

If I use interrupt, can I bypass getchar(), and check the serial buffer directly?

Can anybody please tell me what is the
function of getchar() in serial port
programming and how to correctly use it?

I am a beginner of C51 development, any
comments will be greatly appreciated.

Thanks.

Parents
  • My problem is about Serial Communication programming, which method
    should I choose if I am going to develop
    a system whose primary function is
    serial communcation with a host?

    The CSample looks simpler, but I wonder
    if it really works inside the embeded
    system without a keyboard. (Sorry, I
    don't have my hardware design ready
    yet). _getchar() halts the system and
    wait for user input, what happens in
    the embeded system with this function
    call? Or to ask in another way, to wait
    for an input from serial port, which
    funciton should I call?

    The INTSIO looks much more complex. But
    I don't like complexity.

    Any suggestions for a starter C51 programmer?

    Thanks.

Reply
  • My problem is about Serial Communication programming, which method
    should I choose if I am going to develop
    a system whose primary function is
    serial communcation with a host?

    The CSample looks simpler, but I wonder
    if it really works inside the embeded
    system without a keyboard. (Sorry, I
    don't have my hardware design ready
    yet). _getchar() halts the system and
    wait for user input, what happens in
    the embeded system with this function
    call? Or to ask in another way, to wait
    for an input from serial port, which
    funciton should I call?

    The INTSIO looks much more complex. But
    I don't like complexity.

    Any suggestions for a starter C51 programmer?

    Thanks.

Children