| 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
- andyo
- Jon Chandler
Forum Activity
LCD / 18F1320 - jon chandler Saturday, 20 March 2010 07:58 - [4 replies]
A 'throw-away" PIC board - mrdeb Thursday, 18 March 2010 06:19 - [32 replies]
Credit Where Credit's Due - jon chandler Tuesday, 16 March 2010 12:01 - [9 replies]
Marching LEDs - mrdeb Saturday, 13 March 2010 22:54 - [7 replies]
USB 8 Channel Servo Controller - andyo Saturday, 13 March 2010 01:19 - [2 replies]
Dedicated Servo Controller - graham Friday, 12 March 2010 17:58 - [0 replies]
Must have....delta temperature glowies! - graham Friday, 12 March 2010 17:31 - [3 replies]
Recent Comments
- 2010-03-21 03:31:04 22her...
Do you have a model number for the ZIFs? Know of a reputable place...
- 2010-03-20 07:58:45 andyo
Nice. The TAP-28 boards are looking good. When I've had a buzzi...
- 2010-03-19 22:05:12 ozbec...
The author (Hop) suggests to "set the target PIC's configuratio...
- 2010-03-17 22:58:18 Jon C...
Graham, Thanks for fixing the spacing on the array. This is how i...
- 2010-03-17 21:14:34 ASDne...
Thanks Graham, It is a problem with Flowcode because the demo wa...
- 2010-03-17 19:50:32 Graha...
Looks like you've pretty much solved every minor issue that was enc...
- 2010-03-17 11:42:03 Jon C...
The low-cost servo does have one other feature. The origina...
- 2010-03-17 10:56:44 Graha...
I am not familiar with flowcode, though did you try powering the bo...









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/