C# USB/Virtual Serial Port RRS feed

  • Question

  • SerialPort axl = new SerialPort("COM2");  
    char[] chararray = new char[100];   
    axl.DtrEnable = true;  
    axl.BaudRate = 115200;  
    axl.DataBits = 8;  
    axl.Parity = 0;  
    axl.StopBits = StopBits.One;  
    int BTR = axl.BytesToRead;  
    axl.Read(chararray, 0, BTR);  
    I have little experience with C#; however, I have managed to connect via RS-232 before.  I am having trouble connecting to a USB/virtual serial port device using C#.  I can connect via hyperterminal though.

    It appears that I can write to the device, I just can't read anything.  Right now, I just have a simple program (attached) where I am trying to read in data from the device.  I've tried it with and without DtrEnable.  I read that with hyperterminal DtrEnable is always true, which is why I put it in my C# program.  BTR (see program) is always zero, which is telling me I'm never receiving anything.  Once I can start reading data, I will be good.  Again, I've done this very same thing with an actual RS-232 serial port and have had no problems.  Could my problem be that this is USB/virtural serial port?  For those of you familiar with Labview, I am having the VERY SAME problem there too.

    • Moved by jack 321 Wednesday, June 4, 2008 3:16 AM off topic for C# general
    Friday, May 30, 2008 6:32 PM