serial-port

Error opening serial port using the System.IO.Ports.SerialPort class

China☆狼群 提交于 2020-01-02 08:22:11
问题 I'm trying to open and read from a serial port using the System.IO.Ports.SerialPort class. I dragged the serial port from the tool pane (Visual Studio 2008) on to my Windows Forms application. I've got a property grid set up so I can easily change properties of the serial port at runtime. When I try to open the port, I get the error shown below. I don't understand why because I can open and read from the port using Hyperterminal. Any ideas? System.IO.IOException Error connection: A device

PHP to serial with weird baud rates

点点圈 提交于 2020-01-02 05:41:12
问题 I am trying to use PHP to send text to an LED sign so I can send support ticket numbers to it. The sign itself is a piece of work; it came from eBay and is poorly made with almost no documentation. After fiddling with it for a while, I was able to figure out the way it expected stuff to be sent to it and that the baud rate is 28800. I already know how to communicate with stuff like this using PHP, but I don't know how to change the baud rate to something nonstandard. I've tried other baud

Reading COM (Serial Modem) in PHP

泪湿孤枕 提交于 2020-01-02 04:35:07
问题 Reading COM (Serial Modem) in PHP I'd need a COM interface (Windows,COM2) to read with PHP. This Demo is going on. Reading is a problem, it's running sometimes. Is there an other way (no dio,no C++) maybe w32api_register_function() is better? function rs232init($com,$bautrate) { `mode $com: BAUD=$bautrate PARITY=N data=8 stop=1 xon=off`; } function send($comport,$char) { $fp = fopen ("$comport", "w+"); if (!$fp) { echo "not open for read"; } else { fputs ($fp, $char); fclose ($fp); } }

python : How to detect device name/id on a serial COM

限于喜欢 提交于 2020-01-02 04:31:09
问题 I would like some indication on how to do this in python: Identify the port named a specific name in the serial com (\Device\VCP0 and \Device\VCP1 these are get by browsing in regedit window) And get the id of the device that is pluged I can already identify the avalable COM with this pySerial code that scan up the active serial port COM import serial def scan(): """scan for available ports. return a list of tuples (num, name)""" available = [] for i in range(256): try: s = serial.Serial(i)

“Safe handle has been closed” with SerialPort and a thread in C#

荒凉一梦 提交于 2020-01-02 02:48:06
问题 Good afternoon everybody! I have this threaded SerialPort wrapper that reads in a line from the serial port. Here is my thread's code. protected void ReadData() { SerialPort serialPort = null; try { serialPort = SetupSerialPort(_serialPortSettings); serialPort.Open(); string data; while (serialPort.IsOpen) { try { data = serialPort.ReadLine(); if (data.Length > 0) ReceivedData(serialPort, new ReceivedDataEventArgs(data)); } catch (TimeoutException) { // No action } } } catch

open(2) function hangs when trying to open serial port in MacOS

邮差的信 提交于 2020-01-02 00:12:22
问题 I've run into a problem where the open function never returns when I try to open a serial port. It doesn't happen all the time, and the problem disappears for a while if I unplug my USB to serial adapter and plug it back in. My code looks like this: fileDescriptor = open(bsdPath, O_RDWR | O_NOCTTY); where bsdPath is /dev/cu.KeySerial1 . I've tried adding the O_NONBLOCK option to the open command, but it still hangs. Of course I'd like to understand why this is happening. My belief is that

c# serial port data loss

纵然是瞬间 提交于 2020-01-01 19:25:09
问题 I have written a C# program to receive data on COM2 port. The baud rate is set as 115200. The sender is sending the data at 115200bps. My program is losing a few bytes ocassionally. I am calling ReadByte method to read the data in a while(true) loop from the com port. I have few questions: When the baud rate is set high, should I expect to lose data? if yes, why? I am setting the readbuffer size as 100*1024*1024. Does this set the serial driver buffer size to 100*1024*1024? Any thoughts on

Reading a Serial Port - Ignore portion of data written to serial port for certain time

半世苍凉 提交于 2020-01-01 18:13:40
问题 I would like to read data coming and Arduino on a serial port on intervals. So essentially something like Take a reading Wait Take a reading Wait Take ... etc. The problem I am facing is that the port will buffer its information so as soon as I call a wait function the data on the serial port will start buffering. Once the wait function finishes I try and read the data again but I am reading from the beginning of the buffer and the data is not current anymore, but instead is the reading taken

Reading file from serial port in Java

末鹿安然 提交于 2020-01-01 14:43:11
问题 i'm beginner in java technology, I have to read file from port. Frst I'll write "FLASH" to outputstream then I'll get response as a "FLASH_OK" from target device, after getting FLASH_OK as response then again i have to write name of the file which i want,but problem is its not writing file name to outputstream, below is my code. Please help me. package writeToPort; import java.awt.Toolkit; import java.io.*; import java.util.*; import javax.comm.*; import javax.swing.JOptionPane; import

Find out CRC or CHECKSUM of RS232 data

六眼飞鱼酱① 提交于 2020-01-01 11:46:10
问题 I need to communicate with a RS232 device, I have no specs or information available. I send a 16 byte command and get a 16 byte result back. The last byte looks like some kind of crc or checksum, I have tried using this http://miscel.dk/MiscEl/miscelCRCandChecksum.html with no luck. Anyone can reverse engineer the crc/checksum algorithm? here is some data captured with an RS-232 monitor program: 01 80 42 00 00 00 00 00 00 00 00 00 00 00 01 B3 01 80 42 00 00 00 00 00 00 00 00 00 00 00 02 51 01