Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

File I/O with a PIC

Status
Not open for further replies.

mihids

New Member
How can I read/write a file(FAT32) from a PEN drive using a PIC with a USB interface. Are there any libraries to do this?
Any help would be appreciated!!
 

kchriste

New Member
Forum Supporter
You can get PICs with a USB host interface:
USB Framework for PIC18, PIC24 & PIC32
Quote from above page:
[SIZE=-1]The 8-bit PIC18 family supports USB device mode. The 16-bit PIC24F and 32-bit PIC32 products with USB support device mode, as well as embedded host and On-The-Go. All product families support up to (FS-USB) full-speed operation (12 Mbps).[/SIZE]
 

Sceadwian

Banned
The first thing you need to deal with is connecting to the USB thumb drive, so following up on Kchristies link above would be a good place to start, once you can actually connect the storage device to the pic and access it then you can worry about the file system. You'll either need libraries to access the FAT system on the drive, or if you want to do it the easy way and you can make sure the file is in a specific spot you can use a fixed offset to read the file.
Ordinarily you need to read the file allocation table to determine where a file is where it's parts are and where the offsets for each of those parts are, but if you place the file on the thumb drive using a PC defragment the drive and then use a hex editor to determine the drive offset of the file you need you can put a fixed offset for reading from the PIC, but you have to be very careful you never modify the file on a PC to the point where it would change it's drive offset location.
 
Last edited:

Oznog

Active Member
Many people have written to the interface of SD-RAM cards. It's actually fairly easy, I've not done it but I heard they have a SPI interface that the PIC easily interfaces with. Check the voltage, I think it requires a 3.3v interface.

That SD card can plug into a USB adapter that you can plug into a computer. This may make your project 10x simpler.
 

Pommie

Well-Known Member
Most Helpful Member
Anyone that has to ask on a forum like this, how to host USB, is doomed to failure. Sorry.

Mike.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top