Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Writing to sd card or USB stick from PIC micro controller. Can anyone help?

Status
Not open for further replies.

rikAtee

New Member
Hello there,

I am working on a project to store data displayed on a seven segment display.


I have written the assembly language code to retrieve the signal from the seven segment display and decode it into the binary value.


My next step is storing the output in a file on a sd card or USB stick in a continuous list, like so:
_________________________
Thee txt file on usb stick/sd card:
01001 <--existing data
01000 <--existing data
00111 <--existing data
____ <--write new data here
_________________________

How do I achieve this? I have seen some things in google but without help I am lost. Is there a solution that simply writes the output of PORTA into a list on in a text file? Help is appreciated. Remember I am new and know little. I am eager to learn but simple stuff first please!



Key points:

I am using PIC16F84 micro controller.

PORTB are inputs from the seven segment sisplay.

PORTA are outputs to the storage device.

My code is written in assembly language.

The simpler the better. No bells and whistles please. Not yet!

Willing to change what I have so far.

I am using MPBALB. In wine, no less!


See attachment for my code. It wont be pretty! I started this idea last week.
 

Attachments

  • Retrieve from se&#1.asm
    3 KB · Views: 205
Just do a google search for SD card SPI interface. Most SD cards support it that would be your likley first go. It's not easy though because you have to deal with the file system on the SD card. The easyist way I can think to do this is to create a text file or whatever on the SD card using a computer, using a binary sector editor find out the offset that the data in the txt file starts and ends and hardcode those addresses into your micro controller code, then just keep track of what byte in the file you're currently on and when you get to the end go back to the original offset. It would act like a simple circular buffer.

I checked the datasheet for your PIC, it'll run on 2.0 volts which is good because SD cards require 3.3 volt logic and power, so if you run the whole jobbie at 3.3 volts you won't have to mess with any logic level shifting.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top