serial-port

Access to serial port for windows store apps

早过忘川 提交于 2019-12-12 01:44:42
问题 I am looking for a solution to send an escape sequence to a serial port in a windows store app. Maybe my understanding of windows store apps is wrong. I don't want to run this app on a windows RT device, but on a normal windows 8 PC. I know, that windows RT devices do only support very less communication with connected devices, but not serial ports. 回答1: Well, as I know it's not possible to do something like that by using WinRT library. It's sandboxed and you can't access lots of features

Serial port (UART) c++ read

纵然是瞬间 提交于 2019-12-12 01:33:23
问题 I have a small problem with read-in function in the c++. I'm trying to read in data available on UART's RxD port. when running this code I'm getting result (read <0) hence it displays me an error msg error in read. what should be done to be able read in and display the data from read. I'm sure that there's data available on RxD port I have checked it with oscilloscope. #include <iostream> #include <termios.h> #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/signal.h>

Python: Read data via serial port from Velleman k8090

冷暖自知 提交于 2019-12-12 01:17:28
问题 I have a Velleman k8090 Relay Board from which I am trying to read some data. I can write to the board fine, but whenever I output the read data, I get strange characters like a diamond or an upside-down question mark. Here is part of my code: import serial COM_PORT = 'COM4' class Velleman8090: def __init__(self, port=COM_PORT): self.port = port self.baud_rate = 19200 self.data_bits = 8 self.parity = 'N' self.stop_bits = 1 self.flow_control = 'N' def open_device(self): self.talk = serial

Fastest way checking for COM ports

允我心安 提交于 2019-12-12 00:47:05
问题 I need to check for available COM ports in my application: I created two ways to do this. Method 1: public List<string> GetAllPortsForeach() { var allPorts = new List<string>(); foreach (String portName in System.IO.Ports.SerialPort.GetPortNames()) { allPorts.Add(portName); } return allPorts; } Method 2: public List<string> GetAllPortsForLoop() { var allPorts = new List<string>(); for (int i = 1; i <= 16; i++) { string comPortName = "COM" + Convert.ToString(i); SerialPort sp = new SerialPort

Writing binary data over serial in windows

有些话、适合烂在心里 提交于 2019-12-12 00:33:29
问题 I need to send binary data over a serial port, without any bytes getting reinterpreted as control characters along the way. I'm currently setting up my serial port as follows: #include <windows.h> // open serial port HANDLE hSerial; hSerial = CreateFile ("COM1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); // get serial parameters DCB dcbSerialParams = {0}; dcbSerialParams.DCBlength = sizeof (dcbSerialParams); if (!GetCommState(hSerial, &dcbSerialParams)) {

Change a button color on button click temporarily in C#

纵饮孤独 提交于 2019-12-12 00:13:06
问题 This is in Win forms On button click I want to change the color of the button temporarily say only for 1 second and then the button color should get back to the previous color. I used lambda expression and timer for this. private void btn_Read_Click(object sender, EventArgs e) { System.Windows.Forms.Timer t1 = new System.Windows.Forms.Timer(); t1.Interval = 1000; t1.Tick += (src, ee) => { btn_Read.BackColor = Color.Transparent; t1.Stop(); }; t1.Start(); btn_Read.BackColor = Color.YellowGreen;

How do you programmatically configure the Serial FIFO Receive and Transmit Buffers in Windows?

自古美人都是妖i 提交于 2019-12-11 23:46:27
问题 From Device Manager in Windows it is possible to configure the Receive Buffer and Transmit FIFO Buffer sizes for a serial port from Advanced Settings for a COM port: I would like to configure the values for the TX and RX FIFO buffers for COM ports programmatically. Ideally a method to do it in LabVIEW or even via .NET / command line as both are easy to interface with from LabVIEW. Edit: Just to clarify this is in regards to the 16550 compatible UART FIFO buffers and not software buffers like

IO operation aborted error thrown while reading serial port

余生颓废 提交于 2019-12-11 23:23:34
问题 We are trying to read data written by an external device (weighing scale in this case) connected to serial port using .Net serial port class. First we initialize the serial port as below: InitializeSerialPort() { if ((serialPort != null) && (serialPort.IsOpen)) { serialPort.Close(); serialPort.Dispose(); serialPort = null; } serialPort = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One) { Handshake = Handshake.None }; serialPort.DataReceived += serialPort_DataReceived; serialPort

Serial COMM port in windows remains owned after closing

点点圈 提交于 2019-12-11 23:21:54
问题 I have a problem with comm ports in JAVA. I'm using Java version, 1.5 because that version still have access to windows COMM ports (serials). The problem is that the command throws the exception: javax.comm.PortInUseException: Port currently owned by Unknown Windows Application The thing is that the application opens the comm port for the first time, then I close the comm when the user exits some window. But the user may return to that window, and therefore I try to open again the same port:

SerialPort BaseStream BeginRead never invokes callback

浪子不回头ぞ 提交于 2019-12-11 21:49:48
问题 I have a SerialPort object I know is configured correctly because I can send data to the port and the DataReceived event is properly raised. However, when I try the solution presented in How to use SerialPort class more reliably which suggests using calls to BeginRead instead of the DataReceived event, my async callback is never invoked, and the call to BeginRead appears to "hang". byte[] buffer = new byte[4096]; void KickoffRead() { _serialPort.BaseStream.BeginRead(buffer, 0, buffer.Length,