Difference between revisions of "PicoMite"
Line 76: | Line 76: | ||
'''Sample program''' | '''Sample program''' | ||
[[File:Systeminfo.PNG |270px|right]] | [[File:Systeminfo.PNG |270px|right]] | ||
− | System-Info | + | 'System-Info |
+ | Clear | ||
Print " Rusty Cain Microrusty 2022 " | Print " Rusty Cain Microrusty 2022 " | ||
Print " " | Print " " | ||
Print "------ System Info -----------" | Print "------ System Info -----------" | ||
− | Print "Pico Board ID# " MM.Info(ID) | + | Print " " |
− | Print "Pico CPU Speed " MM.Info(cpuspeed) | + | Print "Pico Board ID# " MM.Info(ID) 'System Board information |
− | + | Print "Pico CPU Speed " MM.Info(cpuspeed) 'CPU Speed | |
− | + | celsius =Pin(temp) | |
− | + | Ctemp = Cint(celsius) 'Round up Celsius number | |
− | fahrenheit = celsius * 1.8 + 32 | + | fahrenheit = celsius * 1.8 + 32 'Convert Celsius to Fahrenheit |
− | Print "Pico CPU Temp " | + | Ftemp =Cint(fahrenheit) 'Round up Fahrenheit number |
+ | Print "Pico CPU Temp " Ctemp " Celsius" Ftemp " Fahrenheit" | ||
+ | Print "PicoMite Version" MM.Info(version) 'PicoMite Version | ||
Print " " | Print " " | ||
Print "------ System Memory ---------" | Print "------ System Memory ---------" | ||
− | Memory | + | Memory 'Show Memory |
Print "------------------------------" | Print "------------------------------" | ||
Print " " | Print " " |
Revision as of 02:31, 9 June 2022
PicoMite
How to use a Raspberry Pi Pico Running the MMBasic Interpreter The PicoMite firmware is totally free to download and use. Link to PicoMite https://geoffg.net/picomite.html
MMBasic Microsoft BASIC compatible implementation of the BASIC language with a built in program editor. Supports floating point, integer and string variables, arrays, long variable names. Using MMBasic with the PICO can control the I/O pins and detect digital inputs and drive output pins low or high. Use communications protocols such as I2C or SPI to get data from a variety of sensors.
Loading the Firmware
Loading the PicoMite Firmware to the Raspberry Pi Pico board. The Raspberry Pi Pico comes with its own built in firmware loader that is easy to use.
Just follow these steps: 1. Download the PicoMite firmware from http://geoffg.net/picomite.html and unzip the file. 2. Identify the firmware which should be named something like “PicoMiteV5.xx.xx.uf2”. 3. Using a USB cable plug the Raspberry Pi Pico into your computer (Windows, Linux or Mac) while holding down the white BOOTSEL button on the Raspberry Pi Pico. 4. The Raspberry Pi Pico should connect to your computer and create a virtual drive (the same as if you had plugged in a USB memory stick) called “RPI-RP2”. This drive will contain two files which you can ignore. 5. Copy the firmware file (with the extension .uf2) to this virtual drive. 6. When the copy has completed the Raspberry Pi Pico will restart and create a virtual serial port on your computer. The LED on the Raspberry Pi Pico will blink slowly indicating that the PicoMite firmware with MMBasic is now running
Set up Virtual Serial Port for Terminal Emulator
In Windows start Device Manager and check the "Ports (COM & LPT)" entry for a new COM port. The terminal emulator that you use should support VT100 emulation as that is what the editor built into the PicoMite expects. If you are using Tera Term do not set a delay between character. Using Putty set the backspace key to generate the backspace character. The PicoMite ignores the baud rate setting so it can be set to any speed (other than 1200 baud which puts the Pico into firmware upgrade mode) I used the following settings with Putty Comm Port9 - Connection Serial - Baud rate 38400 - 8 bits - No parity - Backspace Key = (CTRL H)
User Commands and Program Input
ESC This will cause the editor to abandon all changes and return to the command prompt with the program memory unchanged. F1: SAVE This will save the program to program memory and return to the command prompt. F2: RUN This will save the program to program memory and immediately run it. F3: FIND This will prompt for the text that you want to search for. When you press enter the cursor will be placed at the start of the first entry found. F4: CUT Will copy the marked text to the clipboard and remove it from the program. F5: COPY Will just copy the marked text to the clipboard. DELETE Will delete the marked text leaving the clipboard unchanged.
Writing a basic Program
At the command prompt type EDIT followed by the ENTER key. The editor should start up and you can enter this line: PRINT "Hello World" Press the F1 key in your terminal emulator (or CTRL-Q which will do the same thing). This tells the editor to save your program and exit to the command prompt. At the command prompt type RUN followed by the ENTER key. You should see the message: Hello World
Set date and time
Setting the date June 8 2022 Setting time 2:30 PM At the command prompt type the following: time$ = "14:30:00" date$ = "06/08/2022" print date$ " - " time$
First Program
At the command prompt type EDIT followed by the ENTER key. Enter the following: 'Microrusty 10 For a = 1 To 5 20 Print "Microrusty.com" 30 Next a At the command prompt type RUN followed by the ENTER key or use F2 key.
Sample program
'System-Info Clear Print " Rusty Cain Microrusty 2022 " Print " " Print "------ System Info -----------" Print " " Print "Pico Board ID# " MM.Info(ID) 'System Board information Print "Pico CPU Speed " MM.Info(cpuspeed) 'CPU Speed celsius =Pin(temp) Ctemp = Cint(celsius) 'Round up Celsius number fahrenheit = celsius * 1.8 + 32 'Convert Celsius to Fahrenheit Ftemp =Cint(fahrenheit) 'Round up Fahrenheit number Print "Pico CPU Temp " Ctemp " Celsius" Ftemp " Fahrenheit" Print "PicoMite Version" MM.Info(version) 'PicoMite Version Print " " Print "------ System Memory ---------" Memory 'Show Memory Print "------------------------------" Print " " Print " Time Date " Print " ---------------------------" Print " | " Time$ " | " Date$" |" Print " ---------------------------" Print " " End
Store Program in Flash
To manage these numbered locations in flash you can use the following commands (note that in the following n is a number from 1 to 7): FLASH SAVE n Save the program in RAM to the flash location n. FLASH LOAD n Load a program from flash location n into RAM. FLASH RUN n Run a program from flash location n, clears all variables but does not erase or change the program held in the main program memory. FLASH LIST Display a list of all flash locations including the first line of the program. FLASH LIST n [,all] Lists the program held in location n. Use FLASH LIST n,ALL to list without page breaks FLASH ERASE n Erase flash location n. FLASH ERASE ALL Erase all flash locations. FLASH CHAIN n Load and run a program from flash location n, leaving all variables intact. FLASH OVERWRITE n Erase flash location n and then save the program in RAM to that location.
At the command prompt type : flash save 2
At the command prompt type : flash list
Slot 1 in use: "Microrusty" Slot 2 in use: "System-Info" Slot 3 available Slot 4 available Slot 5 available Slot 6 available Slot 7 available