My experience with USB devices that supplies a virtual serial port, from a = programmers point of view, is that this works very unreliably when somethin= g = unexpected happens. For example: The PC software is talking to a virtual serial port that is = connected to a USB device. When the PC software has opened the port it neve= r = expects the port to go away, which is reasonable considering that a standar= d = serial port can't be unplugged. However, when the USB device is unplugged = (perhaps by accident) really weird things can happen with the PC software. = I = have not been able to reliably catch any exceptions caused by this and most= of = the time the PC software just hangs. Sometimes I even have had to restart t= he = computer (XP) before I can get the communication up and running again. I am not sure about this but I think that when the USB device is unplugged = the = virtual serial port is also removed, and this happens even if there are ope= n = handles to it or not. Perhaps this is a driver thing and I have just been = unlucky using a bad driver but so far this seems to be the case with all US= B = devices that supplies a virtual COM port. My advice is to not use a virtual COM port but instead talk to the device u= sing = a USB class. Here is example code for the HID class: /Ruben > Check out the CDC serial Demo in Microchip's USB stack as a reference, it > enumerates as a serial port. You don't have to give up the legacy serial > support. > = > = > = > = > -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf = Of > Nathan House Sent: December 18, 2009 1:13 PM To: Microcontroller discussi= on list > - Public. Subject: [PIC]Is HID the easiest way to use USB with a PIC18F45= 50? > = > Hi everyone. I am building an inexpensive CNC machine as a hobby project = and it > needs to send and receive data from a computer. I've decided to use USB f= or this > project instead of a serial connection. As I have a PIC18F4550 on-hand, a= nd > because it seems to be popular among hobbyists, I'm planning on using it = as the > "brain" of my CNC machine. > = > My question is, what is the easiest way to send data back and forth betwe= en a > PIC18F4550 and a PC? I have no experience with USB or writing drivers, bu= t it > seems that using the built-in Windows HID class may work well for me. Wha= t do > you guys think? > = > Appreciate for your advice! > -- > http://www.piclist.com PIC/SX FAQ & list archive View/change your members= hip > options at http://mailman.mit.edu/mailman/listinfo/piclist > = > -- = > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Ruben J=F6nsson AB Liros Electronic Box 9124, 200 39 Malm=F6, Sweden TEL INT +46 40142078 FAX INT +46 40947388 ruben@pp.sbbs.se =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist