serial-port

Read com ports using threading in c#

泄露秘密 提交于 2019-12-23 04:30:10
问题 I would like some advise on threading as I'm new to it. I've read several articles on threading online. I'm reading com ports data. I would like to use threading such that it will read the data every 5 seconds and update the data on the listbox. Currently, all the data is being read. I'm unsure where to start. Where shall i start putting my thread codes? I'm using Windows Form,c# VS2008. Here's my codes to read the data from com ports: void datareceived(object sender,

How to find a COM port via CommPortIdentifier

左心房为你撑大大i 提交于 2019-12-23 03:44:27
问题 I am new with the whole modbus and serial communication concept so even if this is a really noob question please bear with me! Ok so I am trying to read values stored on a register, using modbus protocol and RS 232 port. I have written this code, but it is not finding serial port "COM 4" . What am I doing wrong? String wantedPortName = "COM 4" ; Enumeration portIdentifiers = CommPortIdentifier.getPortIdentifiers(); CommPortIdentifier portId = null; while (portIdentifiers.hasMoreElements()) {

Modbus Serial Port Data Reading in C#

北慕城南 提交于 2019-12-23 02:26:18
问题 Hi I am trying to read the Serial Port Data. I used NModbus library for the modbus communication. Code works fine for read and write purpose. But sometimes i am having some unknown errors and i wanted to see the serial port activity. I tried using the SerialDataReceivedEventHandler but i am not getting anything from the port but still i am able to read the value of the holding registers. Here is my code. All i want to see the data packet being sent / received over the serial port. namespace

SerialPort.DataReceived Returning Strange Results

北城余情 提交于 2019-12-22 23:44:42
问题 I'm currently working with a device called a Fluke 5500A Multi-Product Calibration Device. I've written a small program in C# to interact with it and learn more about how it works but unfortunately SerialPort.DataReceived is giving me some very strange results. The program's not long so I'm going to post it in its entirety here: class Program { static public bool isExecuting = true; static private string serialCommand; static private string dataReceived; static void Main(string[] args) {

SerialPort.DataReceived Returning Strange Results

人走茶凉 提交于 2019-12-22 23:44:29
问题 I'm currently working with a device called a Fluke 5500A Multi-Product Calibration Device. I've written a small program in C# to interact with it and learn more about how it works but unfortunately SerialPort.DataReceived is giving me some very strange results. The program's not long so I'm going to post it in its entirety here: class Program { static public bool isExecuting = true; static private string serialCommand; static private string dataReceived; static void Main(string[] args) {

How to make Scilab open a serial communication with /dev/ttyACM0 USB port in Linux (Ubuntu)

≯℡__Kan透↙ 提交于 2019-12-22 18:44:08
问题 I'm trying to open a serial communication between Scilab and Arduino. However, Arduino is always recognized by Linux Ubuntu in the /dev/tty**ACM0** port. When I write h=openserial(1,"9600,n,8,1) in Scilab I know that I'm saying to it, to open a serial comunication to COM1 or /dev/tty**S0** in Linux. But, for example, if I use h=openserial(N,"9600,n,8,1) , assuming N=port number , I will always have COMN, in Windows and /dev/tty**S**(N-1) in Linux. How do I open a serial comunication through

Serial Port Driver-Got stuck in SerialISR () routine

无人久伴 提交于 2019-12-22 17:49:48
问题 I am writing windows device driver first time for multiport serial pci card.May be this one is stupid question but i got stuck.Need someone's help.Let me first explain what I have done yet.I have bus driver which creates number of child (2/4/8/16) depends on card. Now I have to write function driver for it.The bus driver creates interrupt which I have to use.Now in my driver I got bus interface,interrupt created in bus driver and related information.I am using Serial Port Driver Sample for

XMODEM for python

会有一股神秘感。 提交于 2019-12-22 17:42:11
问题 I am writing a program that requires the use of XMODEM to transfer data from a sensor device. I'd like to avoid having to write my own XMODEM code, so I was wondering if anyone knew if there was a python XMODEM module available anywhere? 回答1: def xmodem_send(serial, file): t, anim = 0, '|/-\\' serial.setTimeout(1) while 1: if serial.read(1) != NAK: t = t + 1 print anim[t%len(anim)],'\r', if t == 60 : return False else: break p = 1 s = file.read(128) while s: s = s + '\xFF'*(128 - len(s)) chk

Why do I get partly strange values from serial port in C#

狂风中的少年 提交于 2019-12-22 13:46:32
问题 I am working on a program that process data from a scale. The Scale is connected via USB serial Port. I am using the code from this Question: How to display weight from weighing scale into a textbox via serial port RS-232 or usb converter?. So the most important part is working. I get the weight from the scale as a string. My problem is, when the scale is sending the weight values (10/s) to the computer I am getting the following values for example: 13,0g; 13,0g; 12,9g; ,8g; 12,7g; 2,6g; 12

Reliable full-duplex serial comms

不打扰是莪最后的温柔 提交于 2019-12-22 12:27:13
问题 I'm designing a device that will encrypt a long (assume infinite) stream of data sent from the PC and send it back. I'm planning to use a single serial port on the device running full duplex with hardware handshaking and "block" the data, sending a CRC value after every block. The device will only buffer a limited number of blocks- ideally just one buffer accumulating the block being received and one buffer holding the block presently being sent, switching them over at each block boundary and