Hi!
I've been searching all over the net with no positive results, so I hope anyone here can help me!
I have written some code in which I get simple electronic pulses from a circuit, through the Serial port. Each time a pulse is received, the program saves some info to a text file.
To do that I use CreatFile() and ReadFile() functions, which are defined in windows.h.
Now I want to adapt that code to be used with a USB port, as my friend's laptop does not have Serial port. As far as I know, I can manage USB ports in a fairly similar way... The problem is that I don't know what a USB port name is (I know it's "COM1" for Serial port). I have read that a USB port name depends on the device connected in that port.
My question is: Is there a way to list all USB ports (used and not used), so that I can search the port where my circuit is connected??
I am under windows XP, and don't use any IDE (such as Visual C++, etc...). I've tried with libusb, but my compiler doesn't seem to like it... Perhaps I'm doing something wrong, but I can't figure out what!
I'm desperate here! Isn't there a way inside windows.h to do that???
I made the device myself... it's quite simple: a 555 that send rectangular pulses every time a switch is closed.
I think I'll have to add a USB controller chip to my circuit, won't I?
You are sending a pulse directly up the serial cable - and reading the serial port?
This is OK to do with the serial port - however USB is totally different.
USB ports do not work this way - You will need more than a usb controller - because USB
uses a special protocol (both hardware and software) -
USB is not just a bunch of dumb electrical
signals like normal RS232 serial (which is one of the reasons why you can't do a USB loopback by directly cross-connecting the data lines which you can do with RS232 serial)