USB Pics

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
m-rice
Posts: 5
Joined: Fri Feb 03, 2006 10:20 am
Location: Newbury, UK
Contact:

USB Pics

Post by m-rice »

One of my HNC students wants to do a project talking to a PIC via the PC USB port. You clever chaps at MM know how to do this: your USB multiprogrammer uses this interface.

Where can I get information? I obviously need to know what to do at the PC end, and what to do at the PIC end. As lecturer I know a little about VB for the PC end, and PIC assembly at the PIC end. I presume the PIC 16C745 has built-in hardware to talk to the USB port.

Any help/advice most welcome.

Many thanks,

Martin

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

Hi Martin,

PIC to PC comms via USB did prove quite tricky for us and took quite a few man-months to complete (perhaps we're not that clever...). Instead of natively writing code for a USB-enabled PIC, I would instead suggest using a dedicated interface chip (e.g. one from FTDI). We have produced an E-Block that is just right for this (see below), but first a little background...

Our initial USB programmer used the 16C745, but this chip is one-time-programmable and so development of the firmware was slow (you can get a UV eraseable chip, but each time the code changes you have to erase the chip, which takes 10 or more minutes).

We have since moved on to the 18F2455, which is a flash part (this makes it a lot easier to develop code) - but it is a more complicated device.

But it is much more complex than simply writing appropriate firmware. You also need to fully understand the USB descriptors (a task in itself) and then there is the USB driver code on the PC side.

Other companies have made USB comms much easier to handle by producing custom chips that solve a lot of the headaches for you. One such company is FTDI, who have developed chips that allow USB comms to mimic an old serial COM port. This simplifies both the PC coding and the PIC coding enormously.

We have recently introduced a new E-Block specifically designed for PC-to-Microcontroller comms (which uses this FTDI chip). You can use this E-Block in a number of ways - as a "virtual" COM port, or using specific drivers to talk directly to the FTDI's i/o (samples in VB are available for either method).

Your student could use this E-Block to prototype a system. The circuit diagram is available when you buy this E-Block, and the student can even use this to produce their own schematic and layout (if this is in the scope of the project).

I hope this info is useful.

m-rice
Posts: 5
Joined: Fri Feb 03, 2006 10:20 am
Location: Newbury, UK
Contact:

Post by m-rice »

Excellent! Just the information I needed - many thanks.

Is the E-block you mention featured on your website? I didn't notice it yesterday.

Martin

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

You're right - the datasheet does not seem to be up on our website. I'll nudge the appropriate people...

Post Reply