Not a member yet? Register now and get started.

lock and key

Sign in to your account.

Account Login

Forgot your password?

Implement File I/O

(NEW) Implementing File I/O with SD-Card using Microchip’s File System Library.

Kibacorp has assembled a very useful demo using the Microchip File System Library and SD-Card with the 16 bit Micro Experimenter. The demo can be used as a template for your own data storage and data logging application/experiments with the 16 bit Micro Experimenter. The demo accommodates FAT-16 and FAT-32 file formats and has been successfully tested with SanDisk 256MB, ScanDisk 500MB, and ScanDisk 2GB Flash cards.The demo is limited to have two opened files at a time. The demo illustrates the following library features ( go to Microchip’s web site and review Microchip’s Application Note AN1045 for more details):

  • SPI Interface- communication initialization, command/data transfers using SPI protocol for SD-card
  • FSInit -Initializes card and interface
  • FSfClose- updates file info and closes file
  • FSfopen- opens exiting file or creates new one
  • FSfread- reads opened file
  • FSfseek- changes the position in file
  • FSftell- returns current position in file
  • FSfwrite- writes information to file

Hooks up diagrams using either a SD-Card break out board made by SPARKFUN or a SD Card Adapter kit #32313 from Parallax are provided. They both perform the same interface function for the SD-Card to Experimenter 16, however, with the Spark fun unit you need to add external components. Both configurations use an Acroname RS-232 Serial Interface (S13-SERIAL-INT-CONN) to communicate with a PC using Hyper terminal at 9600 baud 8N1. You can substitute the Acroname USB interface ( S22-USB-SERIAL-INT-CONN) for the RS-232 without any change in hook-up or software demo, however, you will have to install Acroname supplied INF files and USB drivers to accommodate this interface. As you run the demo Hyper terminal will display each successful increment of the demo as it executes ( 17 steps are shown). In addition the LCD screen 3rd line will also display demo status at the same time.

The software was developed using Microchip free IDE and PIC24F C Compiler. You will need to use these tools plus your favorite programmer ( ICD2/3, Real ICE, PICKIT2) to program your Experimenter board.

Download demo software

(Click images for full screen)

Parallax Hookup Configuration

(Click images for full screen)

Spark Fun Hookup Configuration

(Click images for full screen)