Question

I'm currently implementing a serial connection terminal in a C++ application under windows. I was communicating with my equipment using Windows hyperTerminal over a serial connection.

For instance with HyperTerminal:

> C (then hit Enter)
> Bla bla bla... Answer from the equipment

With my serial connection on C++:

send("C\n\r");

nothing happend. It just wait for the "End of command" caracter.

After a bit of reading about LF/CR over Jeff Atwood blog, I've tryed any possible combinaisons of CR + LF. None of them does the job.

So my question is, what sequence of caracter does HyperTerminal interpret as "input is typed, let's process".

Ps: My serial connection is working great, I'm using it in both ways for some times now, there is no problems on this side.

Was it helpful?

Solution

It emulates a teletype by default, so sends a carriage return (ASCII code 0x0d or '\r') when you press the Enter key. Keyboards don't have a linefeed key anymore like teletypes used to have so you have to press Ctrl+J to generate a linefeed (ASCII code 0x0a or '\n').

Keep the normal sequence in mind, carriage return is first, "\r\n". You might want to tweak your code if you now use send("C\n\r").

It's been too long since I tinkered with it but iirc it had config to tell it to send a linefeed or a cr+lf when you press Enter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top