problem saving on SD card using fat16

problem saving on SD card using fat16

Postby Madys » Mon Mar 14, 2016 10:49 pm

I am not sure if this is the place I should post it... Sorry if it is not.
I am new at the forum and PICs too.
I have a 18F4550. I need to save a signal from ADC (150 Hz max) and put it on a SD card. It should be (according to my reaserch) fat16 (or fat32) becouse I need to save that in a file,so I can make/do the processing of the signal with a computer (Matlab). I have tried to use the mmcsd library and the compiler shows errors and I dont know what am I doing wrong...
I am using CCS 4.13 compiler.
Could please somebody help me???
Where can I find an example or something. What I need is:
1-create a file in the SD
2-read the ADC (this I know how to do it :) ) and append the data to the file(there is a funtion for that, I suppouse I am using it wrong)
3-Repeat "2" for 8 hours (another reason to use the SD)
Thank you in advance

pd: Obviously english is not my first language, I hope you to underestand
Madys
 
Posts: 4
Joined: Mon Mar 14, 2016 10:02 pm

Re: problem saving on SD card using fat16

Postby ric » Tue Mar 15, 2016 1:13 am

Is there any particular reason you are using CCS C, rather than the Microchip supported XC8 compiler?
Any old examples from Microchip may be designed for their old C18 compiler.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 398
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: problem saving on SD card using fat16

Postby Madys » Tue Mar 15, 2016 5:42 pm

I live in Cuba, here you don´t have many options.. I just copy CSS C 5.3, have not installed it yet... Do you think it will make any difference? Had never heard about XC8 before... My proffesors use CCS C and MikroC.. Thats what we have..
Madys
 
Posts: 4
Joined: Mon Mar 14, 2016 10:02 pm

Re: problem saving on SD card using fat16

Postby vloki » Tue Mar 15, 2016 7:05 pm

ric wrote:Any old examples from Microchip may be designed for their old C18 compiler.

The old microchip MDD examples (C18 compiler) require more RAM than a 4550 can provide.
I tried it last week and you would need a 18Fx6xxx or 18Fx7xxx PIC,

The main reason seems to be that you need several 512 byte RAM regions to handle SD cards.
One for a sector, one for the FAT .... (2k+ bytes)

@Madys
Do you have a good internet connection?
You can download MCHP IDE (>500MB), compilers (>80MB), application notes (AN1045) and code examples for free then.

<edit>What about your programmer/debugger? PICkit3 or something?
vloki
Verified identity
 
Posts: 166
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

problem saving on SD card using fat16

Postby Madys » Thu Mar 17, 2016 5:50 pm

Thanks vloki.
I installed yesterday the 5.(something) version of CCS C and my code, at least compiles without errors and it only uses 25% of memory. I am building right now the programmer to taste it directly on the 18lf4550.
Do you have a good internet connection?

I have been waiting for 40 seconds to open this page... :)
You can download MCHP IDE (>500MB), compilers (>80MB), application notes (AN1045) and code examples for free then

I have 60 Mb a week (yes, I now it most sound crazy, :) )...And even if I had more, USA goverment forbbides laws Cuba to access to some officials webs... I used to enter anyways using free proxys but the university (organism that provides me the internet) blocks them,it is more difficult each day to find a free proxy that has not been block yet.
Hope to find the DC847(need it for the interface with the SD card) soon to taste the program.If it works I will place the code here i case anyone needs it...o I will retorn for help if it does not :D
Madys
 
Posts: 4
Joined: Mon Mar 14, 2016 10:02 pm

Re: problem saving on SD card using fat16

Postby jtemples » Thu Mar 17, 2016 8:18 pm

It should be possible to get FatFS running on an 18F4550. But that assumes XC8 PRO.
jtemples
Verified identity
 
Posts: 162
Joined: Sun May 25, 2014 2:23 am
Location: The 805
PIC experience: Professional 5+ years with MCHP products


Return to SSP (IIC, SPI)

Who is online

Users browsing this forum: No registered users and 1 guest