CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Data logger

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sdbleed



Joined: 28 Feb 2011
Posts: 3

View user's profile Send private message

Data logger
PostPosted: Mon Feb 28, 2011 8:28 pm     Reply with quote

Hello good morning my friends.=D

I would like to ask for guidance on how I can use the fat.c and mmcsd.c as part of a data logger. What are the steps to follow in order to make a data logger?
I would like to store temperature data on sd card continously.
Thank you very much.

I am using a pic18f2520 and ccs c 4.114.
sdbleed



Joined: 28 Feb 2011
Posts: 3

View user's profile Send private message

PostPosted: Mon Feb 28, 2011 8:54 pm     Reply with quote

Code:
fatopen(char *name, char *mode, FILE *fstream)                  ////
////  Opens up a FILE stream to a specified file with the specified  ////
////  permission mode:                                               ////
////             Permissions: "r" = read                             ////
////                          "w" = write                            ////
////                          "a" = append                           ////
////                          "rb" = read binarily                   ////
////             "w" will erase all of the data in the file upon     ////
////              the opening of the file.                           ////
////             "a" will tack on all of the data to the end of the  ////
////              file.                                              ////
////             "r" will keep on reading until the stream           ////
////              hits an '\0'                                       ////
////             "rb" will keep on reading until the amount of       ////
////              bytes read equals the size of the file.
Unlike standard C fopen(), this does not malloc a FILE -       ////
////  instead the caller will have to have allready allocated a      ////
////  a FILE and pass a pointer to it.

Can someone please provide an example on how to use this?
What does it mean to allocate a file and pass a pointer to it?
Thank you very much.
andrewg



Joined: 17 Aug 2005
Posts: 316
Location: Perth, Western Australia

View user's profile Send private message Visit poster's website

PostPosted: Tue Mar 01, 2011 7:33 am     Reply with quote

sdbleed wrote:
Can someone please provide an example on how to use this? (fatopen)
What does it mean to allocate a file and pass a pointer to it?

It means you have a variable like:
Code:
FILE myfile;

Then call:
Code:
fatopen("filename.txt", "r", &myfile);

Have a look in your Examples folder for "ex_fat.c".
_________________
Andrew
sdbleed



Joined: 28 Feb 2011
Posts: 3

View user's profile Send private message

PostPosted: Tue Mar 01, 2011 6:09 pm     Reply with quote

Thank you very much.
I'll take a look at the example.
Will post again if I have further questions.
Thanks! Very Happy Very Happy Very Happy

Is this correct?
Code:
char myfile[]="first.txt";

O do I have to assign a pointer?
Code:

char *myfile[]="first.txt";
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group