| Swordfish Tutorial - SD/MMC Cards |
|
|
| Monday, 05 October 2009 06:01 | ||||||||||||||||||||||||||||||||||||||||||||
|
This article was designed to put forward the basic use of SD Cards, and kept as simple as possible. If you have any questions regarding the content, please do not hesitate to comment at the bottom of the page!
The capability of being able to store GB's of data will make some microcontroller programmers get a little excited. SD Cards are very easy to use and only have two downsides - the PCB footprint and they operate on 3.3V.
The first option is easy enough, you may need some more info for the footprint design. With the SD Card connectors visible, here's the pinout;
Programming with SD CardsSwordfish ships with a library for SD Cards, and there are some advanced user modules available. For this article, I'll focus on the standard SD Card library "SDFileSystem.bas" as it is both covered in SF Help and there are three sample programs in the SF "Samples\SDMMC" folder. Here's the SDReadWrite.bas program; // device and clock...
Note that I have made three changes to the program;
The above program covers the basics to interfacing with SD Cards, now its time to build the hardware to support it.
Development Board
The SF help file has a circuit diagram for how to interface with SD Cards, however, keep in mind that it uses level shifting circuitry for 5V applications - many of the resistors are not required if a low voltage compatible PIC and 3.3V regulator is used.
This single layer development board is purpose built to interface with SD Cards, and provides headers to work with external circuits/projects. There's also a 3.3V output to power external circuits or connect common grounds. Here's the layout of the board, and schematic below (download
The SD Card socket used for this project was brought from sparkfun electronics for $3.95. Download the bottom copper layout
To program the PIC; simply connect your PICKit to the PICKIT2 PRG 6 pin header and set Vdd to target in the PK2 software (a safe option for in-circuit programming). When complete, plug the PK2 into the other 6 pin header to receive the UART output. ResultsHere's an animated GIF image of the PICKit 2 UART Tool receiving from the PIC;
The final product (top view);
And the bottom view;
Just in case someone *needs* to use 5 volts to drive their PIC, I'll post this image from the SF Help file which is a great example of level shifting;
|
||||||||||||||||||||||||||||||||||||||||||||
| Last Updated ( Saturday, 17 October 2009 09:11 ) | ||||||||||||||||||||||||||||||||||||||||||||
Whos Online
- Roshan
- andyo
- MrDEB
Forum Activity
Must have....delta temperature glowies! - andyo Friday, 12 March 2010 08:55 - [1 reply]
USB 8 Channel Servo Controller - andyo Friday, 12 March 2010 08:33 - [0 replies]
Marching LEDs - jon chandler Friday, 12 March 2010 07:39 - [6 replies]
iHID - graham Friday, 12 March 2010 02:04 - [5 replies]
simulation program - mrdeb Thursday, 11 March 2010 22:52 - [0 replies]
REALISTIC LED candle flicker - mrdeb Wednesday, 10 March 2010 05:48 - [0 replies]
the LCD demo hello world - mrdeb Wednesday, 10 March 2010 05:41 - [29 replies]
Recent Comments
- 2010-03-12 14:26:02 Anony...
What program do you use to capture the simulation to a videofile?
- 2010-03-12 13:15:58 Jon C...
Here's a tip for tying out SD cards. An SD card will fit the flopp...
- 2010-03-11 21:03:32 Jon C...
If this wasn't a class project that had to be done on a PIC16F690 u...
- 2010-03-11 15:30:06 uuu
I am going to send two data from ADC to USART(async mode) to serial...
- 2010-03-05 13:24:23 mrpse...
I was thinking of battery with powered routers or powered for every...
- 2010-03-05 12:17:40 andyo
50 rooms - wow. The XBee modules are very easy to use but I'm not ...
- 2010-03-05 11:46:37 mrpse...
Thanks AndyO. What I have to do is design a device to monitor temp...
- 2010-03-05 03:08:58 andyo
The circuit used for the remote sensor can be found here: [url]http...









Here's a tip for tying out SD cards. An SD card will fit the floppy disk drive cable (that used to be) found in PCs. This link shows how to recycle a connector, but the entire cable could be used, bringing the SD card connections out to a dual-row female header connector.
http://uanr.com/sdfloppy/