Difference between revisions of "MMBASIC on XIAO RP2040"

From Land Boards Wiki
Jump to navigation Jump to search
Line 7: Line 7:
 
* 8 Flash locations for storage.
 
* 8 Flash locations for storage.
 
* Support for SD Card
 
* Support for SD Card
 +
 +
=== MMBASIC 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.
  
 
== Hardware ==
 
== Hardware ==
Line 14: Line 18:
 
* [[SD CARD X49]]
 
* [[SD CARD X49]]
  
==== MMBASIC Credits ====
+
=== Install MMBASIC on Seeed XIAO RP2040 ===
 
 
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.
 
 
 
==== Install MMBASIC on Seeed XIAO RP2040 ====
 
  
 
* Hold down the "BOOT" button
 
* Hold down the "BOOT" button
Line 46: Line 46:
 
</pre>
 
</pre>
  
==== SD Card Wiring ====
+
=== SD Card Wiring ===
  
 
* [[SD_CARD_X49]] card
 
* [[SD_CARD_X49]] card
Line 96: Line 96:
 
|}
 
|}
  
==== SD Configuration ====
+
=== SD Configuration ===
  
 
<PRE>
 
<PRE>
Line 147: Line 147:
 
</pre>
 
</pre>
  
==== GPIO from MMBASIC ====
+
=== GPIO from MMBASIC ===
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 179: Line 179:
 
|}
 
|}
  
==== MMBASIC - Using Pins ====
+
=== MMBASIC - Using Pins ===
  
 
* Digital I/O
 
* Digital I/O
Line 205: Line 205:
 
</pre>
 
</pre>
  
==== Demo Code ====
+
=== Demo Code ===
  
 
* [https://github.com/land-boards/QT-Py/tree/main/MMBASIC/SD_Card SD Card contents]
 
* [https://github.com/land-boards/QT-Py/tree/main/MMBASIC/SD_Card SD Card contents]
Line 211: Line 211:
 
*** Bounces a bit across the [[PROTO16-I2C]] card
 
*** Bounces a bit across the [[PROTO16-I2C]] card
  
==== RS-232 (option) ====
+
=== RS-232 (option) ===
  
 
[[file:DTE_P562-720px.jpg]]
 
[[file:DTE_P562-720px.jpg]]
Line 222: Line 222:
 
</PRE>
 
</PRE>
  
==== MMBASIC Card Stack-up ====
+
=== MMBASIC Card Stack-up ===
  
 
[[file:QTPY49_MMBASIC_P18420-720pxV.jpg]]
 
[[file:QTPY49_MMBASIC_P18420-720pxV.jpg]]

Revision as of 13:23, 20 July 2022

QTPy49 MMBASIC P18412-720px.jpg

Overview

  • BASIC Interpreter for the Raspberry Pi Pico running on XIAO RP2040
  • MMBasic is a Microsoft BASIC compatible implementation of the BASIC language with floating point, integer and string variables, arrays, long variable names, a built in program editor and many other features
  • 8 Flash locations for storage.
  • Support for SD Card

MMBASIC 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.

Hardware

Install MMBASIC on Seeed XIAO RP2040

  • Hold down the "BOOT" button
    • The "B" is written on the board shown to the right
  • Connect the XIAO RP2040 via USB C cable to your computer while still pressing the button
  • The computer then will appear a disk driver(RP1-RP2)
  • Download the PicoMite_Firmware.zip
  • Drag the .uf2 file to the disk drive ("RP1-RP2")
  • Card will re-boot
  • Connect in TeraTerm over serial
  • Free memory
> print mm.ver
 5.070501

> memory

Program:
   0K ( 0%) Program (0 lines)
 124K (100%) Free

RAM:
   1K ( 1%) 3 Variables
   0K ( 0%) General
 155K (99%) Free

SD Card Wiring

Signal SD_CARD_X49 QTPy49 conn QTPy GP PiPico Pin
SPI_SCLK J1-3 J3-6 GP2 GPIO2
SPI_MOSI J1-4 J3-4 GP3 GPIO3
SPI_MISO J1-2 J3-5 GP4 GPIO4
SPI_SS J1-5 J9-3 GP26 GPIO26
GND J1-1 J9-1
VCC (3.3V) J1-7 J9-2

SD Configuration

OPTION SYSTEM SPI GP2, GP3, GP4
OPTION SDCARD GP26
OPTION COLOURCODE ON

  • Verify it is working
> FILES
A:/
   <DIR>  basic
   <DIR>  bmps
   <DIR>  demos
   <DIR>  games
   <DIR>  jpegs
   <DIR>  lbcards
   <DIR>  performance
   <DIR>  wave
8 directories, 0 files

On-Board LED

  • No Built-in support in MMBASIC for the on-board NEOPIXEL
  • Red, Green, Blue LED
  • Pull Low to turn on RGB LED bits
  • At-boot - RGB LED blinks Cyan/Green by MMBASIC
  • Red LED = GP17
  • Green LED = GP16
  • Blue LED = GP25 (Used by MMBASIC)
' Make pins outputs
SETPIN GP17, DOUT:' Red LED
SETPIN GP16, DOUT:' Green LED
SETPIN GP25, DOUT:' Blue LED
' Turn off LEDS
PIN(GP17)=1:' Turn off Red LED
PIN(GP25)=1:' Turn off Blue LED
PIN(GP16)=1:' Turn off Green LED
' Turn on LEDs
PIN(GP17)=0:' Turn on Red LED
PIN(GP25)=0:' Turn on Blue LED
PIN(GP16)=0:' Turn on Green LED

GPIO from MMBASIC

QTPy49 Marking GPIO
A0 GP26 (SD_SS)
A1 GP27
A2 GP28
A3 GP29
I2C_SDA GP6
I2C_SCL GP7
RX GP1
TX GP0

MMBASIC - Using Pins

  • Digital I/O
SETPIN GP27, DIN:' Digital Input
SETPIN GP28, DOUT:' Digital Output
PIN(GP28) = 1:'Digital output

  • Analog Input
SETPIN GP29, AIN:' Analog Input

  • SETPIN(s) for Serial and I2C
SETPIN GP1, GP0, COM1
SETPIN GP6, GP7 I2C2

Demo Code

RS-232 (option)

DTE P562-720px.jpg

  • DCE or DTE card
  • Command to use serial
OPTION SERIAL CONSOLE GP0, GP1

MMBASIC Card Stack-up

QTPY49 MMBASIC P18420-720pxV.jpg