RayLopez99 said:
Paul--thanks. Seems like this program is pretty safe. For now
though, I'm too busy to check and I'll live with USB 1.1 (it is slow
but does work)
But this thread raised an interesting question for me: I've been
looking around (not too hard, but keeping a lookout) for either free
source code or a paid, third party solution for reading / writing to
USB (the successor to Serial I/O ports) using C# programming language,
preferably a library I an drop into Visual Studio .NET. Most of the
free stuff I saw is in C, and I hate to try and port that.
If you have any links please do let me know.
Thank you,
Ray
stuff I found from your links, but no answers:
http://msdn.microsoft.com/en-us/library/ff558731(VS.85).aspx
http://bytes.com/topic/net/answers/637380-read-write-usb-port-using-c
I want to read/write on USB port using C# with out using any third
party software means directly using .NET 2005. Is that any way to do
so??Any input will be appreciated!!Thanks in Advance
Well, first off, I'm not a software developer. I write short programs
for my own usage, but I'm not a computer science graduate or anything.
The OS uses "protocol stacks", and that gives an orderly way to
deal with things in the computer.
Some protocols stacks are built-in, and at the top of the stack,
may provide a convenient way to work with hardware. For example,
many details of setup may be hidden from you, so that you have
less work to do.
In other cases, (custom designed USB hardware, unlike any other),
you as the driver developer, are responsible for writing the
stack, from somewhere near the physical layer, on upwards. In that
case, there is still a layer you cannot access, as it belows to
the OS. The USB logic block in the Southbridge, contains multiplexed
conversations, and only one of those belongs to you. So the OS has
to route the thing you've registered for (endpoint), to you. And then,
your custom design details take care of the upper layers of the stack.
That might include reading and writing registers in the USB chip,
by sending packets of some sort to it. You'd be a driver developer,
but still not responsible for controlling the motherboard Southbridge
chip (as other software owns that).
I suspect you're talking about plugging in a USB to RS232 adapter
device. For example, I have two of those on the computer right now.
They use FTDI chips. At one level, they follow a USB class standard.
Which means, when the device is first plugged in, it is recognized
as a USB to RS232 adapter (it isn't completely unknown to the OS).
But you can also get a driver package, which promises to give you
a "virtual communications port". i have this installed. One of the
advantage of this, is it has its own control panel, so you can
set preferences for the hardware.
http://www.ftdichip.com/Drivers/VCP.htm
If I was to open a Hyperterminal window, and point it at COM3, I
can send bytes to the RS232 connector on the end of the cable. And
that is no different, than using a motherboard RS232. It would be
the same kind of software interface.
The Hyperterminal program, can't tell the difference between the
16550 driving COM1 and COM2, versus the FTDI chip driving COM3. All
those details are hidden. If I had an "ordinary" RS232 communications
package or method (say, some C# library), it could talk to COM3 just
as easily as COM1 or COM2. The reason for this, is WinXP doesn't allow
talking directly to hardware, so to talk to COM1 or COM2 in the first
place, I don't control the registers on the 16550 UART myself.
http://en.wikipedia.org/wiki/16550_UART
So
1) If you're using a USB to RS232 adapter chip and cable
and
2) You'd installed whatever is needed to make virtual COM ports
then the same software package that talks to regular RS232 ports
(COM1 and COM2), can talk to a USB to RS232 adapter (some other COM).
A USB to serial port adapter, will have some upper limit as to how
fast it can communicate. For example, this one claims to run
12 Megabaud, and you might achieve that, if two chips were
connected back to back, and operated between two computers.
(If you put RS232 level shifters in there, it would slow the
max rate. If you used RS422, it might work a bit better. Years
ago, I had some RS422 in something I built, and those chips
could do about 10 Megabaud over a very short distance.)
http://www.ftdichip.com/Products/ICs/FT2232H.htm
They also make USB to eight wire port chips. This one delivers
about 1MB/sec, and you can think of this one as being
similar to using an older parallel port on a PC. Using devices
like this, makes it possible to connect your custom hardware
design, to a computer, for control or monitoring.
http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT245R.pdf
So you should state the context of your question, as to whether
you've got a USB to RS232 adapter that you're trying to write
code for. Or, you've got some other kind of adapter.
HTH,
Paul