PDA

View Full Version : Flash Memory Cards, USB sticks and Excel



timmers
- 20th September 2008, 10:14
Has anyone ever implemented a data logging routine accessible to Excel?

The application is for a flight recorder to store data on a memory card or USB stick, in such a way as to allow import into Microsoft Excel as comma seperated variables (*.CSV) or similar. Collecting around 1200 bytes a second into a USB stick makes a very useful performance analyser and de-bugger.

I think the hardest part is formatting the card in such a way as to make it PC compatible.

Is there any usefull research material you could point me too.


Tim.

HenrikOlsson
- 20th September 2008, 13:28
Writing to an USB stick may be a problem since the PIC is an USB-Slave, just as the USB stick. Writing to a SD-card or similar should be possible with PBP but there aren't any ready made "commands" to do so, you need to write the routines yourself.

If you want to take an easier aproach you might have a look at modules like DOS-on-chip (http://www.dosonchip.com/products/module/module.html) or the MicroDrive. (http://www.sparkfun.com/commerce/product_info.php?products_id=8567) They interface to your PIC via RS232 or SPI and handles all the reading/writing to the SD-card. There are other similar products but their names escape me at the moment.

mackrackit
- 20th September 2008, 14:24
Another possibility would be the FTDI Vinculum VDIP1. I have a couple on the bench and so far I like them. The only draw back I can see is the VDIP has to know EXACTLY how many bits are going to be written to it at a time.

I am planning to use the VDPI for a data logger from a gps module.

For the excel app, write the file as a CSV.

BrianT put together a nice how to, to get started with the VDPI.
http://www.picbasic.co.uk/forum/showthread.php?t=7700

rmteo
- 20th September 2008, 15:08
To read a memory card directly on a PC, if needs to have a FAT file format as in the case of the DOSonChip. Note that the Microdrive, as mentioned in the second post does not have FAT so you cannot read the card directly on a PC.

The simplest solution is to use a PIC18 to write directly to SD/MicroSD or Compact Flash using FAT16/32. You can create CSV files for reading by Excel. I would recommend going with SD or MicroSD (instead of compact flash) as the physical interface to the PIC is simpler (uses much fewer lines) and the cards are smaller and less expensive.
http://home.earthlink.net/~rmteo/sitebuildercontent/sitebuilderpictures/a_109.jpg

skimask
- 21st September 2008, 06:21
In the past, I skipped the FAT16/32 step altogether. I save the data on the SD card (or CF card or whatever) according to the way I want it. When I need to retrieve the data, I just import it using the serial port on the PIC and Hyperterminal on a PC and save it to a file. Do some 'post-processing' on a PC with some VB instead of worrying about trying to reinvent the wheel and write a FAT16 filing system on a PIC.

rmteo
- 21st September 2008, 06:29
Yes, that is definitely a viable solution if it fits the needs of the end user/customer.

skimask
- 21st September 2008, 06:39
Yes, that is definitely a viable solution if it fits the needs of the end user/customer.
True...
I guess in my mind, FAT16/32 support is nice, but is it really worth the programming hassle, much less the code space, instruction cycles, etc. that might be a lot better off used elsewhere.

rmteo
- 21st September 2008, 06:54
Sometimes it is a convenience issue - or the customer just wants a fool-proof system for the average user. See post #2 here:
http://www.picbasic.co.uk/forum/showthread.php?t=9619

skimask
- 21st September 2008, 07:07
Sometimes it is a convenience issue - or the customer just wants a fool-proof system for the average user. See post #2 here:
http://www.picbasic.co.uk/forum/showthread.php?t=9619

Oh, I agree... If a guy is getting paid for it, then sure, use FAT and everything else, especially if you've already got the libraries and/or routines already written...
Biggest program I've got going is a full 18F4685 for that OBD2 reader...OBD2 interface, color gLCD, keypad, serial, SD card, and so on and so on...
Problem is, I'll probably never make any money off it!!! :(

rmteo
- 21st September 2008, 07:11
I also will not make any money off that project either, though - the customer probably will - it was contract design deal.

chuck
- 21st September 2008, 09:56
You could try this from here

http://www.parallax.com/ProductInfo/Microcontrollers/PLXDAQDataAcquisitiontool/tabid/393/Default.aspx

You could use an external eeprom then upload via the serial port striagh into excel I know it's for the basic stamp but should be easily ported over to PBP

I know that sword fish and PDS support the SD card,

skimask
- 22nd September 2008, 04:14
I also will not make any money off that project either, though - the customer probably will - it was contract design deal.

Tell ya what... You make something for me, I'll buy it from you. Then I'll make something for you, and you buy it from me. That way we can both tell people we've made a lot of money from our knowledge! :D

timmers
- 22nd September 2008, 15:32
Thanks for some good ideas, definately helps to discuss a project before you start...

The DOS-ON-CHIP looks the most likely solution, and I will try and order one as soon as.
Regarding the other sugestions of importing and converting, thanks for the thought, but not suitable. Its to go into our GY235 gyro stabilised camera so engineers can pull the card, plug into a laptop or blueberry, e-mail us the latest file then we can suggest fixes or settings issues from the comfort of an office instead of the customer coming back to us.

If anyone is interested there is some demo footage on http://bradeng.com/videos.htm
The whole thing has 9 PIC's inside.
Father Christmas has the model number and elv's can deliver!!


Tim.

BigWumpus
- 27th September 2008, 21:55
I have it done ... with another compiler.
Logger with PIC & SD-Card & CSV ... working !

timmers
- 29th September 2008, 14:00
I have it done ... with another compiler.

... any more details? or are you holding back.

tico
- 29th September 2008, 16:38
Try MikroBasic by mikroelectronica they have support ie library for connecting an sd card directly to a pic via a few resistors.

There are plenty of examples on their forum. and fat is supported

The interconnect is on post 4

chuck
- 29th September 2008, 19:48
Try Proton or sword fish they also include library's to do the job and I think that swordfisfh supports fat32

dragons_fire
- 4th October 2008, 22:46
ive been using a rogue robotics SD card writer for some data logging circuits. http://www.roguerobotics.com/products/electronics/ummc just write data to it with "," in between, and it will open in excel.