Manual / Guide · 2026
PicoMite MMBasic Interpreter — User Manual (Ver 6.02.01)
- picomite
- mmbasic
- raspberry-pi-pico
- user-manual
- rp2040
- rp2350
Manual / Guide · 2026
PicoMite User Manual MMBasic BASIC Interpreter Ver 6.02.01 For the Raspberry Pi Pico Raspberry Pi Pico 2 Raspberry Pi Pico W Raspberry Pi Pico 2 W and modules using the RP2040 and RP2350 processors Revision 1 (23 April 2026) For updates to this manual and more details on MMBasic go to http://geoffg.net/picomite.html and http://mmbasic.com About Peter Mather (matherp on the Back Shed Forum) led the project, ported MMBasic to the Raspberry Pi Pico and wrote the drivers for its hardware features. The MMBasic interpreter and this manual was written by Geoff Graham ( http://geoffg.net ). In addition, many others have supported the project with specialised code, testing and suggestions. Support Support questions should be raised on the Back Shed forum ( http://www.thebackshed.com/forum/Microcontrollers ) where there are many enthusiastic MMBasic users who would be only too happy to help. The developers of the PicoMite firmware are also regulars on this forum. Copyright and Acknowledgments The PicoMite firmware and MMBasic is copyright 2011-2025 by Geoff Graham and Peter Mather 2016-2025. 1-Wire Support is copyright 1999-2006 Dallas Semiconductor Corporation and 2012 Gerard Sexton. FatFs (SD Card) driver is copyright 2014, ChaN. WAV, MP3, and FLAC file support is copyright 2019 David Reid. JPG support is thanks to Rich Geldreich The pico-sdk is copyright 2021 Raspberry Pi (Trading) Ltd. TinyUSB is copyright tinyusb.org LittleFS is copyright Christopher Haster Thomas Williams and Gerry Allardice for MMBasic enhancements The VGA driver code was derived from work by Miroslav Nemecek The CRC calculations are copyright Rob Tillaart PicoCalc enhancements are improved and collated by Ernst Bokkelkamp The compiled object code (the .uf2 file) for the PicoMite firmware is free software: you can use or redistribute it as you please. The source code is on GitHub ( https://github.com/UKTailwind/PicoMiteAllVersions ) and can be freely used subject to some conditions (see the header in the source files). This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This Manual Copyright 2026 Geoff Graham and Peter Mather The author of this manual is Geoff Graham with considerable input by Peter Mather, Harm de Leeuw, Mick Ames and many others on The Back Shed forum. It is distributed under a Creative Commons AttributionNonCommercial-ShareAlike 3.0 Australia license (CC BY-NC-SA 3.0) Page 2 PicoMite User Manual Contents Introduction............................................................................................................................. 9 Firmware Versions and Files ................................................................................................ 10 Self Contained Computer ............................................................................................................................10 Embedded Controller ..................................................................................................................................10 Processor Support .......................................................................................................................................10 PicoCalc Support ........................................................................................................................................10 File Names .................................................................................................................................................10 Loading the Firmware .................................................................................................................................11 Serial Console ...................................................................................................................... 12 Virtual Serial Port .......................................................................................................................................12 Terminal Emulator ......................................................................................................................................12 The Console................................................................................................................................................12 Windows 7 and 8.1 .....................................................................................................................................13 Apple Macintosh.........................................................................................................................................13 Linux ..........................................................................................................................................................13 Android ......................................................................................................................................................13 First Steps ............................................................................................................................ 14 A Simple Program ......................................................................................................................................14 Flashing a LED ...........................................................................................................................................15 Tutorial on Programming in the BASIC Language ......................................................................................15 Hardware Details .................................................................................................................. 16 Third Party Modules ...................................................................................................................................17 WebMite version for the Raspberry Pi Pico W or Pico 2 W .........................................................................17 CPU Variations...........................................................................................................................................17 PSRAM ......................................................................................................................................................18 I/O Pin Limits .............................................................................................................................................18 Power Supply .............................................................................................................................................19 Clock Speed................................................................................................................................................19 Power Consumption....................................................................................................................................19 Using MMBasic..................................................................................................................... 20 Commands and Program Input ....................................................................................................................20 Program Structure .......................................................................................................................................20 Editing the Command Line .........................................................................................................................20 Shortcut Keys .............................................................................................................................................20 Interrupting A Running Program .................................................................................................................21 Setting Options ...........................................................................................................................................21 Saved Variables ..........................................................................................................................................21 Watchdog Timer .........................................................................................................................................21 PIN Security ...............................................................................................................................................21 The Library.................................................................................................................................................22 Program Initialisation..................................................................................................................................22 MM.STARTUP ..........................................................................................................................................22 MM.PROMPT ............................................................................................................................................23 MM.END ...................................................................................................................................................23 PicoMite User Manual Page 3 Full Screen Editor ................................................................................................................. 24 Edit Functions.............................................................................................................................................24 Mark Mode .................................................................................................................................................25 Alternate Keys ............................................................................................................................................25 Long Lines .................................................................................................................................................25 Using a Mouse ............................................................................................................................................26 Colour Coded Editor Display ......................................................................................................................26 Variables and Expressions ................................................................................................... 27 Variables ....................................................................................................................................................27 Constants ....................................................................................................................................................27 OPTION DEFAULT...................................................................................................................................27 OPTION EXPLICIT ...................................................................................................................................28 DIM and LOCAL .......................................................................................................................................28 STATIC......................................................................................................................................................29 CONST ......................................................................................................................................................29 Special Characters in Strings.......................................................................................................................29 Expressions and Operators ..........................................................................................................................30 Mixing Floating Point and Integers .............................................................................................................31 Structures ...................................................................................................................................................31 64-bit Unsigned Integers .............................................................................................................................32 Subroutines and Functions ................................................................................................... 33 Subroutines.................................................................................................................................................33 Functions ....................................................................................................................................................33 Passing Arguments by Reference ................................................................................................................33 Passing Arrays ............................................................................................................................................34 Early Exit ...................................................................................................................................................34 Recursion ...................................................................................................................................................34 Examples ....................................................................................................................................................35 Video Output ........................................................................................................................ 36 VGA Video ................................................................................................................................................36 HDMI Video ..............................................................................................................................................36 VGA/PS2 Reference Design (Raspberry Pi Pico) ........................................................................................37 HDMI/USB Reference Design (Raspberry Pi Pico 2) ..................................................................................38 Keyboard/Mouse/Gamepad.................................................................................................. 39 PS2 Keyboard on the Raspberry Pi Pico (RP2040) ......................................................................................39 PS2 Keyboard on the Raspberry Pi Pico 2 (RP2350) ...................................................................................39 PS2 Mouse .................................................................................................................................................39 USB Interface .............................................................................................................................................40 USB Hub ....................................................................................................................................................40 USB Keyboard............................................................................................................................................40 USB Mouse ................................................................................................................................................40 USB Gamepad ............................................................................................................................................40 Configuring the Keyboard...........................................................................................................................40 Using a Mouse ............................................................................................................................................41 Program and Data Storage................................................................................................... 42 Flash Slots ..................................................................................................................................................42 Flash Filesystem .........................................................................................................................................42 Page 4 PicoMite User Manual SD Cards ....................................................................................................................................................43 Combined Chip Select ................................................................................................................................44 MMBasic Support for Flash and SD Card Filesystems ................................................................................44 XModem Transfer ......................................................................................................................................46 Load and Save Image ..................................................................................................................................46 Example of Sequential I/O ..........................................................................................................................47 Random File I/O .........................................................................................................................................48 Sound Output ....................................................................................................................... 49 Pulse Width Modulated (PWM) Signal .......................................................................................................49 Filter Circuits..............................................................................................................................................49 VS1053 support ..........................................................................................................................................50 MCP48n2 DAC ..........................................................................................................................................50 Playing WAV, FLAC, MP3 and MOD Files ...............................................................................................50 Generating Sine Waves ...............................................................................................................................51 Using PLAY ...............................................................................................................................................51 Utility Commands.......................................................................................................................................51 Specialised Audio Output............................................................................................................................51 Using the I/O pins ................................................................................................................. 52 Digital Inputs ..............................................................................................................................................52 Analog Inputs .............................................................................................................................................52 Counting Inputs ..........................................................................................................................................53 Digital Outputs ...........................................................................................................................................53 Pulse Width Modulation .............................................................................................................................53 Communications Interfaces (Serial, SPI and I2C).........................................................................................54 Interrupts ....................................................................................................................................................54 Special Device Support ........................................................................................................ 56 Infrared Remote Control Decoder ...............................................................................................................56 Infrared Remote Control Transmitter ..........................................................................................................57 Measuring Temperature ..............................................................................................................................57 Measuring Humidity and Temperature ........................................................................................................58 Real Time Clock Interface ..........................................................................................................................58 Measuring Distance ....................................................................................................................................59 LCD Display ..............................................................................................................................................59 Keypad Interface.........................................................................................................................................60 WS2812 Support.........................................................................................................................................61 OV7670 Camera module.............................................................................................................................61 Display Panels ...................................................................................................................... 62 SPI Based Display Panels ...........................................................................................................................62 I2C Based LCD Panels ................................................................................................................................64 8-bit Parallel LCD Panels............................................................................................................................64 Connecting an 8-bit parallel LCD Panel ......................................................................................................65 Configuring an 8-bit parallel LCD Panel .....................................................................................................66 8 and 9 inch Displays ..................................................................................................................................67 16-bit Parallel LCD Panels..........................................................................................................................67 RP2350 Extended Display Support .............................................................................................................68 VGA222 drivers .........................................................................................................................................68 Backlight Control .......................................................................................................................................69 PicoMite User Manual Page 5 Touch Support ............................................................................................................................................69 Calibrating the Touch Screen ......................................................................................................................70 Touch Functions .........................................................................................................................................70 Touch Interrupts .........................................................................................................................................70 LCD Display as the Console Output............................................................................................................70 Example SPI LCD Panel Configuration.......................................................................................................71 Graphics Functions............................................................................................................... 73 Supported Hardware ...................................................................................................................................73 Colours .......................................................................................................................................................74 Screen Coordinates .....................................................................................................................................74 Fonts ..........................................................................................................................................................75 Embedded Fonts .........................................................................................................................................75 Drawing Commands ...................................................................................................................................76 Rotated Text ...............................................................................................................................................77 Transparent Text .........................................................................................................................................77 Framebuffers and Layers.............................................................................................................................77 BLIT and Sprite Commands........................................................................................................................78 Load Image.................................................................................................................................................79 Advanced Graphics .....................................................................................................................................79 LCD Graphics Example ..............................................................................................................................79 WiFi and Internet Functions.................................................................................................. 81 Connecting to a WiFi Network....................................................................................................................81 Remote Console Access ..............................................................................................................................81 File Transfer ...............................................................................................................................................82 Getting the Time .........................................................................................................................................82 Implementing a Web Server ........................................................................................................................82 Live Graphical Data in a WEB Page ...........................................................................................................84 A Complete General Purpose Server ...........................................................................................................85 A Typical WEB Page ..................................................................................................................................86 Input Fields and Control..............................................................................................................................86 Implementing a TCP Client.........................................................................................................................87 Using UDP .................................................................................................................................................87 Sending EMails ..........................................................................................................................................88 Base 64 Encoding .......................................................................................................................................89 MQTT Client ..............................................................................................................................................89 Ping ............................................................................................................................................................89 Streaming audio ..........................................................................................................................................90 Long Strings ......................................................................................................................... 91 Long String Variables .................................................................................................................................91 Long String Commands ..............................................................................................................................91 Long String Functions.................................................................................................................................92 MMBasic Characteristics ...................................................................................................... 93 Naming Conventions ..................................................................................................................................93 Constants ....................................................................................................................................................93 Implementation Characteristics ...................................................................................................................93 Compatibility..............................................................................................................................................94 Page 6 PicoMite User Manual Predefined Read Only Variables .......................................................................................... 95 Detailed Listing ..........................................................................................................................................95 Options ............................................................................................................................... 101 Detailed Listing ........................................................................................................................................ 101 Commands ......................................................................................................................... 112 Detailed Listing ........................................................................................................................................ 112 Functions ............................................................................................................................ 185 Detailed Listing ........................................................................................................................................ 185 Obsolete Commands and Functions .................................................................................. 202 Detailed Listing ........................................................................................................................................ 202 Appendix A – Serial Communications ................................................................................ 203 I/O Pins .................................................................................................................................................... 203 Commands................................................................................................................................................ 203 The OPEN Command ............................................................................................................................... 203 Examples .................................................................................................................................................. 204 Reading and Writing ................................................................................................................................. 204 Interrupts .................................................................................................................................................. 204 Appendix B – I2C Communications .................................................................................... 205 I/O Pins .................................................................................................................................................... 205 I2C Master Commands .............................................................................................................................. 205 I2C Slave Commands ................................................................................................................................ 206 Errors ....................................................................................................................................................... 207 7-Bit Addressing ....................................................................................................................................... 207 Examples .................................................................................................................................................. 207 Appendix C – 1-Wire Communications ............................................................................... 208 Appendix D – SPI Communications.................................................................................... 209 I/O Pins .................................................................................................................................................... 209 SPI Open .................................................................................................................................................. 209 Transmission Format ................................................................................................................................ 209 Standard Send/Receive ............................................................................................................................. 209 Bulk Send/Receive.................................................................................................................................... 210 SPI Close .................................................................................................................................................. 210 Examples .................................................................................................................................................. 210 Appendix E – Regex Syntax ............................................................................................... 211 Using Regular expressions with OPTION ESCAPE .................................................................................. 212 Appendix F – The PIO Programming Package................................................................... 213 Introduction to the PIO ............................................................................................................................. 213 Availability of PIOs .................................................................................................................................. 213 Overview of PIO....................................................................................................................................... 213 Programming PIO ..................................................................................................................................... 214 Configuring PIO ....................................................................................................................................... 215 FIFO's....................................................................................................................................................... 217 DMA To and From the FIFOs ................................................................................................................... 219 PicoMite User Manual Page 7 Appendix G – Sprites.......................................................................................................... 224 Appendix H – Turtle Graphics ............................................................................................ 226 Appendix I – Special Keyboard Keys................................................................................. 228 Appendix J – Programming in BASIC - A Tutorial ............................................................. 230 Command Prompt ..................................................................................................................................... 230 Structure of a BASIC Program .................................................................................................................. 230 Comments ................................................................................................................................................ 231 The PRINT Command .............................................................................................................................. 231 Variables .................................................................................................................................................. 232 Expressions............................................................................................................................................... 233 The IF Statement ...................................................................................................................................... 234 FOR Loops ............................................................................................................................................... 236 Multiplication Table ................................................................................................................................. 237 DO Loops ................................................................................................................................................. 237 Console Input ........................................................................................................................................... 238 GOTO and Labels ..................................................................................................................................... 239 Testing for Prime Numbers ....................................................................................................................... 240 Arrays....................................................................................................................................................... 242 Integers ..................................................................................................................................................... 243 Strings ...................................................................................................................................................... 243 Manipulating Strings...............................................