XP Super terminal and Embedded Development Board interaction Skills

Source: Internet
Author: User
Tags clear screen printf

First, Introduction

HyperTerminal is a universal serial interaction software with Windows operating system, which can be configured for router switches and so on. Use a modem, a 0-demodulation cable, or an Ethernet connection, and then call this program to connect to other computers, Telnet sites, bulletin board systems (BBS), online services, and hosts. We can use it to debug the circuit is feasible. Embedded Development Board has the basic serial port, can through the super terminal and the embedded system serial port interaction, causes the Super terminal to become the embedded system "the display".

Use: Start → procedures → attachments → newsletters → HyperTerminal (can be new or use existing connections to configure the device);

Start command: Hypertrm.exe.

Second, the principle of super terminal

The principle of HyperTerminal is not complex, it is the user's input at any time to the serial port (TCP protocol is sent to the network port, here only to say the case of the serial port), but does not show input. It shows the characters received from the serial port. Therefore, the embedded system of the corresponding program should complete the task is:

The launch of their own information, process information to the initiative to run a super terminal host;

Returns the received character to the host (that is, echo), either sending the required or remotely managing the server.

Three, super Terminal common operation

Super Terminal application is relatively simple, and the general serial port software almost.

1, send 0x0c (12): Clear screen;

2, send 0x08 (8): The cursor backspace (note that this does not delete characters);

3, send 0x09 (9); Move the cursor to the right one tab (equivalent to the TAB key);

4. Send 0x0d (13); Move the cursor to the beginning of the line;

5. Send 0x0a (10) or 0x0b (11); Move the cursor to the next row in the same column;

6, send 0x0d and 0x0a, line-changing function (carriage return and line of the problem will be explained later).

Iv. Common problems and solutions

1, to maximize the super terminal, the actual screen is still unchanged.

Reason: The terminal screen size of HyperTerminal is determined by the font size used. It displays itself as 24 lines, 80 or 132 characters per act, and the font is the selected font.

Workaround: On the HyperTerminal View menu, select Font. If you want a larger terminal screen, select a larger font. If you want a smaller terminal screen, select a smaller font.

2, the information you typed does not appear on HyperTerminal.

Reason: The terminal screen displays information that is sent from the remote computer, not from the local computer. In order to view the information you have typed, the remote computer must be able to feedback input information. This may have a time lag between the input information and the terminal screen display information.

Workaround: Make sure that you are connected to the remote computer correctly, and that the remote computer can feed back the user input information (that is, the information that the remote computer or the embedded Development Board is sending to the local computer).

3, ANSI characters can not be displayed correctly.

Reason: The terminal font is not used.

Workaround: On the HyperTerminal View menu, select Font. Click Terminal, and then select OK.

4. When connected to a remote computer, the terminal screen displays meaningless information.

Reason: The correct terminal emulation type was not selected.

Workaround: On the HyperTerminal File menu, select Properties. Select the Settings tab. In the Emulation drop-down box, select the terminal type of the remote computer. HyperTerminal does not support this type if the remote machine type is not listed in the Drop-down box.

5, can not remove characters from the terminal.

Reason: The connected remote computer has control of the characters displayed on the terminal screen. The remote computer expects the cursor to be positioned at a specific location on the screen based on the data that has been sent to the screen. If you change the screen locally, it is possible to potentially interrupt your interaction with the remote computer in a way that the host cannot anticipate or control. Therefore, HyperTerminal does not allow characters to be removed from the screen.

Solution: No. You can actually do this by sending a B (backspace) escape character and a space to the remote computer.

6, with Ctrl + V can not paste data to the terminal screen.

Cause: If you set the terminal key for this connection property, pressing CTRL + V will send an escape sequence to the emulator. Many hosts use Ctrl + V to navigate their systems.

Solution: You can change this setting to Windows key, and then CTRL + V will function correctly. To make changes, click Properties on the HyperTerminal File menu. Click the Settings tab, and then click the Windows Key radio button. When you use the Windows key setting, all function keys, arrow keys, and control keys are executed locally. The recommended option is to use the terminal keys setting, and then paste with the menu

Five, carriage returns and line break differences

First, introduce the origins and differences between the two concepts of "enter" (carriage return) and "line feed". Before the computer appeared, there was a device called the teletype Model 33, which could play 10 characters per second. But it has a problem, that is, after a line of line change, to use 0.2 seconds, just can hit two characters. If there are new characters coming in this 0.2 seconds, the character will be lost. So the developers figured out a way to solve the problem by adding two characters to the end after each line. One is called "carriage return", which tells the typewriter to position the print head at the left edge, and the other is called "line-wrapping", telling the typewriter to move the paper down one line. This is the "line" and "return" of the history, from their English name can also be seen in one or two. Later, the computer was invented, and the two concepts were also on the computer. At the time, memory was expensive, and some scientists thought it would be a waste to add two characters to the end of each line. So, there was a disagreement:

In a Unix system, only "< newline >", or "n", is at the end of each line.

Inside the Windows system, the end of each line is "< return >< change line >", that is, "RN";

Mac system, each line ends with "< return >", or "R".

A direct consequence is that all text becomes a row when the files under the UNIX/MAC system are open in Windows, and Windows files open under Unix/mac, and a ^m symbol may be shown at the end of each line.

It is to be noted that: the ENTER key is used as a combination of RN in the Windows system, and when we enter the return form from the keyboard, the Windows system treats the ENTER key as a RN, and the UNIX system is treated as N, and no matter what system it is, you can use N as a line to enter the ending tag, Just in programming we need to be aware that in the Windows system we will read the character R, we have to distinguish r from the characters that are normally entered.

Windows and UNIX file formats are different, and the problem is generally the/r/n problem. The carriage return (CR) and linefeed (LF) characters are used to represent the next line. And the standard doesn't specify which one to use. There are three different uses: and Windows uses carriage return + newline (CR+LG) to represent the next line (the so-called PC format), and Unix uses a newline (LF) to represent the next line, and the Mac takes the next line with a carriage return (CR). When transferring files between different systems, you need to involve formatting conversions.

Conversion between the two file formats

Unix-> Windows: ' n '-> ' RN '

while (ch = fgetc (in))!= EOF)

{

if (ch = = ' n ')

Putchar (' R ');

Putchar (CH);

}

Just add an ' r ' character to the ' n ' that appears in the Unix file.

Unix <-Windows: ' n ' <-' RN '

The situation from Windows to UNIX is complex, and you can't just remove the ' r ' from the file. Because a carriage return symbol is sometimes embedded at the end of a line of text in a Windows file, this occurs in the hit printer. So before you convert, you have to decide whether ' r ' and ' n ' appear at the same time. If it appears at the same time, remove the ' r ', if it does not appear at the same time, keep ' n '.

Cr_flag = 0; /* No CR encountered yet * *

while (ch = fgetc (in))!= EOF)

{

if (cr_flag && ch!= ' n ') {

/* This CR did not preceed LF * *

Putchar (' R ');

}

if (!) ( Cr_flag = (ch = = ' R '))

Putchar (CH);

}

In HyperTerminal, some of the settings for carriage return conforming to line breaks

End of send line with newline character (ASCII code send)

(HyperTerminal-> Property-> set the->ASCII code to set->ASCII code to send: As the end of the line newline), if checked, then send the data in 0D (R), will be added 0A after 0D (n).

End of incoming line as line feed (ASCII code received)

(HyperTerminal-> Property-> set the->ASCII code to set->ASCII code to send: as a newline character as the end of the incoming line), if checked, then the received data in 0D (R), will be added 0A (n) after 0D.

Also, it is important to note that when we use printf to output information, such as "printf (" ce123 ' CSDN BLOG.N ")", where n is a carriage return line, the string is sent to the HyperTerminal via a serial port to add an R behind or behind N.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.