SD card storage ideas.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

SD card storage ideas.

Post by 407charles »

Hello guys, I finally finished my Arduino Mega project of an automated oven controller. My controller stores over a hundred recipes containing information such as recipe name, baking time and temperature and other functions, the only thing you have to do is to select the recipe and hit start. It performs the oven temperature changes with times and humidity if needed. Now I got a small issue that It could be a great aid if possible. The thing is that the user have to manually set the recipes to each controller, and It will be fabulous if I could store this eeprom information into a storage device to upload it to the other controllers. It is possible to upload the information stored in the eeprom into an SD card?? Can somebody give me an idea?? Any help will be greatly appreciated.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SD card storage ideas.

Post by Benj »

Hello,

The EEPROM component has an "Initial Values" property which embeds data into the program hex file so you can program the microcontroller with the program and EE data at the same time.

You should be able to use an AVRISP or similar and AVR Studio to read the contents of the current chip including the EE memory.

Otherwise yes it is possible to save the EE data onto a SD card and even populate the EE data from a file on an SD card.

SD read and write examples are available here.
http://www.matrixtsl.com/wikiv7/index.p ... 7bffb583c5

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: SD card storage ideas.

Post by 407charles »

Thanks a lot for your reply, I was checking the initial value property but I did not see how can I set it. Since the controller has the ability of store this values by hand what will be the easiest way to upload this eeprom bytes to an SD card? What function from the FAT menu will be the best? I did some research on the WIKI website yesterday and I think that "write byte to buffer" could be the solution since it contains an address that could be the same as the eeprom address in order to upload and download values correctly. What do you think? If yes could you tell me the steps to go through? I really appreciate your help. Thanks a lot.
Well I tried without success. What do I'm doing wrong? It's the first time I'm using this component and it's more difficult than I thought. The examples are for reading a text but not for entering bytes from user (not for an edited text) If I write in the created file then it shows data at buffer but I want to copy EEprom data. As you can see in the program values are assign to Byte(n) from EEprom but are not upload to FAT. Anyways I tried also by creating and opening a text file. Please I need help.
Attachments
Mega_KS0108_ASCII_Eprom_FAT.fcfx
Here is my program.
(35.75 KiB) Downloaded 364 times

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: SD card storage ideas.

Post by 407charles »

Hi guys I finally succeed with my program! I'm able to create a file and load wherever I written at EEprom memory to a FAT memory. Now, The 512 bit file created is just for the simulator??? Or all the files created on SD card will be at 512 bit in size when using my hardware??? Do I have to create files for every 512 bits of data??? I got no idea of how the memory of an SD card is organized. I already ordered some SD card modules for Arduino and try this on real life. Please, can someone tell me how to manage this???

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SD card storage ideas.

Post by Benj »

Hello,

The SD card uses the FAT16 or FAT32 file system depending on how it is formatted and the memory size of the card.

A file stored on the card will take up a certain amount of space.

The FAT file system uses clusters and sectors to store files.
https://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html

A cluster is a grouping of sectors, usually 32 or 64 and is the minimum allocatable chunk of the card's memory.

A sector is a groups of 512 bytes. When you open a file the first sector of the file is automatically loaded into the 512 byte buffer. If you get to the end of the buffer and are not at the end of the file then the MoveToNextSector macro will load the next sector of the file for you.

The examples from the Wiki should show this in action.

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: SD card storage ideas.

Post by 407charles »

Thanks a lot for the information I could not find it anywhere when I google it. Now I got A better understanding of what has to be done (I believe at least). Unfortunately, I couldn't make the examples from WIKI website, except The FAT_Read_File which I could make it work perfectly (I learn a lot from it), to run on the simulator so I did not see the results to comprehend the program structure.
Last edited by 407charles on Wed Sep 07, 2016 11:39 pm, edited 4 times in total.

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: SD card storage ideas.

Post by 407charles »

I believe I got the right idea.
Last edited by 407charles on Wed Sep 07, 2016 11:40 pm, edited 1 time in total.

Post Reply