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

Hyperterminal Intelligence !

Dear All,

Who know how hyperterminal identifies input state of cpu connected to PC via serial port ?
For example when codes in CPU reaches to scanf() func. the hyperterminal switches to input situation and is ready to receive data from user without any extra data exchanging .

Regards.
Majid

Parents
  • "We are unable to type character string in normal mode"

    What is "normal mode?"

    What do you mean, "unable to type?" Do the buttons on your keyboard seize up so that you can't press them?
    Or do you just mean that nothing appears on the Hypoterminal screen when you type?

    For characters to appear on the Hypoterminal (or any other terminal) screen when you type, you need to enable Local Echo.

    "But in that situation we type any char. easily"

    What situation? I though you just said you couldn't type?!

Reply
  • "We are unable to type character string in normal mode"

    What is "normal mode?"

    What do you mean, "unable to type?" Do the buttons on your keyboard seize up so that you can't press them?
    Or do you just mean that nothing appears on the Hypoterminal screen when you type?

    For characters to appear on the Hypoterminal (or any other terminal) screen when you type, you need to enable Local Echo.

    "But in that situation we type any char. easily"

    What situation? I though you just said you couldn't type?!

Children
  • Normal Mode : Connect Time and CPU does any function except input functions
    ex. getchar() or scanf()
    That Situation : When CPU reaches to
    scanf() and waits for serial data from PC
    In Normal mode We type via keyboard and don't see any char in hyper editbox .
    But when cpu run an input command , we can see what we are typing and with an Enter key , our chars transferred to CPU
    Get It ?!

  • "But when cpu run an input command , we can see what we are typing and with an Enter key , our chars transferred to CPU"

    This is because scanf() calls getchar() to receive data from the UART. getchar() in turn calls putchar() to echo those characters back out through the UART. Hyperterminal displays those echoed characters. If the 'CPU' is doing something else you won't see the characters you type appear in the hyperterminal window.

    Most of the format specifiers you use with scanf() delimit their input when a character that is inappropriate for that specifier is received. For instance:

    scanf("%d",&someint);

    If you type '123[Enter]' scanf will return control to the calling function when the enter key is pressed, because that character is not valid as part of an integer. Every time a key is pressed that key will be echoed back to hyperterminal. Note that hyperterminal is completely dumb, it just displays characters received by the PC UART and transmits characters you type out through the PC UART.

  • I think that an (arguably) more conventional means of dealing with user input is to use a simple means of string input (e.g., repetitive getchar()'s until \r) and then parsing the string with sscanf() (or whatever).

    Sidenote: Hmm, several "means" in there -- I should be a patent attorney.