FAT16 and breakout board form adafruit

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

FAT16 and breakout board form adafruit

Post by Jordy101091 »

Hi, all

Today I have recieved my micro SD card breakout board from adafruit.


Image

I have connected everything correctly

CLK to port.A - 2
CS to port.A - 0
Data in portA.- 4
Data out port.A - 5

I started with the following macro's:

Init_FAT inside a loop (Until MMC_start = 0) --> when 0 init is OK
after that loop I use macro:

Create_file String "Test.txt"

I suspect when I insert the micro sd into my computer that a file has been created, but nothing.
I have also connected it to the hardware SPI but same result

I really dont know what Im missing or doing wrong hope somebody can explane and help me solve this.

Regards Jordy
the will to learn, should not be stopped by any price

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: FAT16 and breakout board form adafruit

Post by Benj »

Hello Jordy,

Looks like a nice little breakout board.

Can you tell me which version of Flowcode your using? I would recommend updating to v4.5 if you have not already done so.

I would also check that the card is formatted correctly for either FAT16 or FAT32 depending on the settings you are using in Flowcode.

You can use a program called winhex to view the contents of the card and this will show you if any data has been added to the card.

For some slower cards you could try increasing the existing delay or adding a extra delay to the SPI_Byte macro using code customisation. I think this has fixed the problem for other users.

If your struggling to get this working then please attach your Flowcode file and I will give it a once over for you.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Jordy101091 »

Hi Benj,

I have updated to version 4.5 and have created a simple loop in the main program to init the micro SD card with a small delay in it.
But it keeps hanging on waiting for MMC Card.

I dont know what the problem is.

I post my flowchart here

Regards Jordy
Attachments
Aquarium Controller Version 011-a00 PIC18F4455A.fcf
(176.16 KiB) Downloaded 226 times
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Jordy101091 »

Hi benj,

Do I need to use pull-up or pull-down resistors on my DO-DI and CS pins.
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Jordy101091 »

Benj,

I have attached a couple of pictures of what the output is on my scoop

Image

Output signal on CLK pin (Clock)

Image

Output signal on the DO pin (Data Out)

The signal on the datain is something like a sawtooth figure.
When the timebase stands about 20ms and volt per div of about 20mV

Image

Hope you can help me whit this.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Jordy101091 »

Hi, Benj

I Finally got it working, the problem was that I have twisted the data in and data out lines. So i connected it wright and it al works perfectly.
I can even wright data into my .csv file.
I'm hoping that you can help me one more time to do the following thing:

So the goal here is to make a datalog of these items.

Light, Temperature, pH

These thing needs to come in one file that I have pre-made in excel. The flowcode program only needs to fil the missing data.
After the collection of data is completed I need to plug the card into my PC and open the excel sheet and wright away seeing the different graphs.
(see the example file)

I'm hope that this even possible, if its not. Can you give some options that I can do to make this work.

Regards Jordy
Attachments
Example of logfile.xls
(28 KiB) Downloaded 201 times
the will to learn, should not be stopped by any price

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Steve »

Adding data directly to a pre-made XLS file might be tricky because the file format is proprietary and complex. Adding data to a text-only CSV file is easier, but you would lose the graph.

A way around this might be to have an XLS spreadsheet (with graphs) look at an external CSV file for its data - search the Excel help file for "linked data" or "external reference".

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Jordy101091 »

Hi, Benj or Steve,

I have something on my mind that I want to build for my project but I have one problem.
I dont know how to program a windows based program.

My Idea is as follow.

With my flowcode program, I want to create one or more log files for each item: Light Level, Temperature ect.
Lets say I'm creating 4 log-files for each item: Light, Temp, pH and time & Date.

My Idea was, that some how create A windows program that can load-up these files and display them on one side of the screen with all the contents and on the other side, show the different graphs.
And to store that data and give it is own name so you can select witch log you want to see, from a week ago ore a few days, something like that.

I appreciate any effort to help me.
Regards Jordy Kleian,

PS. Or you guys have better solution for this I really want to hear it.
the will to learn, should not be stopped by any price

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Steve »

There are a few ways you can do this. For example...

You could have a HID USB program that pretend to be a keyboard. On your PC, load the Excel file with the graphs and click on the first cell of the data. Then press a button on your hardware, which will then send out the appropriate data as if you were typing it in.

Another way is to use our Internet E-block and create a webpage that retrieves the data and displays it in a browser (you'd need some web programming skills for this).

Or create a program that does everything in hardware without the need for a PC. We have a new VGA E-block coming out soon that will give you an appropriate screen size and resolution for this.

I hope these ideas help.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Jordy101091 »

mmh, sorry steve,

Im a little disapointed that there is no other way around this problem.
I'm afraid that the internet webpage solution is not a good idea because I dont have much space left on my microcontroller.

The idea of an windows based program is that even possible to make.
do you have any more ideas on how to display the logged data graphicaly.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Steve »

Is the first idea (USB HID program generating a virtual keyboard input) not ok for you? I think there's even an article about this approach in our learning centre.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Jordy101091 »

Hi steve I will look into this article, seems to me the most aceptable to try.

With the FAT16 component, when you create a text file (.txt) is it possible to go go down 1 line. just like if you would hit enter on you're keyboard.

I want to try one more thing with this component, I hope that I can create this kind of format:

63, 19:20
65, 19:21
66, 19:22
64, 19:23

I think I know how I'm going to get the 19:20 in one string but I need to know if I can go down one line in the text file.
does it have anything to do with this:

Code: Select all

Move_To_Next_File_Sector
If this is all possible then I'm happy and the problem is gone. 8)

regards Jordy
the will to learn, should not be stopped by any price

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Steve »

You need to add the characters "carriage return" (0x0D) and "line feed" (0x0A) to the end of each line in your string.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Jordy101091 »

Hi steve verry verry thanks for your comment.
But I have one question.

How do I ad these at they end of my string:

I have tryed this: datalog1 = datalog1 + "*" I dont think its right. Can you help me out.

Thanks
jordy Kleian
the will to learn, should not be stopped by any price

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: FAT16 and breakout board form adafruit

Post by Steve »

This should do the trick:

Code: Select all

s = s + "\r\n"

Post Reply