Forum: Mikrocontroller und Digitale Elektronik PuTTY -Terminal an MCU: Bildschirm löschen Sequenz ?


von Dirk F. (dirkf)


Lesenswert?

Hallo,
ich habe eine MCU über USB an den PC mit PuTTY Terminal angeschlossen.

Dieser Code läuft:
1
if (com1ReadBuffer[0] == 49) strcpy((char *)com1WriteBuffer,"Eins");
2
if (com1ReadBuffer[0] == 50) strcpy((char *)com1WriteBuffer,"Zwei");

Wenn ich am Keyboard "1" drücke, wird der Text "Eins" geschrieben.
Bei "2" entsprechend "Zwei".

Ich möchte jetzt, dass der Bildschirm vor der Ausgabe eines neuen Wortes 
immer gelöscht wird.
Welches Steuerzeichen muss man da senden ?

von Falk B. (falk)


Lesenswert?

Such mal nach VT 100 terminal codes und form feed.

von Sebastian R. (sebastian_r569)


Lesenswert?


von Dirk F. (dirkf)


Angehängte Dateien:

Lesenswert?

Danke Sebastian.

Bei diesem Code:
1
 if (com1ReadBuffer[0] == 49) strcpy((char *)com1WriteBuffer,"\033[2J Eins");
2
 if (com1ReadBuffer[0] == 50) strcpy((char *)com1WriteBuffer,"\033[2J Zwei");

Wird der Bildschirm jedes mal gelöscht. OK.

Aber er fängt nicht bei Zeile/Spalte 0 mit dem neuen Wort an.

von Dirk F. (dirkf)


Angehängte Dateien:

Lesenswert?

Hier nochmal die Snips:

von Sebastian R. (sebastian_r569)


Lesenswert?

Der Cursor bleibt, wo er war. Den musst du auch noch nach 0,0 
verfrachten. Mit dem Wissen das du hast, müsstest du das aber selber 
herausfinden können :)

von Dirk F. (dirkf)


Lesenswert?

Danke an alle.

Läuft soweit gut:
1
if (com1ReadBuffer[0] == 49) strcpy((char *)com1WriteBuffer,"\033[HEins       ");
2
if (com1ReadBuffer[0] == 50) strcpy((char *)com1WriteBuffer,"\033[HZwei       ");

von Sebastian R. (sebastian_r569)


Lesenswert?

Das ist zwar ein bisschen gepfuscht, aber ich denke, das tuts. Gut 
gemacht!

von Norbert (der_norbert)


Lesenswert?

<ESC>[1;1f
setzt cursor column/row

von Motopick (motopick)


Lesenswert?

Richtig leer bekommt man ein VT100 u. komp. mit einem ESCc.
Das setzt naemlich das Terminal zurueck. :)
Nachteil: Zusammengepfuschter Mischmasch aus Terminalsteuerung und
direkt folgenden Zeichen funktioniert damit nicht.
Ein richtiges VT100 braucht seine Zeit fuer einen Reset.

von Bauform B. (bauformb)


Lesenswert?

Norbert schrieb:
> <ESC>[1;1f

interessant, warum nicht <ESC>[1;1H, kann jemand den Unterschied 
erklären? ECMA-48 schreibt
1
CUP  CSI Pn1;Pn2 04/08   <ESC>[1;1H
2
CUP causes the active presentation position to be moved in the
3
presentation component to the n-th line position according to
4
the line progression and to the m-th character position according
5
to the character path
1
HVP   CSI Pn1;Pn2 06/06   <ESC>[1;1f
2
HVP causes the active data position to be moved in the data
3
component to the n-th line position according to the line
4
progression and to the m-th character position according to
5
the character progression

von Harald K. (kirnbichler)


Lesenswert?

Bauform B. schrieb:
> kann jemand den Unterschied erklären?

https://ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf

Setzt sich wie folgt zusammen:

(Kurzbeschreibung aus Glossar)

Active data position
The character position in the data component which is to receive the 
next graphic character or the next control function from the data stream 
and relative to which certain control functions are to be executed.

Active presentation position
The character position in the presentation component which is to receive 
the next graphic character for graphic image output and relative to 
which certain control functions are to be executed.
NOTE
In general, the active presentation position is indicated in a display 
by a cursor.

Data component
The device component which is used for storing the received data for 
further presentation processing.

Presentation component
The device component which is used for producing the graphic image 
output.


Im Detail:

6.1.1 Presentation component (S. 14 28/108)

6.1.3 Data component (S. 15 29/108)

und vor allem

6.1.5 Relationship between active data position and active presentation 
position (S. 15 29/108)

Fazit: Wohl meistens dasselbe.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.