PIC32MX: USB Communication with a PC

From Mech
Revision as of 20:24, 15 February 2010 by DerekSiegal (talk | contribs) (→‎Circuit)
Jump to navigationJump to search

Original Assignment

Do not erase this section!

Your assignment is to set up the PIC32 to send and receive data with a PC using the USB communications device class (USB CDC).

This type of communication will allow you to talk to a virtual serial port on a PC, just like using the RS232 cable, except you will communicate with the USB cable that powers your PIC32 and achieve faster communication than you could with the RS232 cable.

Use the example projects in the "Microchip Solutions/USB Device - CDC - Basic Demo" and "Microchip Solutions/USB Device - CDC - Serial Emulator" folders as guides.

Send 1000 bytes of data to your PC from your PIC32 and have your PC echo them back to the PIC32. How long does it take? Does it always take the same amount of time? What if you change to a different (faster or slower) PC?

Overview

Summarize briefly what the page is about.

Circuit

There is no circuit required for USB communication with a PC. The USB cable that powers the PIC is the same that transmits data in and out.

Code

Where possible, make it a single piece of well-commented cut-and-pastable code, or at least make each function that way, so others can easily copy it. Most comments should be in the code itself; outside the code (on the wiki) should only be explanatory comments that are too cumbersome to include in the code.