Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:10 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CLS and puTTY and TeraTerm

Author Message
VK2AHB
Regular Member

Joined: 28/07/2022
Location: Australia
Posts: 51
Posted: 02:16am 12 Aug 2022
Copy link to clipboard 
Print this post

I'm a newbie to the pico/MMBasic world, but started with BASIC in the 80's with a Sharp PC1211, then C=64. It sure has changed in 40 years!  I'm amazed at the functionality crammed into such a small, cheap device!

I've started with simple stuff, like reading RTC and temperature from bits I've been using with the Auduino Nano.  Sure is interesting to compare the amount of code and libraries required for C++ against MMBasic!  So I print Date, Time and temperature with a delay of 10 seconds, then issue the CLS command.

My immediate problem is CLS in terminal mode. With the VGA monitor, it does as its asked, but in terminal, it keeps printing new lines. I'd appreciate help in what might be a trivial setting.

Paul VK2AHB
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 02:38am 12 Aug 2022
Copy link to clipboard 
Print this post

Hi and welcome.
To erase the terminal, you need to send it the escape codes

ESC[2J Erase the screen


Somewhere in the recent past, there was a post with subs for many of the esc sequences that are commonly used.

Jim
VK7JH
MMedit
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 02:45am 12 Aug 2022
Copy link to clipboard 
Print this post

  TassyJim said  Somewhere in the recent past, there was a post with subs for many of the esc sequences that are commonly used.


Mixtel90's VT100 library for the Micromite console
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 02:48am 12 Aug 2022
Copy link to clipboard 
Print this post

Thanks,
I was almost back to there. I had a couple of pages to go!

Jim
VK7JH
MMedit
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 07:30am 12 Aug 2022
Copy link to clipboard 
Print this post

Hi Paul, and welcome to the forum. :)

I was confused by this originally, don't worry. :) The PicoMite has two output devices, one is a console (which supports ANSI escape codes) and the other is a graphic device. When you first boot up you are in console mode by default. Note that the two devices don't have to be two physical devices, they can be different displays on the same screen. Error and information messages are sent to the console. User output can be to either.

Each device has its own commands to output text:
The console uses PRINT, which puts ASCII characters in cells as expected.
The graphic display uses TEXT, which draws text on a graphic screen at any location.

CLS is actually a graphic command and means nothing to an ANSI console. This is where the ANSI sequence ESC[2J comes from.

There are a lot of these sequences that work on the console. The link that Lizby has given is a library of quite a few useful ones that work on Tera Term.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1233
Posted: 09:06am 12 Aug 2022
Copy link to clipboard 
Print this post


Const el$=Chr$(27)+"["
'
'Your Program
'
'
'
SUB tcls
' clear terminal screen
PRINT el$;"2j";
home
END SUB

SUB home
' cursor top left
PRINT el$;"h";
END SUB

SUB at row,col
PRINT el$;;STR$(row);"h";el$;STR$(col);"g";
END SUB

Sub cur_off
  Print el$"?25l";
End Sub

Sub cur_on
  Print el$;"?25h";
End Sub

tcls= Terminal CLS
home = Cursor to top left
at positions the Cursor to row/column

Cur_off / Cur_on hides the Cursor while redrawing the Screen
Edited 2022-08-12 19:11 by Martin H.
'no comment
 
VK2AHB
Regular Member

Joined: 28/07/2022
Location: Australia
Posts: 51
Posted: 01:12am 13 Aug 2022
Copy link to clipboard 
Print this post

Thanks to all who replied, that was very helpful.

Paul VK2AHB
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025