Browse over 10,000 Electronics Projects

Basic USB Communication RS-232 Emulation Method

Basic USB Communication RS-232 Emulation Method

With the continuous decrease in the use of COM Port devices and COM Ports itselt, the need to migrate to the USB has become increasingly important. Just take a look at the laptop PCs nowadays, it is a miracle if you can even find just 1 COM Port on it.
But the good news is… we have got a simple (very simple in fact) way of migrating from the old RS232 to USB, that is via RS232 Emulation method. This method alone has got quite a number of ways to implement, e.g. using USB Convertor ICs, like the FTDI232BM (this is UART-USB conversion), the Philips PDIUSBD11 (this is I2C conversion to USB) and many more. Sometime last year, Microchip released the USB 2.0 compatible microcontrollers, i.e. PIC18F4550, 18F2550 and etc. Presented here, is the example of using the CDC firmware provided by Microchip to emulate a COM Port when the device is connected to the USB Port.



Advertisement1


When the device is connected to the computer, a Virtual COM Port (VCP) will be created. This is shown at the Device Manager Window under Ports(COM & LPT). In this case, COM5 was created when the PIC18F4550 was attached to the USB Port. It may be interesting to note that if you plug in your PIC in different USB ports, the VCP created will be different.

Here, I modified the CDC firmware provided by Microchip and wrote a Visual Basic programme to communicate with the device. An important thing to note when using the firmware and this schematics is that… to PLACE REMARKS ON THE FOLLOWING 2 LINES AT USBCFG.H like this…

//#define USE_SELF_POWER_SENSE_IO //#define USE_USB_BUS_SENSE_IO

if not the when you attach the PIC to the USB Port, it will disconnect itself immediately soon after.

Visit Here for more.

 


Top