BASIC on Raspberry Pi Pico
  • BASIC Interpreter
  • BASIC with VGA Display
  • BASIC with WiFi & Internet

  • Maximite Family
  • Colour Maximite 2
  • Original Colour Maximite
  • Monochrome Maximite
  • The Maximite Story

  • Micromite Family
  • Micromite Summary
  • Standard Micromite
  • Micromite Plus
  • The Microbridge

  • Micromite LCD Backpack
  • Micromite LCD Backpack
  • Air Quality Monitor
  • DDS Signal Generator
  • Super Clock
  • Boat Computer MkII
  • Parking Assistant

  • Other Projects
  • Pico Gamer Console
  • Precision Analog Clock
  • Watering Controller
  • Windows/DOS MMBasic
  • ASCII Video Terminal
  • Utility Power Supply
  • Precise Voltage Reference
  • ISM Band Scanner
  • Game of Pong
  • Simple GPS Based Clock

  • Useful Techniques
  • 3D Printed Cases
  • Measuring Capacitor ESR
  • Surface Mount is Easy
  • Programming PIC Micros
  • Custom PC Boards
  • The Gerber Format

  • General Articles
  • Problems in Open Source
  • Hantek DSO-2250 Scope
  • Rigol DS1000 Scope
  • Brickbats

  • WEB Site
  • Home
  • Old or Obsolete Projects
  • About



  •  

     

     

    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Australia (CC BY-NC-SA 3.0)

     BASIC on the Raspberry Pi Pico with VGA

     

    The PicoMiteVGA is a Raspberry Pi Pico with VGA output, PS2 keyboard input, SD card storage and running the free MMBasic interpreter.

    This turns the Raspberry Pi Pico into a low cost self-contained desktop computer, similar to the “boot into BASIC” computers of the 1980s like the Commodore 64, Apple II and Tandy TRS-80.

    You can draw graphics in 16 different colours, show text in multiple fonts and save your programs to an SD card.

    You can have fun writing programs to balance your check book, entertain/teach children about computing and play simple computer games (to name a few activities).

    The PicoMiteVGA firmware is totally free to download and use.

    MMBasic Interpreter

    The PicoMiteVGA boots straight into the MMBasic prompt. At which point you can enter, edit and save the program, test BASIC commands and run the program.

    MMBasic is a Microsoft BASIC compatible implementation of the BASIC language. It is full featured with floating point, 64-bit integers and string variables, long variable names, arrays of floats, integers or strings with multiple dimensions, extensive string handling and user defined subroutines and functions. Typically it will execute a program up to 100,000 lines per second. Embedded compiled C programs can be used for even higher performance.

    Using MMBasic you can use communications protocols such as I2C or SPI to get data from a variety of sensors. You can save data to an SD card, measure voltages, detect digital inputs and drive output pins to turn on lights, relays, etc.

    The emphasis with MMBasic is on ease of use and development. The development cycle is very fast with the ability to instantly switch from edit to run. Errors are listed in plain English and when an error does occur a single keystroke will invoke the built in editor with the cursor positioned on the line that caused the error.

    Documentation

    The User Manual is a comprehensive description of the PicoMiteVGA including circuits for interfacing the VGA monitor, keyboard and SD card. It details all the BASIC commands supported by MMBasic and includes a full tutorial on programming in the BASIC language including plenty of examples.

    The User Manual is over 140 pages and can be downloaded from the bottom of this page.

    The PicoMiteVGA is great for creating simple games.  This Tetris look alike game is included in the firmware download.

    VGA Output

    The VGA output is 640 x 480 pixels in monochrome mode or 320 x 240 pixels in colour mode with 16 colours (1 bit for red, 2 bits for green and 1 bit for blue).

    The VGA output is generated using the second CPU on the RP2040 processor plus one PIO channel so it does not affect the BASIC interpreter which runs at full speed on the first CPU. A few resistors is all that is required to connect the VGA monitor.

    From within your BASIC program you can turn pixels on/off and draw lines, boxes and circles in any colour. Text can be positioned anywhere on the screen and displayed in any colour in a variety of fonts.

    The built-in editor within MMBasic works perfectly with the VGA monitor and PS2 keyboard to allow programs to be edited (with colour coded text) and saved to an SD card.

    Keyboard Input

    The PS2 keyboard connects directly to the Raspberry Pi Pico (via a level shifter) and works as a normal keyboard with the function keys and arrow keys fully operational. It can be configured for the standard US layout used in the USA, Australia and New Zealand or specialised layouts used in the United Kingdom, Germany, France and Spain.

    While PS2 compatible keyboards are not as popular as they used to be there are still plenty for purchase such as this one from Amazon or this one from Altronics or this one from Kogan and many more on eBay.

    Note that you cannot just purchase a USB to PS/2 adapter and use it on any USB keyboard - the keyboard must be designed to suit both USB and PS/2. The USB to PS/2 adapter is a passive device that simply tells the keyboard to switch into PS/2 mode. The best way of telling if a keyboard supports both standards is to check if it comes with an adapter.

    Program and Data Storage

    The firmware will create a pseudo disk drive in the flash memory of the Pico which acts the same as an SD Card.  You can use it to store and load programs and data and access it using the normal BASIC file commands (LOAD, SAVE, OPEN, etc) including random access for database type functionality.  This is done automatically and it is always available.

    For removable storage SD cards can be connected with full support built into MMBasic including the ability to open files for reading, writing or random access and loading and saving programs. SD cards connect directly to the Raspberry Pi Pico and the firmware will work with cards up to 32GB formatted in FAT16 or FAT32. The files created can be read and written on personal computers running Windows, Linux or the Mac operating system.

    Construction Pack for the PicoMiteVGA

    The interfaces to the VGA monitor and keyboard can be built on a small piece of strip board (eg, Veroboard) however a PCB designed for the task makes construction much easier. The Construction Pack (see the download section below) includes four PCB designs that you can use.

    The PCB illustrated on the right is included in the Construction Pack (as Design #1). This is an easy to assemble PCB that implements the VGA output, PS2 keyboard interface and the SD card socket as described in the User Manual. 

    It uses easy to source thru-hole components and can be assembled in under an hour. 

    All 40 pins on the Raspberry Pi Pico are routed to the 40-way connector on the rear of the PCB in the same configuration as that used by the Pico.  This makes it easy to connect external devices as you can consult the pin out diagram in the user manual and then select the corresponding pins on the 40-way connector.

    Getting a PCB made is easy and cheap so using this design is a convenient option. The Construction Pack also includes schematics, parts list, construction notes and everything that you need to build this simple computer.

    This computer (ie, Design #1) was also described in the July 2022 issue of Silicon Chip magazine.  This web page provides a shorter description so, if you would like the full story, you are encouraged to read the magazine article.  Back issues of the magazine can be purchased from Silicon Chip or electronic access can be purchased for about the cost of the printed issue - so it is good value.

    Finding the required parts can be tedious and if you do not want to do that you can buy a complete kit of parts for Design #1 including the PCB from Silicon Chip magazine for just AU$35.  This includes the Raspberry Pi Pico pre programmed with the firmware, so all you need do is plug it in and you are ready to go.  For the full details follow this link.

    Hardware Support

    MMBasic supports all the hardware features of the Raspberry Pi Pico (serial, I2C, SPI, CPU clock, ADC, etc) and adds support for:

    All these features are built into the BASIC interpreter, there is no need to load libraries or write special code.

    Credits

    Peter Mather led the project, ported the MMBasic interpreter to the Raspberry Pi Pico and wrote the hardware device drivers. Geoff Graham wrote the MMBasic interpreter and the manual.  Mick Ames wrote the PIO compiler and its corresponding documentation. The VGA driver code was derived from work by Miroslav Nemecek.

    Help and 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 this firmware are also regulars on this forum.

    Explaining Computers has an informative introduction to the PicoMite VGA: https://youtu.be/kZaWYgIYgd8

    Source Code

    The compiled object code (the .uf2 file) for the PicoMite VGA is free software: you can use or redistribute it as you please. The source code is available from GitHub ( https://github.com/UKTailwind/PicoMiteAllVersions ) and can be freely used subject to some conditions (see the header on the source files).

    New Version

    Available below in the downloads section is a new version of the PicoMite firmware (V5.08.00). This introduces some new features but mostly focuses on bug fixes.

    Downloads

    User Manual (170 pages including a BASIC programming tutorial) DOWNLOAD
    PicoMite firmware V5.08.00 (includes the above manual). DOWNLOAD
    Known bugs and issues DOWNLOAD

    Previous versions of the firmware can be found in the archive.

    Other Downloads

    PicoMite VGA Construction Pack.
    Includes assembly instructions, parts list, schematic, PCB design files, etc.
    DOWNLOAD
    MMEdit, a full featured editor for MMBasic (it runs on your PC).  By Jim Hiley WEB SITE

     

    The PicoMiteVGA has its own built in program editor with search/replace, copy/paste, etc.  When an error occurs the editor will start with its cursor positioned on the line that caused the error.