Usb To Serial Pic18f4550
Note: This hack is only needed if your usb-serial does not support the BREAK functionality. Else, it may work with as it is, with the usual programming software like PicPgm, WinPic etc. Usually the DIY programmers like JDM do not work for usb-serial converters.
Voltage levels, timings, and missing functionality like setbreak causes issues. And some require a microcontroller that has to be programmed first, a chicken-or-egg problem. This hack provides a way to program the PIC using a usb-serial converter. Note that i have tested it only for the 18F4550. I found that a resistor of 1-5K is a must between DTR and PGD, it prevents a near short between DTR and PGD, when PGD is HIGH and ensures proper signal to CTS.(Thanks Darron from kewl.org for pointing this out). For safety, one might add the resistors to CTS and RTS as well. Nowadays, computers do not have serial/parallel ports.
Neither has my laptop. Since my interest in PIC programming was temporary and for hobby purposes, i did not want to get a commercial USB based PIC programmer. Besides, where's the fun in that? I decided to get a cheap USB-Serial converter, and see if it could make it work.
I used a Bafo Db9 USB-serial converter for around 200 Rs. And a python software for PIC programming at i have blogged about it at: It also works in HVP mode with changes to provide the high voltage.
I am trying to perform USB communication from the PC to a PIC18F4550 microcontroller using the Microchip PIC18 USB CDC(Communication Device Class) Framework which essentially makes the PIC18, connected to the pc through the usb cord to the usb port of the pc, appear as a vritual COM port on the PC. This gives me the ease of sending the data as if I was sending it to a serial port on the pc side and removes the hassle of using a usb to serial converter. Now the problem is that the demo project provided by Microchip is written so that it can be burned on different devices, with different circuits, or with different conditions - that makes it large, and for me at least, harder to understand. If someone could hopefully just provide a working code with minimal comments for this microcontroller or something similar OR link me to a good tutorial, it would make my life MUCH MUCH easier Thanks. I have no experience with the CDC but I have some with the MSD class.
Some steps I did and may be useful for you. First, let's create a stand alone project: 1) I assume you have downloaded and installed the MAL (Microchip Application Libraries). Copy to your example directory the following files: usb.h, usbch9.h, usbcommon.h, usbconfig.h, usbdevice.h, usbdevicelocal.h, usbhal.h, USB PIC18.h, usbfunctioncdc.h, usbfunctioncdc.c and add them to the MPLAB X project. Remove the libraries from the MPLAB project. 2) Compile it, link it, and see if it's still working ok. 3) Using MPLAB X, remove all the code lines that are grayed in the #ifdef or #else preprocessor blocks. That is, remove all the code intended for other architectures that are not intended for a PIC18F45XX.
5) If you start studying the code now, you'll notice that it's much simpler than what you thought in the beginning, and you will have much more control over you project. Hope this helps.
Pic18f4550 Data Sheet
I am trying to perform USB communication from the PC to a PIC18F4550. Tutorial for USB communication with a PIC18F4550. The hassle of using a usb to serial. Mar 14, 2010 Hi, I am trying to program PIC18F4550 to communicate with PC thru USB. I am not using the demo board.I have assembled the circuit on a breadboard using the circuit.