serial-port

System.UnauthorizedAccessException from Serial Port in VB.NET

I am using VB.NET 2008 Express Edition to access Serial Port which is a USB to Serial port. Since this is removable, the app user can disconnect it at any time in app. I am getting an unhandled exception when I remove the USB Serial Port. After research, it seems like a known problem in .NET (even in 3.5) I am looking for some solutio...

Reading single bytes from SerialPort synchronously?

I'm attempting to read from a serial port a byte at a time. I've got the following code in my Console app: // Open the serial port in 115200,8N1 using (SerialPort serialPort = new SerialPort("COM1", 115200, Parity.None, 8, StopBits.One)) { se...

How can I monitor data on a serial port in Linux?

I'm debugging communications with a serial device, and I need to see all the data flowing both directions. It seems like this should be easy on Linux, where the serial port is represented by a file. Is there some way that I can do a sort of "bi-directional tee", where I tell my program to connect to a pipe that copies the data to a fil...

Hang On Serial.Close(), Possible threading Issue?

The software im currently working on sometimes hangs when I close the serial port. Its intermittent and works fine 90% of the time but I clearly have an issue. When I ctl+Alt+Break it shows that its waiting on serial.Close(). I have lots a data coming in and out on the serial port which is being invoked to a number of forms so is this a...

How to set DTR/RTS state that will be used when CreateFile() opens COM port

I wrote/support a terminal emulator called uCon (http://www.umonfw.com/ucon). Its all based on "good-ole" Win32, and is entirely in 'C'. I was recently asked to support the ability to have uCon attach to a COM port and set up DTR/RTS for purposes outside of RS232 flow control. I know I can do this after CreateFile() is called using Es...

Can I check to see if a COM port can be opened without actually opening it?

Typically, on a PC, there is some non-standard set of COM ports available for use by a terminal emulator. I would like to be able to scan ports COM1-COM32 to see which (if any) of those ports can be opened as a serial port. I can do this be simply calling CreateFile() on all those ports; however, then I actually have to open/close (and...

What is the difference between DTR/DSR and RTS/CTS flow control?

What's the difference between DTR/DSR and RTS/CTS hardware flow control? When is each one used? Why do we need more than one kind of hardware flow control? :) ...

Serial Port Not getting closed. I want to release the COM port ...

Serial Port Not getting closed. I want to release the COM port ... Below is my code.... import java.io.*; import java.util.*; import gnu.io.*; public class ReadCommPort implements SerialPortEventListener { static CommPortIdentifier portId; static Enumeration portList; InputStream inputStrea...

System.IO.Ports.SerialPort and Multithreading

Hi, I have some SerialPort code that constantly needs to read data from a serial interface (for example COM1). But this seems to be very CPU intensive and if the user moves the window or a lot of data is being displayed to the window (such as the bytes that are received over the serial line) then communication gets messed up. Consideri...

threaded serial port IOException when writing

Hi, I'm trying to write a small application that simply reads data from a socket, extracts some information (two integers) from the data and sends the extracted information off on a serial port. The idea is that it should start and just keep going. In short, it works, but not for long. After a consistently short period I start to recei...

Sms via a nokia phone over a serial port

Hi, I'm trying to send a sms via a Nokia phone over serial which is easy enough via putty. The commands from the nokia documentation works fine. However, trying to send the same commands from a c# application fails miserably. I've run Sysinternals PortMon and can see the commands come through OK, the only difference I can see is in the...

Obviously this is not the correct way to read with SerialPort

Hi, Let's say I want to have a function which reads data from the SerialPort and returns a byte[]. public byte[] RequestData(byte[] data) { //See code below } Something as simple as this really doesn't work/perform well and isn't very reliable: byte[] response = new byte[port.ReadBufferSize]; port.Open(); port.Write(data, 0...

serial port call

I want to open a serial port cash drawer connected to the client pc. I will have a record button on an asp page and when I click on it the drawer will open ...

How to preview data from COM port with telnet or other windows tool

I would like to see what data come from COM serial port. Is it possible to do it with telnet or other windows tool? And if so, how to do it? ...

How to connect a 3G USB dongle with Windows Mobile 6 emulator?

I have a real 3G USB dongle which shows several Serial ports. I want to map one of the Serial ports of the Windows Mobile emulator serial ports to the real device, to test a custom RIL implementation. First, is this scenario possible? I have tried to modify HKEY_LOCAL_MACHINE\Software\Microsoft\RIL\ComPort on the WM emulator, to set up...

Serial Port Spy for Windows Embedded CE

Is there a serial port "Spy" application available for Windows CE? By spy I mean an application that runs on Windows CE and can monitor the traffic going in and out of a serial device without modifying it. ...

Windows XP embedded - RS485 problems

We've got a system running XP embedded, with COM2 being a hardware RS485 port. In my code, I'm setting up the DCB with *RTS_CONTROL_TOGGLE*. I'd assume that would do what it says... turn off RTS in kernel mode once the write empty interrupt happens. That should be virtually instant. Instead, We see on a scope that the PC is driving ...

RS232 serial snoop tools for protocol development / debugging

I develop a wide range of relatively simple firmware devices. Every one of these ends up talking to the PC (or another device) via the RS232 port in one way or another, so I spend a lot of time implementing and debugging their communication protocols. My most common use case is to snoop on a program running on my PC that is communicatin...

How to graph streaming data in C#

I need to graph streaming data (9600 baud), which is coming in 2-4 byte packets from a serial port. The packets need to be processed before graphing. Currently, I am raising an event on each complete packet, which is causing responsiveness issues on the graphing form. Which is the best solution to this issue: Buffer data and raise b...

How can I redirect Windows COM port output to a file?

Is there a simple way of redirecting serial port output to a file, that I can put into place on a test Windows desktop system without changing any code? I'm trying to debug a problem in a serial receipt printer module and I don't have the real device handy today. I don't want to start making any changes to the code if I can help it, I ...