树莓派Pico和Pico 2基础知识
Basic for the Raspberry Pi Pico and Pico 2

原始链接: https://geoffg.net/picomite.html

PicoMite是一个免费的固件,可将Raspberry Pi Pico/Pico 2 变成一个可使用BASIC编程的微控制器。它采用MMBasic,一个功能全面的BASIC解释器,具有广泛的硬件支持,能够控制LCD、SD卡和WiFi等外设。 它主要用于三种应用:嵌入式控制器(例如防盗报警器)、独立计算机(VGA/HDMI输出,键盘)和联网控制器(Web服务器,互联网访问)。 对于嵌入式控制,程序开发通过USB串口连接到PC进行。MMBasic支持标准BASIC特性,以及文件系统访问(FAT16/32)、I2C、SPI和Raspberry Pi Pico硬件。程序可以保存为开机自动运行,无需连接PC。集成的文件系统和SD卡兼容性允许数据记录和存储。MMBasic兼容GW-BASIC和Micromite,提供快速简便的开发周期。

A Hacker News discussion thread revolves around a "Basic for the Raspberry Pi Pico and Pico 2" project. raphlinus expresses excitement about the upcoming Adafruit Fruit Jam, a complete small computer with various ports and features, making it ideal for porting the project. They note the RP2350's ease in handling DVI/HDMI output compared to the RP2040, achieving 640x480 without overclocking and even 1280x720 at 60Hz with overclocking. Due to limited RAM, they are exploring generating video on the fly. AlexeyBrin highlights PicoCalc from Clockworks as another interesting portable Pico computer. jecel shares a challenge in using 640x480 HDMI, as many tested monitors and TVs didn't support it, requiring them to switch to 1280x720. morninglight shares a helpful introductory video on the topic.

原文

 

The PicoMite firmware for the Raspberry Pi Pico and Pico 2 is a complete operating system with a Microsoft BASIC compatible interpreter and extensive hardware support including touch sensitive LCD panels, SD Cards, WiFi/Internet and much more.

MMBasic is a full featured 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.

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, display information on colour LCD displays, measure voltages, detect digital inputs and drive output pins to turn on lights, relays, etc. All from inside this low cost microcontroller.

The PicoMite firmware is totally free to download and use.

The PicoMite firmware comes in twelve versions that are intended to be used in three general applications depending on the periphal support included in each version (ie, touch sensitive LCD panels, VGA/HDMI output, WiFi/Internet capabibility, etc).  The user manual (at the bottom of this page) goes into this in more detail but, in summary, the three typical applications for the PicoMite firmware are:

  1. Embedded Controller.  This is where the Raspberry Pi Pico or Pico 2 is used as the brains inside some device. For example, a burglar alarm, a heating controller, weather station, etc. This application is described in detail below.
  2. Self Contained Computer.  These have a VGA or HDMI video output and a PS2 or USB keyboard and boot up to display the output of the BASIC interpreter on the video monitor. They make for a simple and fun computer similar to the home computers that were popular in the 70s and 80s, for example the Apple II, Tandy TRS-80, Commodore 64 and others. This is described in more detail here: https://geoffg.net/picomitevga.html
  3. WiFi/Internet Connected Controller.  These supports the wireless interface on the Raspberry Pi Pico W (and 2 W) and using this you can create an embedded controller which has a miniature web server running on the Pico and can access the Internet to get the time, send emails, etc. This is described in more detail here: https://geoffg.net/webmite.html

The following describes the use of the PicoMite firmware as an embedded controller.

When the Raspberry Pi Pico or Pico 2 is used as an embedded controller the program development is done on the device using a terminal emulator on a PC (Windows, Linux or MacOS) connected via a serial over USB interface to the Pico's USB connector.  No special software or hardware is required other than the terminal emulator which is free.  Over this USB interface the programmer can configure features, test BASIC commands, edit the program and run the program.

When the program is complete it can be set to automatically run on power up and the PC connection removed.  The Pico will then independently run its program forever.  The terminal emulator and PC can be reconnected at any time to modify or update the running program.

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.

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

  • SD Cards with FAT16 or FAT32 file systems up to 32GB.  Files can be created and read/written using both sequential or random access.  Directories can be created/deleted and navigated.  Long file and directory names are supported and the files written are fully compatible with Windows, Linux or MacOS.

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

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.

MMBasic on the Raspberry Pi Pico implements a large subset of Microsoft's GW-BASIC plus some more modern programming structures documented in the ANSI Standard for Full BASIC (X3.113-1987) or ISO/IEC 10279:1991.

It is also compatible with the version of MMBasic running on the Micromite and most programs written for the Micromite can be run with little or no change.

The following is the full program for a three channel temperature logger.  Every second it will record on an SD card the date, time and temperature (in °C) from three DS18B20 temperature sensors.  The file is Excel compatible and it can be read by a PC or laptop computer for analysis or graphing.  To terminate the program press any key on the console keyboard.

Open "TemperatureLog.xls" for Output as #1

Do While Inkey$ = ""

  Print #1, Date$ "," Time$ "," TEMPR(GP0) "," TEMPR(GP1) "," TEMPR(GP2)

  Pause 400

Loop 

Close #1

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.

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: https://youtu.be/Cxmjy1nz6MM

Available below in the downloads section is a new version of the PicoMite firmware (V6.00.01). This includes support for both the Raspberry Pi Pico with the RP2040 processor and the Raspberry Pi Pico 2 with the RP2350 processor.  It is a major update that includes many additional features.

The compiled object code (the .uf2 file) for the PicoMite 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).

User Manual (approx 230 pages including a BASIC programming tutorial) DOWNLOAD
PicoMite firmware V6.00.01 (includes the above manual). DOWNLOAD
Known bugs and issues DOWNLOAD

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

Beta Test Version of the Firmware
This is the latest test version of the next firmware release (may include bugs).
DOWNLOAD
User Manual V5.07.03 translated to German by Stefan Hoch
Benutzerhandbuch V5.07.03 ins Deutsche übersetzt von Stefan Hoch
HERUNTERLADEN
MMEdit, a full featured editor for MMBasic (it runs on your PC).  By Jim Hiley WEB SITE

 

 

联系我们 contact @ memedata.com