serial-port

Reliably detecting presence of external hardware

一笑奈何 提交于 2019-12-11 21:24:19
问题 I have to support an increasing range of hardware that's considered, at least by today's standards, legacy. What nearly all of these devices have in common is an FTDI FT232 UART chip, which acts as a Serial-to-USB converter. Windows sees it as a standard COM port, though it is virtualized. Consequently, programmatically identifying these devices is troublesome. Since they all use the same chip (or similar), querying by typical Hardware IDs is no help since it's always the same. Are there any

Hardware flow control bits not working for ruby-serialport gem

爷,独闯天下 提交于 2019-12-11 20:16:24
问题 I am trying to use the control bits of a USB serial port adapter as general purpose I/O. This simple example should toggle the DTR line high, then low. require 'serialport' DataBits = 8 StopBits = 1 Parity = SerialPort::NONE Baud = 38400 port = '/dev/tty.usbserial-A100KXWU' serial = SerialPort.new(port, 'baud' => Baud, 'data_bits' => DataBits, 'stop_bits' => StopBits, 'parity' => Parity) serial.flow_control = SerialPort::HARD loop do p serial.signals sleep(1) serial.dtr = (serial.dtr + 1) % 2

SerialPort communication in C# splitting frames

谁都会走 提交于 2019-12-11 20:01:18
问题 I need to write a program, that will listen to communication in ModBus network through RS485. I am connected to the network with RS485 <> USB dongle. I can read some data using SerialPort.DataReceived event, but it gives strange results. Data is often split, when it should come in one piece. (Modbus Master transmits every 100ms). class Serial { private SerialPort port; Queue<byte[]> buffer; public Serial() { buffer = new Queue<byte[]>(); port = new SerialPort("COM3", 19200, Parity.Even, 8,

USB Serial Virtual COM Port : Read not working but write works

纵饮孤独 提交于 2019-12-11 19:52:12
问题 I use embedded hardware (by TI : Piccolo Control Stick xxx69) which uses FTDI usb to serial converter hardware. On PC, I have simple VC++ application which tries to communicate to hardware over Virtual COM port (VCOM : typically COM7). I am able to connect to port properly. I am able to send data from application/PC to hardware and it is received correctly. (So, Tx on PC is working fine), Application first opens the connection using createfile(... ... ...) API and then uses writefile(.. ... .

Send Function keys through serial port Serial.Write()

耗尽温柔 提交于 2019-12-11 19:51:25
问题 Can any one guide me how to send Function keys (F1 - F11) through serial port: string read_line; read_line = Console.ReadLine(); SerPort.WriteLine(read_line); 回答1: There is no standard way of sending the function keys to the serial port. You need to define your own id's for the keys (string or byte), fill it accordingly to user's current choice and send it. On the other side of the serial port whatever is listening/reading should know how to handle the input - this will be your own

Sending Long integer values from Arduino and receiving them from C# app?

狂风中的少年 提交于 2019-12-11 19:45:16
问题 As title gives it away I am trying to just send Long integer values from arduino and receiving it from my C# application. My Arduino code is void setup() { Serial.begin(9600); } long n; byte b[4]; void loop() { n=500; for (int i=0; i<10; i++) { n = n+20; IntegerToBytes(n, b); for (int i=0; i<4; ++i) { Serial.write((int)b[i]); } delay(1000); } } void IntegerToBytes(long val, byte b[4]) { b[3] = (byte )((val >> 24) & 0xff); b[2] = (byte )((val >> 16) & 0xff); b[1] = (byte )((val >> 8) & 0xff);

Plotting Serial data in Python how to pause matplotlib figure?

亡梦爱人 提交于 2019-12-11 19:32:11
问题 Basically I want to pause the live plot that I have setup here: import serial import numpy as np from matplotlib import pyplot as plt ser = serial.Serial('/dev/tty.usbmodemfa131', 9600) #Setting up the animated plot plt.ion() # set plot to animated fig = plt.figure() ydata = [0] * 100 ax1=plt.axes() # make plot line, = plt.plot(ydata) plt.ylim([24,29]) #Starting data collection while True: rawData = ser.readline().rstrip() x = len(rawData) #print(floatData) if len(rawData) <= 6: try: data =

Serial Data Event Listener Java

三世轮回 提交于 2019-12-11 19:31:29
问题 I would be really grateful if someone could point me in the right direction How would i go about triggering an event that is called when no data is received from the serial communication example below? Thank you, Maria. public void connect(String portName) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if (portIdentifier.isCurrentlyOwned()) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort =

Apparent IO.Ports.SerialPort Flaw in C# or Possible Hardware Flaw

穿精又带淫゛_ 提交于 2019-12-11 19:29:48
问题 Please forgive me as this is going to be quite a long post. I'm currently using the SerialPort class in C# to write an application to communicate with a device called a Fluke 5500A. I've, in the past, had many problems as the amount of time the device takes to issue a command and return whatever it outputs in unpredictable at best. I asked a question yesterday here: System.Timers.Timer Usage The answer to the question is wonderful and most of the time appears to work perfectly. As an example

Some help writing a s-function to read data from serial port

主宰稳场 提交于 2019-12-11 19:09:40
问题 After problems I had here, I need some help to write a function with MATLAB Function block. I saw in following links that some people solved it with that block or s-function: http://www.mathworks.co.uk/matlabcentral/newsreader/view_thread/317910 http://www.physicsforums.com/showthread.php?t=595813 http://www.mathworks.de/matlabcentral/newsreader/view_thread/250266 So I tried with this: function y = fcn(u) coder.extrinsic('only3') coder.extrinsic('serial', 'fopen','fread') coder.extrinsic('set