![]() |
Forum Index : Microcontroller and PC projects : PicoMite Terminal Device Prototype
Author | Message | ||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day All, This as an idea has been floating around the grey matter for a while, and has finally become a prototype. I work away a lot, and having this to test ideas without firing up a laptop has been a great learning tool. Having the "HELP" system inbuilt is also great when the brain has a moment of fade ![]() The final design is intended to allow you to play around with MMBasic programs on the inbuilt Pico2 using the wireless keyboard / mouse and inbuilt ILI9488 screen (about to be upgraded to ST7796), the keyboard can also be removed and used separately. By connecting a USB lead to an external Pico and using an inbuilt terminal program, be able to edit programs on the connected Pico. By fitting a Pico to the internal headers / POGO pins, same as above. The PicoZero on the left does the Keyboard and Mouse USB to PS2 interface, the keyboard will work with the USB version of the Picomite firmware but the mouse uses an odd reporting method, hence the external processor. The PicoZero on the right is the CDC interface to the external PicoMite / MicroMite. These both use modified versions of the Terminal software from a Silicon Chip Magazine article. The MMBasic terminal program is still a work in progress, mostly works but very crude in places, its looking like 6.01.00 is going to be a big step in the right direction, although a new PCB is already required. I have got to the point of wanting to get the mouse working in my Terminal program, and am asking for some help. According to the manual, using PRINT@(X,Y,M), the (M)ode should, in Mode 5, invert the current pixels, however after much mucking around with ILI9488,ILI9341 and ST7796 LCD's (with MISO connected) I cannot really get a sense of how this works. Also tried this on framebuffers with no success. Ideally this would function like the cursor in the inbuilt editor, inverting the pixels at the cursor location, but I may have simply got the wrong end of the stick, not an uncommon situation... Has anyone had experience with this or can shed any light? The current program uses an array of strings as the framebuffer but is not ideal. The next version will have plastic printed ends on the aluminium channel housing, this unit was folded out of a piece of 1.2mm Aluminium sheet. There is also a much larger version planned using a 7"/8" HDMI LCD and keyboard, but that is a future project. My thanks go out again to Geoff, Peter and everyone else on the backshed who have made MMBasic and the MaxiMite / MicroMite / PicoMite as awesome as it is. Regards, Lyle. ![]() |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7997 |
That's a lovely bit of metal bashing! A really nice, compact design too. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
dddns Guru ![]() Joined: 20/09/2024 Location: GermanyPosts: 553 |
Wonderful handicraft work! ![]() |
||||
EDNEDN Senior Member ![]() Joined: 18/02/2023 Location: United StatesPosts: 156 |
Very nicely done! |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3390 |
Very nice job. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
tgerbic Regular Member ![]() Joined: 25/07/2019 Location: United StatesPosts: 72 |
I am impressed. You don't see much metal crafting like this done these days. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9626 |
Excellent. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
zeitfest Guru ![]() Joined: 31/07/2019 Location: AustraliaPosts: 588 |
Good stuff ! Impressive metalwork too +1 |
||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day, Thanks for all the positive comments, we did metalwork at high school (37 yrs ago) and it has always been a source of pleasure when an idea turns a flat sheet of steel / alloy into something 3 dimensional. Sadly this appears to be another skill that is no longer being taught ![]() The next version will use a simple folded U-channel with 3d printed ends, makes a very simple and solid enclosure for very little outlay. Also having a small guilotine and pan brake makes a world of difference. ![]() Probably a good time to ask before re-inventing the wheel, has anyone written a ANSI / VT100 terminal in MMBasic? Regards, Lyle. |
||||
PhenixRising Guru ![]() Joined: 07/11/2023 Location: United KingdomPosts: 1437 |
Gemini just had a go although it has some weirdness. ![]() ' MicroMite BASIC VT100 Emulator (Simplified Example) ' This code demonstrates the basic parsing logic for common VT100 sequences. ' It assumes a serial connection and direct screen output. ' You will need to adapt serial port settings and screen dimensions. ' --- Configuration --- CONST SERIAL_PORT = 1 ' Adjust to your MicroMite serial port (e.g., 1 for COM1) CONST BAUD_RATE = 115200 ' Adjust to match your host's baud rate CONST SCREEN_WIDTH = 80 ' Standard VT100 width CONST SCREEN_HEIGHT = 24 ' Standard VT100 height ' --- Global Variables --- DIM CURSOR_ROW AS INTEGER DIM CURSOR_COL AS INTEGER DIM PARSER_STATE AS INTEGER ' 0: Normal, 1: ESC received, 2: CSI received DIM PARAMETERS(10) AS INTEGER ' Array to store CSI parameters DIM PARAM_COUNT AS INTEGER DIM CURRENT_PARAM_VALUE AS INTEGER ' --- Initialize Serial Port --- OPEN #SERIAL_PORT, BAUD_RATE, "N81" ' N81: No parity, 8 data bits, 1 stop bit PRINT "MicroMite VT100 Emulator Starting..." PRINT "Waiting for data on Serial Port " & SERIAL_PORT ' --- Initialize Screen State --- CURSOR_ROW = 1 CURSOR_COL = 1 LOCATE CURSOR_ROW, CURSOR_COL ' Set initial cursor position ' --- Main Loop --- DO IF SERREAD(SERIAL_PORT) THEN ' Check if a character is available DIM CH AS BYTE CH = GETC(SERIAL_PORT) ' Read the character SELECT CASE PARSER_STATE CASE 0 ' Normal Mode IF CH = 27 THEN ' ESC character PARSER_STATE = 1 ELSEIF CH >= 32 AND CH <= 126 THEN ' Printable ASCII characters PRINT CHR$(CH); ' Print the character CURSOR_COL = CURSOR_COL + 1 IF CURSOR_COL > SCREEN_WIDTH THEN ' Wrap to next line CURSOR_COL = 1 CURSOR_ROW = CURSOR_ROW + 1 IF CURSOR_ROW > SCREEN_HEIGHT THEN ' Simple scroll: Clear screen and move to top ' For true scrolling, you'd need a screen buffer CLS CURSOR_ROW = 1 END IF LOCATE CURSOR_ROW, CURSOR_COL END IF ELSEIF CH = 13 THEN ' Carriage Return (CR) CURSOR_COL = 1 LOCATE CURSOR_ROW, CURSOR_COL ELSEIF CH = 10 THEN ' Line Feed (LF) CURSOR_ROW = CURSOR_ROW + 1 IF CURSOR_ROW > SCREEN_HEIGHT THEN CLS ' Simple scroll CURSOR_ROW = 1 END IF LOCATE CURSOR_ROW, CURSOR_COL ELSEIF CH = 8 THEN ' Backspace (BS) IF CURSOR_COL > 1 THEN CURSOR_COL = CURSOR_COL - 1 LOCATE CURSOR_ROW, CURSOR_COL PRINT CHR$(32); ' Erase character LOCATE CURSOR_ROW, CURSOR_COL END IF END IF CASE 1 ' ESC received IF CH = 91 THEN ' '[' character (CSI - Control Sequence Introducer) PARSER_STATE = 2 PARAM_COUNT = 0 CURRENT_PARAM_VALUE = 0 FOR I = 0 TO 10: PARAMETERS(I) = 0: NEXT I ' Clear parameters ELSE ' Handle other ESC sequences here if needed (e.g., ESC E for Next Line) ' For now, just reset to normal state if not CSI PARSER_STATE = 0 END IF CASE 2 ' CSI received (ESC [) IF CH >= 48 AND CH <= 57 THEN ' '0' through '9' (digit) CURRENT_PARAM_VALUE = CURRENT_PARAM_VALUE * 10 + (CH - 48) ELSEIF CH = 59 THEN ' ';' character (parameter separator) IF PARAM_COUNT < 10 THEN PARAMETERS(PARAM_COUNT) = CURRENT_PARAM_VALUE PARAM_COUNT = PARAM_COUNT + 1 CURRENT_PARAM_VALUE = 0 END IF ELSE ' Final character of CSI sequence IF PARAM_COUNT < 10 THEN ' Store last parameter if any PARAMETERS(PARAM_COUNT) = CURRENT_PARAM_VALUE PARAM_COUNT = PARAM_COUNT + 1 END IF ' --- Process CSI Command --- SELECT CASE CH CASE 72, 102 ' 'H' or 'f' (Cursor Position) DIM NEW_ROW AS INTEGER DIM NEW_COL AS INTEGER IF PARAM_COUNT = 0 THEN ' ESC [ H or ESC [ f (Home) NEW_ROW = 1 NEW_COL = 1 ELSEIF PARAM_COUNT = 1 THEN ' ESC [ <row> H (Col defaults to 1) NEW_ROW = PARAMETERS(0) NEW_COL = 1 ELSE ' ESC [ <row>;<col> H NEW_ROW = PARAMETERS(0) NEW_COL = PARAMETERS(1) END IF ' Ensure within bounds (MicroMite LOCATE is 1-based) IF NEW_ROW < 1 THEN NEW_ROW = 1 IF NEW_ROW > SCREEN_HEIGHT THEN NEW_ROW = SCREEN_HEIGHT IF NEW_COL < 1 THEN NEW_COL = 1 IF NEW_COL > SCREEN_WIDTH THEN NEW_COL = SCREEN_WIDTH CURSOR_ROW = NEW_ROW CURSOR_COL = NEW_COL LOCATE CURSOR_ROW, CURSOR_COL CASE 74 ' 'J' (Erase in Display) IF PARAM_COUNT > 0 AND PARAMETERS(0) = 2 THEN ' ESC [ 2 J (Clear Screen) CLS CURSOR_ROW = 1 CURSOR_COL = 1 LOCATE CURSOR_ROW, CURSOR_COL END IF ' Add other J parameters (0J, 1J) if needed CASE 75 ' 'K' (Erase in Line) IF PARAM_COUNT > 0 AND PARAMETERS(0) = 2 THEN ' ESC [ 2 K (Clear entire line) ' Move to start of line, print spaces, move back DIM ORIGINAL_COL AS INTEGER = CURSOR_COL LOCATE CURSOR_ROW, 1 FOR I = 1 TO SCREEN_WIDTH: PRINT CHR$(32); : NEXT I LOCATE CURSOR_ROW, ORIGINAL_COL ELSE ' ESC [ K (Clear from cursor to end of line) DIM I AS INTEGER FOR I = CURSOR_COL TO SCREEN_WIDTH PRINT CHR$(32); NEXT I LOCATE CURSOR_ROW, CURSOR_COL ' Move cursor back END IF ' Add other K parameters (0K, 1K) if needed CASE 109 ' 'm' (Select Graphic Rendition - SGR) IF PARAM_COUNT = 0 THEN ' ESC [ m or ESC [ 0 m (Reset attributes) ' MicroMite specific: Reset colors, normal text COLOR 15, 0 ' Assuming white foreground, black background ELSE FOR I = 0 TO PARAM_COUNT - 1 SELECT CASE PARAMETERS(I) CASE 0 ' Reset all attributes COLOR 15, 0 CASE 7 ' Inverse video COLOR 0, 15 ' Black foreground, white background ' Add more SGR parameters here (colors, bold, underline) ' Example for colors (adjust MicroMite color codes): ' CASE 30 TO 37 ' Foreground colors ' COLOR (PARAMETERS(I) - 30), BACKGROUND_COLOR ' CASE 40 TO 47 ' Background colors ' COLOR FOREGROUND_COLOR, (PARAMETERS(I) - 40) END SELECT NEXT I END IF ' Add more CSI commands here (e.g., A, B, C, D for cursor moves, S, T for scroll) CASE ELSE ' Unknown CSI sequence, ignore or print for debugging ' PRINT "Unknown CSI: "; CHR$(CH) END SELECT PARSER_STATE = 0 ' Reset to normal state END SELECT END SELECT END IF LOOP |
||||
javavi![]() Guru ![]() Joined: 01/10/2023 Location: UkrainePosts: 509 |
G'day, I am also very interested in this question!? I use the VT-100 VersaTerm firmware for Pico to access the Internet via a retro Wi-Fi modem on the ESP8266 module.. ![]() Regards, javavi. |
||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day, @Phenix, AI does produce some weirdness, but it got it very similar to my current effort: (still needs work) ' Terminal Escape codes test for MONO Option default integer Option console serial SetPin gp0,gp1,com1 SetPin gp4,gp5,com2 Open "com1:115200,2048" As 1 Open "com2:115200" As 2 Dim cbuff$(28) curl = 1 curc = 1 chrofst = 0 'Interrupt routine???? Do If Loc(1)>0 Then Timer = 0 s$=Input$(1,1) ' Print "SER1=",s$,Asc(s$) Select Case Asc(S$) Case 27:EscSeq Case 13:curc=1' carriage return Case 10 ' line feed Text 0,(curl-1)*12,cbuff$(curl),,1,1 curl=curl+1 If curl>26 Then scrollup Case 8:curc=curc-1:'Print "BKSPC",curl,curc, Case 7 ' dunno where this 7 comes from Case Else cbuff$(curl)=cbuff$(curl)+Space$(60) cbuff$(curl)=Left$(cbuff$(curl),curc-1) cbuff$(curl)=cbuff$(curl)+Chr$(Asc(s$)+chrofst) curc = curc+1 End Select EndIf ' Print #2,Inkey$; snd$=Inkey$:If Asc(snd$)=152 Then snd$=Chr$(8) If Asc(snd$)<>0 Then Print "SER2=",Asc(snd$):Print #2,snd$; If Timer > 100 Then Text 0,(curl-1)*12,cbuff$(curl),,1,1 Timer = 0 EndIf Loop Sub EscSeq escchr$ = GetChr$(1) Select Case escchr$ Case "7","8":scrollup :Exit Sub Case "[":EscCSI End Select End Sub Sub EscCSI CSIS$="" CSIL=0 Do CSIChr$ = GetChr$(1) print CSIchr$; Select Case CSIChr$ Case "m" If csis$="4" Then chrofst=&h3f Else chrofst=0 Exit Do ' Underline Mode 0=off 4=on Case "K" cbuff$(curl)=Left$(cbuff$(curl),curc)+Space$(60) Text 0,(curl-1)*12,cbuff$(curl),,1,1 Exit Do ' Erase Line Case "h","l","t","B": Exit Do ' mouse on / off Case "J" ' [0J = erase from line / [2J = erase all If csis$="2" Then curl=1:curc=1 ' erase all temc = curc For a = curl To 26 cbuff$(curl)=Left$(cbuff$(curl),temc)+Space$(60) Text 0,(curl-1)*12,cbuff$(curl),,1,1 temc=1 Next Exit Do ' erase page CLS Case ";":CSIL = Len(csis$) Case "H" If Len(csis$)=0 Then Exit Sub ' Print csis$,curl,curc Text 0,(curl-1)*12,cbuff$(curl),,1,1 curl=Val(Left$(csis$,csil)) curc=Val(Mid$(csis$,csil+1)) Exit Do Case Else CSIS$=CSIS$+CSIChr$ End Select Loop End Sub Sub Scrollup CLS For i = 1 To 26:cbuff$(i)=Space$(60):Next curl = 1 End Sub Function GetChr$(prt) Do While Loc(prt)=0:Loop GetChr$ = Input$(1,prt) End Function End its getting scary what AI can do, time to hide under a rock... ![]() @Javavi, am I correct in thinking that the PicoMite is doing everything there except being the modem? WOW I guess the question then is would an MMBasic version be better, or is it just to see if it can be done? Regards, Lyle. |
||||
javavi![]() Guru ![]() Joined: 01/10/2023 Location: UkrainePosts: 509 |
VersaTerm - A versatile DIY serial terminal on Pico (RP2040). ![]() https://github.com/dhansel/VersaTerm github.com/dhansel/VersaTerm I think that PicoMite will also be able to emulate the BT-100 terminal on MMBASIC, but for this you need to write such a program. I thought that a solution already exists! |
||||
ManiB Senior Member ![]() Joined: 12/10/2019 Location: GermanyPosts: 134 |
Hello everyone, Especially to our German members, I am currently starting a new project and putting together a DIY kit with all the necessary components (including the circuit board) for the VersaTerm terminal. If anyone is interested, please send me a PM here or reply in the Classic Computing Forum: https://forum.classic-computing.de/forum/index.php?thread/36585-versaterm-ein-diy-serielles-terminal-rp2040-reference-design/ |
||||
frnno967 Senior Member ![]() Joined: 02/10/2020 Location: United StatesPosts: 105 |
Back in 2020 I wrote Maxiterm for the CMM2. Might be fun to port it. https://github.com/frnno967/maxiterm Jay Crutti: Ham Radio Operator, K5JCJ. Computer Enthusiast. Musician. Engineer. |
||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day Jay, Thanks for the heads up, a quick first glance at your terminal program shows how much my own version lacks. ![]() It is certainly a comprehensive looking program ![]() I will have a better look into it when time allows, it would be great to see it ported over to the PicoMite, just not sure its within my programming skill set.... Regards, Lyle. |
||||
PhenixRising Guru ![]() Joined: 07/11/2023 Location: United KingdomPosts: 1437 |
Very nice code ![]() |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |