News:

Let's find out together what makes a PIC Tick!

Main Menu

sd card msd

Started by Anton1988, Sep 08, 2021, 12:05 PM

Previous topic - Next topic

Anton1988

Hi guys.
I remember on the old site i saw many posts and downloads about how to write info to an SD card.
I can find some info on how to do it with Proton24, I have found some and am trying to adapt it, but now very successful.
I am not nearly experienced enough for that.
I have PIC18F45k22 chips that i want to use and later to smaller 18F series.
Does anyone have any code for this that i can use and adapt?

John Drew

You might pick up some clues from the "FAT 16/32 file system" posts in the Proton 24 section.
Jim has been doing some work on this.
John

Anton1988

Good evening John.
That is exactly where i am busy at the moment. I am mainly looking at these two threads:
https://protoncompiler.com/index.php/topic,159.msg978.html#msg978
https://protoncompiler.com/index.php/topic,488.msg3228.html#msg3228

I am going through it and changing the setup and some commands that aren't compatible with the 18F series.
Are there other suggestions you were also referring to?

trastikata

I still keep the old FAT16 library for 8bit PICs, if it will do the job for what you need it for, I can share it.

P.s. Anyone knows where is the directory with the installed libraries, i.e. where should I copy it from?

FAT16.jpg

Giuseppe

It might be interesting to share the library in the wiki so it can also be useful to other people in the future.

Anton1988

Good morning trastikata.
Please do share.
You don't maybe have a small sample program for this as well?
After i'm done with this project, i'm going to upload it to the Wiki.
It is also going to make use of an RTC, so it will record if anything goes outside set parameters, for warranty purposes.

trastikata

Hello all,

I'm away from home for 2 weeks and I'll be able to share the original install only then. But I have it installed here on my Laptop and I think it will suffice just to copy the Lib files from the corresponding folder.

Anyone knows which folder to copy it from?

P.s. The library's help is excellent, it would be better referring to it than my programs with very little comments :)

LIB2.jpg LIB1.jpg

Anton1988

Good morning trastikata.
Strange enough i also have the bad habit of leaving comments.
Then a few years later when i have to change something in the project, i cant remember what is where.
But luckily i do all my flowcharts, with registers and variables, so that helps a little.
I believe the include file will be located under C: -> Program Files (x86) -> PDS -> Includes -> Sources
That is where mine is as a default.
Thank you for your willingness to help.
I really don't mind a sample program without comments  ;D

trastikata

#8
I found the entire library in different directory, so I guess you should paste it there.

C:\Users\MyName\PDS\Library

Don't forget to rebuild the library before you start using it in your program. Also you should enable the precompiler and forward variable check.

I've attached the "SD File System" library as well as a ADC data logger I did before for own purposes. I just made a test if it will compile in the latest Positron version - it compiles successfully, but there is no way to test the HEX code since the device in question is at home and as I mentioned, I'll be away for some time. 

It's a very old program with terrible coding, written in a hurry to serve the purpose, so please don't criticize on that :). In this data logger I am reading the ADC sampling period and sampling mode from a .TXT file and then creating and writing the data on a different TXT file. There's also a "Status file" where I log some events.

P.s. This is FAT16 and the SD card should be formatted as such, further the library doesn't read logical drives, meaning you should use a 2GB or less SD card and be formatted as single drive.

Hope this helps,
trastikata   

Anton1988

You sir are amazing. Thank you so much.
This will help me loads on my way.