View previous topic :: View next topic |
Author |
Message |
sdbleed
Joined: 28 Feb 2011 Posts: 3
|
Data logger |
Posted: Mon Feb 28, 2011 8:28 pm |
|
|
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
|
|
Posted: Mon Feb 28, 2011 8:54 pm |
|
|
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
|
|
Posted: Tue Mar 01, 2011 7:33 am |
|
|
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:
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
|
|
Posted: Tue Mar 01, 2011 6:09 pm |
|
|
Thank you very much.
I'll take a look at the example.
Will post again if I have further questions.
Thanks!
Is this correct?
Code: | char myfile[]="first.txt";
|
O do I have to assign a pointer?
Code: |
char *myfile[]="first.txt"; |
|
|
|
|