View previous topic :: View next topic |
Author |
Message |
future
Joined: 14 May 2004 Posts: 330
|
PIC18F + USB Pen Drive |
Posted: Wed Aug 11, 2004 7:19 am |
|
|
Has anyone tried it?
I am looking for a simple way to datalog some info in my application, I think this would be the best/easiest way to do it. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed Aug 11, 2004 8:13 am |
|
|
I have never looked into it, but connecting an USB Pen Drive might be difficult because some of those devices download the driver code from the host, and now your PIC18F has become the host....
Why not interface a memory card directly to your PIC? The SD/MMC and CompactFlash cards are the choice for new designs. SD/MMC has the advantage of serial access with only 4 to 6 wires. The SD-card has some nasty design issues, documentation is only available after paying an expensive yearly license fee. I would recommend CompactFlash which requires about 13 I/O lines but has no license fee and is much easier to implement. In case of a shortage on I/O lines you could add one of the I2C-based I/O expanders (Philips).
Ofcourse you want to read the data on your PC. You could implement a FAT16 directory structure and all the management routines for this, but that's a lot of work and takes about 10k of code space. A quick and dirty hack (I love those) is to hard code a FAT16 or FAT32 directory with a single huge file in it. Then from your code you can fill this file with your own data structure. On the PC read this huge file with some decoding program you write and store the data in whatever format suits you. The advantage of doing it like this is that on the PC you have all the routines for file handling available and tested for free.
Edit: Replaced MMC by SD/MMC.
Last edited by ckielstra on Wed Aug 11, 2004 9:12 am; edited 1 time in total |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Wed Aug 11, 2004 8:45 am |
|
|
What I want is when I power up my system, it creates a new logfile and store data as long as the system is running. I can let the system work for days until the memory is full, after that I can generate graphs on computer. |
|
|
cbstieff
Joined: 09 Aug 2004 Posts: 7 Location: Kensington, MD
|
|
Posted: Wed Aug 11, 2004 9:13 am |
|
|
It might simpler log data into free space in EEPROM or Program memory on the MPU. You could then use the ICD programmer/debugger to copy the data stored in the memory to a file |
|
|
bdavis
Joined: 31 May 2004 Posts: 86 Location: Colorado Springs, CO
|
|
Posted: Wed Aug 11, 2004 1:48 pm |
|
|
Another option is to look at Atmel's 4 Meg Flash part - a serial 8 pin dip. Digikey stocks it. It would save you lot's of time, and money. The cost was between $6 and $7 for a 4Mbit part (512K Bytes). I don't know how much data you are logging, but half a meg is quite a bit to me. |
|
|
|