serial-port

Serial Comms via IOCP

Is it possible to use IO Completion Ports for Serial I/O? According to Windows via C/C++ it is alluded to that it is possible, and does give an example of using IOCP with physical files showing work with CreateFile, ReadFile, WriteFile, etc. However can this actually work with serial comms - has anyone got it working? I can't find any e...

Multiple port asynchronous I/O over serialport in C#

I'm trying to write a test application for serial I/O (RS-232) with multiple units in C# and I'm running into an issue with my lack of threading experience so I'm soliciting feedback for a best known method. I've got a pool of COM ports COM1-16 each of which can read/write at any time and I need to be able to manage them simultaneously....

issue/response serial port processing in C#

Okay here's the problem (this is related to a previous post of mine) I need to be able to have an issue/response system for serial comms that works something like this: issue: hello response: world? issues: no, hello nurse reponse: well you're no fun. this would mean I say "hello" the remote unit is expected to send back "world?" with...

Which comm ports exist? Win32

On win32, using winapi, is there anyway to know which comports (from com0 upwards) actually exist as devices? At the moment I am just attemping to open them all (0 to 9), but I can't figure out the difference of failure between one not existing, and one not simply being available for use because someone else is using it. Both situation...

SerialPort.Open() freezes the system if data was received previously (Compact Framework)

Hi, I have a very weird problem here, maybe you guys can help me out. I have a Windows CE 6 device that uses a barcode card reader connected through a serial port. I'm using the Compact Framework's (v2.0) SerialPort class to handle this, and everything has been working fine. There's one problem, however. If a card is swiped at any point...

Automatically detecting a serial port's configuration?

I am designing software around an existing hardware product. I have full control of the communication protocol but I'm not sure how to facilitate device detection. A device could have a range of possible configurations (i.e. baud rate, data bits, parity bits, stop bits) that must be detected at runtime. What is the easiest, most reliabl...

compare hexadecimal values java

Duplicate: http://stackoverflow.com/questions/713162/compare-hexadecimal-values-with-decimal-in-java hi, i'm implementing x-modem protocol in java,i'm reading serialport and storing in byte array of size 1024. then i have converted data to string i'm getting 133 bytes in a packet,problem is i'm not enable to compare hexadecimal value in...

How to properly timeout when communicating with a serial-port device?

I am using a serial port communication C# windows application. I wrote a program to get the data from the port, to manipulate it and write through the serial port. My question is in case the unit is not powered on, the power supply is disconnected, or the unit is not responding to commands for a long time, how will I know? In my program...

CRC calculation in Java

Hi, i'm readin file from serialport using x-modem protocol and 133 bytes packet i'm reading in that 1 byte is SOH 2 byte packet number 3 byte nagative of packet number next 128 bytes data 2 bytes CRC sent from other side. i've to calculate CRC of 128 bytes data and 2 bytes crc sent form other side that i've to m...

Non ASCII char in PHP?

Hello, I am trying to send something to serial port (r232) with PHP. I am using this class: http://www.phpclasses.org/browse/package/3679.html The problem is that I am allowed to send only 1 byte. But if I send something like "1", I am actually sending 49 (ASCII for 1). Instead of send("1"), I tried with send(1) but it is no good, becau...

Is there Java library or framework for accessing Serial ports?

Is there a java library or framework (other than the javax.comm provided by Sun) that is easy to use when accessing serial and parallel ports ( especially RS-232 ). I need something free that will work both on Windows and Linux. ...

Sharing serial port (Modem protocol + dialer)

Hi, I wanted to use this code to send archives with Xmodem: http://www.java2s.com/Code/Java/Network-Protocol/JModemsimplecommunicationsprogram.htm In this case, I want to establish a dialup connection between two computers and send a binary file. But this code doesn't let me set a phone number to dial after i setup the port and before I...

Determine if device is connected/disconnected to RS232 port without opening the port

I"m working on a C++ Win32 application for which I'm trying to essentially "auto detect" if a device has been plugged into one of the RS232 ports and then if it has been disconnected. The checking for a connected device is easy enough because my use case allows me to assume that this particular thread will be the first to try to initiat...

SerialPort memory leak in .NET 2.0/3.5

Hello, I'm having a very big problem with the SerialPort class and I need some help to solve this. We're using multiple serialports in a generic list since we need to connect to multiple devices. This is what our basic code looks like... List<SerialPort> ports = new List<SerialPort>(); private void button1_Click(object sender, EventA...

SerialPort.Write() - How to stop writing?

Hello, I am developing in C# using the SerialPort class. SerialPort.Write() is a blocking method. How can I exit this method when I want to stop writing? I use a thread to write. I abort this thread when I want to stop writing but the COM port continues to write. Any ideas? Thanks a lot. Sorry for my basic English. ...

pyqt4 and pyserial

I want to do an app constantly watching the serial port and changing the user interface according to the input received from the port. I've managed to read lines from the port with pyserial under Linux, but I'm not sure how to do this in a regular fashion: create a separate thread and check for input on a timer event? How do i make sure ...

Listening on a comm port and stdin in Win32

I'm trying to write a small utility that maps stdin/stdout to a serial port (a command line terminal emulator of sorts) using the Win32 APIs. I have the following code, which I think ought to work, but it doesn't appear to be receiving notifications properly from the serial port: HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE); HANDLE hC...

SerialPort + CF 2.0 prevent losing data

Can anyone tell my why the code below would be missing or dropping data. I have been googling all night but can't find any pointers. the serial port is using the following settings; 38400,n,8,1 xon/xoff flow control. ReceivedBytesThreshold = 1. isReceiving and stockReceived are both members of the form private void serialPort1_...

How do I watch a serial port with QSocketNotifier (linux)?

Could someone give me an example on how to setup QSocketNotifier to fire an event if something comes on /dev/ttyS0 ? (preferably in python/pyqt4) ...

How do I read only available data off a windows COM port?

I have a file handle to a serial (COM) port. I need to read whatever data is available immediately and not wait for additional data to be sent. How can I determine how much data is available? I can call SetCommMask(myHandle, EV_RXCHAR) and then wait for an event to tell me that some data is available, but that won't tell me how much I ...