USB Serial port on PIC18F4550

Microcontroller Topics
Post Reply
User avatar
Magneto
Major
Major
Posts: 430
Joined: Wed Jul 15, 2009 1:52 pm
Location: London

USB Serial port on PIC18F4550

Post by Magneto » Wed Feb 03, 2010 8:59 am

USB example for PIC18F4550. Plug your PIC18F4550 into your PC using a USB cable. A virtual RS232 COM port is created, allowing your application to print RS232 messages into HyperTerminal. Allows porting of legacy code that used RS232 comms.

This project is a modified form of the CDC (Communications Class Driver) available from http://www.microchip.com. The http://www.htsoft.com forum has some discussion on this code.

Note: ensure that you read "readme (including install notes).txt" after download.

Schematics: this code runs on the PICDEM-FS board from Microchip. To make your own schematic, place a PIC18F4550 on a breadboard, ensure that you are using a 20Mhz crystal, place a 470nF capacitor on port Vusb, and hook the USB directly to the chip. It should start to work straight away. Download the PICDEM-FS datasheet for the exact schematic to use with this code.

Result: start up HyperTerminal or putty, find the new COMx port that has been enumerated. Set it to 115200,N,8,1. The actual COM port speed doesn't matter, as its a virtual comm port. You will see "[alive]" being continuously generated on virtual com port X over USB. You can find the exact number of the virtual COM port by going into "Control Panel", then "System", then selecting the "Hardware" then "Device Manager", there will be a new COM port under "Ports (COM & LPT). You can change the number of the virtual comm port by going into properties, and selecting the new COM port.

Download PIC18F4550 USB serial port example v1.02 (540KB)
PIC_Hi-Tech_C_PIC18F4550_USB_CDC_example_v1-02.zip
(538.61 KiB) Downloaded 932 times
Download PIC18F4550 USB serial port example v1.10 (540KB)
PIC_Hi-Tech_C_PIC18F4550_USB_CDC_example_v1-10.zip
(539.38 KiB) Downloaded 836 times
Post Reply

Return to “Microcontrollers”