Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 02:50 20 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Newbie example read and write SD cards on Pi Pico

Author Message
k2backhoe
Regular Member

Joined: 04/12/2021
Location: United States
Posts: 47
Posted: 01:32am 10 Dec 2021
Copy link to clipboard 
Print this post

Simple Instructions for the Newbie to read and write files and MMBasic software to an SD card.  {I wrote this because it is what I wanted to find last week, please feel free to improve it}

1) Make the following connections between a SD Card (such as the Wishiot SD Card Module with SPI Interface Onboard Level Conversion) and a Raspberry Pi Pico
SD Card RasPi Pico
+5 volts VBUS, pin 40
GND GND, pin 38
CS, Card Enable GP15, pin 20
SCK, Clock GP10, pin 14
MOSI, Card Data In GP11, pin 15
MISO, Card Data Out GP12, pin 16
2) insert a micro SD card (capacity 32 GB or less) in the card module
3) Connect a personal computer to the Raspberry Pi Pico with a USB-Micro cord
4) Read and perform the instructions through page 7 of the PicoMite User Manual  
       (Ver 5.07.01 at the time of writing)
5) In command mode (where the Pico prompts you on the terminal with a >), type:
> option reset  {this resets all the options to start you with a clean system}
> option system spi gp10,gp11,gp12 {this must come before option sdcard}
> option sdcard gp15
6) You should not have to type these option commands again even if you reset your computer or disconnect and reconnect the Pi Pico.  You are now set to write a simple program.
7) Type {edit <cr>}
8) Type in the following program:
'TEST PROGRAM, CONTROLLING A SD CARD READER
Open "FOX.TXT" For OUTPUT As #1
Print #1, "THE QUICK BROWN FOX"
Print #1, "WITH SIX DOZEN LIQUOR JUGS"
Close #1
<F1>
> run
>
At this point basic program will have written a file on the micro SD card titled FOX.TXT with two lines.
You can see the file is there by typing
> files
and getting the response
A:/
           49   FOX.TXT
0 directories, 1 files
>
now type in
> save "TEST.BAS"
>
and again ask for the file list
> files
getting the response
A:/
           49   FOX.TXT
         167   TEST.BAS
0 directories, 2 files
>

You have just saved the program above onto the SD card.
It is an exercise to the newbie to extrapolate the above to figure out reading programs (SAVE becomes LOAD) and reading data (PRINT becomes LINE INPUT #1).
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025