Shop OBEX P1 Docs P2 Docs Learn Events
C3 board SD card — Parallax Forums

C3 board SD card

MJFMJF Posts: 19
edited 2014-09-14 04:07 in Propeller 1
Is there anyone who knows of an example of reading and writing text files to the SD card on the C3 board in C. Or a good tutorial on the SPI bus in C.

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2014-09-13 17:57
    Here's the PropGCC filetest demo program. It is set up to use the C3 board. The filetest programs implements simple versions of Linux commands such as cat, ls and echo. The source code contains examples of reading and writing files plus several other file functions.
  • MJFMJF Posts: 19
    edited 2014-09-14 00:51
    Thanks for your help, I will give this a go.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-09-14 04:07
    MJF wrote: »
    Is there anyone who knows of an example of reading and writing text files to the SD card on the C3 board in C. Or a good tutorial on the SPI bus in C.
    You should just be able to use the SD card on the C3 with normal C fopen/fread/fwrite/etc calls as long as you select the "C3" board type. The support for the C3 is built into PropGCC. This will require that you add the file driver to your driver list though.
    #include <stdio.h>
    
    extern _Driver _SimpleSerialDriver;
    extern _Driver _FileDriver;
    
    _Driver *_driverlist[] = {
      &_SimpleSerialDriver,
      &_FileDriver,
      NULL
    };
    
Sign In or Register to comment.